From ff021a73f0cd26b2f27ca729783aa486393f9b3a Mon Sep 17 00:00:00 2001 From: mquinson Date: Tue, 27 Jan 2004 19:53:06 +0000 Subject: [PATCH] Initial revision git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- AUTHORS | 2 + COPYING | 510 + ChangeLog | 0 INSTALL | 229 + Makefile.am | 53 + NEWS | 1 + README | 5 + ROADMAP | 35 + TODO | 220 + acmacro/aci.m4 | 576 + acmacro/gnome-warnings.m4 | 59 + bootstrap | 178 + config.guess | 1415 + config.sub | 1510 + configure | 23880 ++++++++++++++++ configure.ac | 99 + cruft/doc/Makefile.am | 191 + cruft/doc/README | 29 + cruft/doc/Roadmap.gnumeric | Bin 0 -> 3680 bytes cruft/doc/gras-docs.sgml | 299 + cruft/doc/gras-overview.fig | 187 + cruft/doc/gras-sections.txt | 325 + cruft/doc/overview.sgml | 109 + cruft/doc/tmpl/DataDesc.sgml | 180 + cruft/doc/tmpl/Globals.sgml | 43 + cruft/doc/tmpl/Messages.sgml | 99 + cruft/doc/tmpl/Socks.sgml | 65 + cruft/doc/tmpl/core_cfg.sgml | 215 + cruft/doc/tmpl/core_dico.sgml | 143 + cruft/doc/tmpl/core_dynar.sgml | 198 + cruft/doc/tmpl/core_err.sgml | 30 + cruft/doc/tmpl/core_log.sgml | 571 + cruft/doc/tmpl/cruft.sgml | 16 + cruft/doc/tmpl/gras-overview.sgml | 121 + cruft/doc/tmpl/gras-unused.sgml | 1311 + cruft/doc/tmpl/gras.sgml | 221 + cruft/doc/tmpl/gras_private.sgml | 68 + cruft/doc/tmpl/gras_rl.sgml | 112 + cruft/doc/tmpl/gras_sg.sgml | 85 + cruft/doc/tmpl/nws_comm.sgml | 85 + doc/.cvsignore | 4 + examples/.cvsignore | 1 + examples/Makefile.am | 1 + examples/WAN_3.platform.txt | 1285 + examples/WAN_3.platform_2.txt | 1285 + examples/alnem/.cvsignore | 1 + examples/alnem/Makefile.am | 28 + examples/alnem/alnem.c | 217 + examples/alnem/alnem_builder.c | 38 + examples/alnem/alnem_deployment.txt | 5 + examples/alnem/deploy_WAN3.txt | 34 + examples/alnem/interference.dat | 30 + examples/bandwidth/.cvsignore | 1 + examples/bandwidth/Makefile.am | 20 + examples/bandwidth/bandwidth.c | 104 + examples/bandwidth/bandwidth_deployment.txt | 3 + examples/gras_stub_generator | 193 + examples/ping/.cvsignore | 1 + examples/ping/Makefile.am | 23 + examples/ping/ping.c | 175 + examples/ping/ping_deployment.txt | 2 + examples/saturate/.cvsignore | 1 + examples/saturate/Makefile.am | 23 + examples/saturate/deploy_old.txt | 34 + examples/saturate/saturate.c | 253 + examples/saturate/saturate_deployment.txt | 5 + include/config.h | 123 + include/core.h | 121 + include/data_description.h | 375 + include/datadesc.h | 83 + include/dd_type_bag.h | 97 + include/dict.h | 147 + include/dynar.h | 81 + include/error.h | 143 + include/gras.h | 51 + include/log.h | 525 + include/messages.h | 238 + include/modules/bandwidth.h | 135 + include/modules/base.h | 90 + include/socket.h | 223 + install-sh | 294 + ltmain.sh | 6358 ++++ src/.cvsignore | 3 + src/Makefile.am | 2 + src/amok/.cvsignore | 1 + src/amok/Makefile.am | 9 + src/amok/bandwidth.c | 687 + src/amok/base.c | 38 + src/gras/.cvsignore | 1 + src/gras/Common/gras.c | 111 + src/gras/Common/gras_datadesc.c | 82 + src/gras/Common/gras_msg.c | 510 + src/gras/Makefile.am | 62 + src/gras/RL/gras_rl.c | 753 + src/gras/RL/gras_rl.h | 125 + src/gras/SG/gras_sg.c | 576 + src/gras/SG/gras_sg.h | 93 + src/gras/config.h | 56 + src/gras/gras_private.h | 261 + src/gras/gs/.cvsignore | 1 + src/gras/gs/categories.h | 154 + src/gras/gs/connection.h | 47 + src/gras/gs/datadesc.c | 31 + src/gras/gs/gs_private.h | 22 + src/gras/gs/message.c | 935 + src/gras/gs/message.h | 20 + src/gras/gs/net_driver.c | 108 + src/gras/gs/net_driver.h | 25 + src/gras/gs/net_driver_fd.c | 149 + src/gras/gs/net_interface_fd.h | 40 + src/gras/gs/parse.c | 459 + src/gras/gs/parse.yy.c | 1833 ++ src/gras/gs/parse.yy.h | 34 + src/gras/gs/parse.yy.l | 172 + src/gras/gs/sequence.h | 11 + src/gras/gs/tools.c | 18 + src/gras/gs/type.c | 1184 + src/gras/gs/type.h | 44 + src/gras/gs/type_driver.c | 92 + src/gras/gs/type_driver.h | 25 + src/gras/gs/type_driver_rl.c | 532 + src/gras/gs/type_interface_rl.h | 98 + src/gras/gs/vars.c | 223 + src/nws_portability/.cvsignore | 1 + src/nws_portability/Copyright | 28 + src/nws_portability/Forecast/Makefile | 42 + src/nws_portability/Forecast/exp_smooth.c | 104 + src/nws_portability/Forecast/fbuff.c | 72 + src/nws_portability/Forecast/forc.c | 1152 + src/nws_portability/Forecast/forecast_api.c | 113 + src/nws_portability/Forecast/forecasters.c | 239 + src/nws_portability/Forecast/last_value.c | 83 + src/nws_portability/Forecast/median.c | 978 + src/nws_portability/Forecast/mse_forc.c | 658 + src/nws_portability/Forecast/predictor.c | 607 + src/nws_portability/Forecast/run_mean.c | 89 + src/nws_portability/Include/.cvsignore | 1 + src/nws_portability/Include/Makefile | 37 + .../Include/config_portability.h.in | 164 + src/nws_portability/Include/diagnostic.h | 223 + src/nws_portability/Include/dnsutil.h | 112 + src/nws_portability/Include/exp_smooth.h | 20 + src/nws_portability/Include/fbuff.h | 35 + src/nws_portability/Include/forc.h | 193 + src/nws_portability/Include/forecast_api.h | 143 + src/nws_portability/Include/forecasters.h | 6 + src/nws_portability/Include/formatutil.h | 164 + src/nws_portability/Include/last_value.h | 13 + src/nws_portability/Include/median.h | 26 + src/nws_portability/Include/messages.h | 196 + src/nws_portability/Include/mse_forc.h | 20 + src/nws_portability/Include/osutil.h | 132 + src/nws_portability/Include/predictor.h | 128 + src/nws_portability/Include/protocol.h | 210 + src/nws_portability/Include/run_mean.h | 13 + src/nws_portability/Include/strutil.h | 94 + src/nws_portability/Include/timeouts.h | 59 + src/nws_portability/Makedefs.in | 45 + src/nws_portability/Makefile | 95 + src/nws_portability/README | 40 + src/nws_portability/config.guess | 1321 + src/nws_portability/config.sub | 1443 + src/nws_portability/configure | 2684 ++ src/nws_portability/configure.in | 186 + src/nws_portability/diagnostic.c | 129 + src/nws_portability/dnsutil.c | 613 + src/nws_portability/formatutil.c | 533 + src/nws_portability/install-sh | 250 + src/nws_portability/messages.c | 508 + src/nws_portability/osutil.c | 348 + src/nws_portability/protocol.c | 1107 + src/nws_portability/strutil.c | 151 + src/nws_portability/timeouts.c | 237 + testsuite/.cvsignore | 4 + testsuite/Makefile.am | 37 + testsuite/gras/gras_dummy.c | 94 + testsuite/gras/gs_example.in | 4 + testsuite/gras/gs_example_receive.c | 167 + testsuite/gras/gs_example_send.c | 197 + testsuite/gras/test_log.c | 57 + testsuite/xbt/config_usage.c | 92 + testsuite/xbt/dict_crash.c | 158 + testsuite/xbt/dict_usage.c | 191 + testsuite/xbt/dynar_double.c | 123 + testsuite/xbt/dynar_int.c | 148 + testsuite/xbt/dynar_string.c | 155 + testsuite/xbt/multidict_crash.c | 97 + 187 files changed, 73322 insertions(+) create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 NEWS create mode 100644 README create mode 100644 ROADMAP create mode 100644 TODO create mode 100644 acmacro/aci.m4 create mode 100644 acmacro/gnome-warnings.m4 create mode 100755 bootstrap create mode 100755 config.guess create mode 100755 config.sub create mode 100755 configure create mode 100644 configure.ac create mode 100644 cruft/doc/Makefile.am create mode 100644 cruft/doc/README create mode 100644 cruft/doc/Roadmap.gnumeric create mode 100644 cruft/doc/gras-docs.sgml create mode 100644 cruft/doc/gras-overview.fig create mode 100644 cruft/doc/gras-sections.txt create mode 100644 cruft/doc/overview.sgml create mode 100644 cruft/doc/tmpl/DataDesc.sgml create mode 100644 cruft/doc/tmpl/Globals.sgml create mode 100644 cruft/doc/tmpl/Messages.sgml create mode 100644 cruft/doc/tmpl/Socks.sgml create mode 100644 cruft/doc/tmpl/core_cfg.sgml create mode 100644 cruft/doc/tmpl/core_dico.sgml create mode 100644 cruft/doc/tmpl/core_dynar.sgml create mode 100644 cruft/doc/tmpl/core_err.sgml create mode 100644 cruft/doc/tmpl/core_log.sgml create mode 100644 cruft/doc/tmpl/cruft.sgml create mode 100644 cruft/doc/tmpl/gras-overview.sgml create mode 100644 cruft/doc/tmpl/gras-unused.sgml create mode 100644 cruft/doc/tmpl/gras.sgml create mode 100644 cruft/doc/tmpl/gras_private.sgml create mode 100644 cruft/doc/tmpl/gras_rl.sgml create mode 100644 cruft/doc/tmpl/gras_sg.sgml create mode 100644 cruft/doc/tmpl/nws_comm.sgml create mode 100644 doc/.cvsignore create mode 100644 examples/.cvsignore create mode 100644 examples/Makefile.am create mode 100644 examples/WAN_3.platform.txt create mode 100644 examples/WAN_3.platform_2.txt create mode 100644 examples/alnem/.cvsignore create mode 100644 examples/alnem/Makefile.am create mode 100644 examples/alnem/alnem.c create mode 100644 examples/alnem/alnem_builder.c create mode 100644 examples/alnem/alnem_deployment.txt create mode 100644 examples/alnem/deploy_WAN3.txt create mode 100644 examples/alnem/interference.dat create mode 100644 examples/bandwidth/.cvsignore create mode 100644 examples/bandwidth/Makefile.am create mode 100644 examples/bandwidth/bandwidth.c create mode 100644 examples/bandwidth/bandwidth_deployment.txt create mode 100755 examples/gras_stub_generator create mode 100644 examples/ping/.cvsignore create mode 100644 examples/ping/Makefile.am create mode 100644 examples/ping/ping.c create mode 100644 examples/ping/ping_deployment.txt create mode 100644 examples/saturate/.cvsignore create mode 100644 examples/saturate/Makefile.am create mode 100644 examples/saturate/deploy_old.txt create mode 100644 examples/saturate/saturate.c create mode 100644 examples/saturate/saturate_deployment.txt create mode 100644 include/config.h create mode 100644 include/core.h create mode 100644 include/data_description.h create mode 100644 include/datadesc.h create mode 100644 include/dd_type_bag.h create mode 100644 include/dict.h create mode 100644 include/dynar.h create mode 100644 include/error.h create mode 100644 include/gras.h create mode 100644 include/log.h create mode 100644 include/messages.h create mode 100644 include/modules/bandwidth.h create mode 100644 include/modules/base.h create mode 100644 include/socket.h create mode 100755 install-sh create mode 100644 ltmain.sh create mode 100644 src/.cvsignore create mode 100644 src/Makefile.am create mode 100644 src/amok/.cvsignore create mode 100644 src/amok/Makefile.am create mode 100644 src/amok/bandwidth.c create mode 100644 src/amok/base.c create mode 100644 src/gras/.cvsignore create mode 100644 src/gras/Common/gras.c create mode 100644 src/gras/Common/gras_datadesc.c create mode 100644 src/gras/Common/gras_msg.c create mode 100644 src/gras/Makefile.am create mode 100644 src/gras/RL/gras_rl.c create mode 100644 src/gras/RL/gras_rl.h create mode 100644 src/gras/SG/gras_sg.c create mode 100644 src/gras/SG/gras_sg.h create mode 100644 src/gras/config.h create mode 100644 src/gras/gras_private.h create mode 100644 src/gras/gs/.cvsignore create mode 100644 src/gras/gs/categories.h create mode 100644 src/gras/gs/connection.h create mode 100644 src/gras/gs/datadesc.c create mode 100644 src/gras/gs/gs_private.h create mode 100644 src/gras/gs/message.c create mode 100644 src/gras/gs/message.h create mode 100644 src/gras/gs/net_driver.c create mode 100644 src/gras/gs/net_driver.h create mode 100644 src/gras/gs/net_driver_fd.c create mode 100644 src/gras/gs/net_interface_fd.h create mode 100644 src/gras/gs/parse.c create mode 100644 src/gras/gs/parse.yy.c create mode 100644 src/gras/gs/parse.yy.h create mode 100644 src/gras/gs/parse.yy.l create mode 100644 src/gras/gs/sequence.h create mode 100644 src/gras/gs/tools.c create mode 100644 src/gras/gs/type.c create mode 100644 src/gras/gs/type.h create mode 100644 src/gras/gs/type_driver.c create mode 100644 src/gras/gs/type_driver.h create mode 100644 src/gras/gs/type_driver_rl.c create mode 100644 src/gras/gs/type_interface_rl.h create mode 100644 src/gras/gs/vars.c create mode 100644 src/nws_portability/.cvsignore create mode 100644 src/nws_portability/Copyright create mode 100644 src/nws_portability/Forecast/Makefile create mode 100644 src/nws_portability/Forecast/exp_smooth.c create mode 100644 src/nws_portability/Forecast/fbuff.c create mode 100644 src/nws_portability/Forecast/forc.c create mode 100644 src/nws_portability/Forecast/forecast_api.c create mode 100644 src/nws_portability/Forecast/forecasters.c create mode 100644 src/nws_portability/Forecast/last_value.c create mode 100644 src/nws_portability/Forecast/median.c create mode 100644 src/nws_portability/Forecast/mse_forc.c create mode 100644 src/nws_portability/Forecast/predictor.c create mode 100644 src/nws_portability/Forecast/run_mean.c create mode 100644 src/nws_portability/Include/.cvsignore create mode 100755 src/nws_portability/Include/Makefile create mode 100644 src/nws_portability/Include/config_portability.h.in create mode 100644 src/nws_portability/Include/diagnostic.h create mode 100644 src/nws_portability/Include/dnsutil.h create mode 100644 src/nws_portability/Include/exp_smooth.h create mode 100644 src/nws_portability/Include/fbuff.h create mode 100644 src/nws_portability/Include/forc.h create mode 100644 src/nws_portability/Include/forecast_api.h create mode 100644 src/nws_portability/Include/forecasters.h create mode 100644 src/nws_portability/Include/formatutil.h create mode 100644 src/nws_portability/Include/last_value.h create mode 100644 src/nws_portability/Include/median.h create mode 100644 src/nws_portability/Include/messages.h create mode 100644 src/nws_portability/Include/mse_forc.h create mode 100644 src/nws_portability/Include/osutil.h create mode 100644 src/nws_portability/Include/predictor.h create mode 100644 src/nws_portability/Include/protocol.h create mode 100644 src/nws_portability/Include/run_mean.h create mode 100644 src/nws_portability/Include/strutil.h create mode 100644 src/nws_portability/Include/timeouts.h create mode 100644 src/nws_portability/Makedefs.in create mode 100755 src/nws_portability/Makefile create mode 100755 src/nws_portability/README create mode 100755 src/nws_portability/config.guess create mode 100644 src/nws_portability/config.sub create mode 100755 src/nws_portability/configure create mode 100644 src/nws_portability/configure.in create mode 100644 src/nws_portability/diagnostic.c create mode 100644 src/nws_portability/dnsutil.c create mode 100644 src/nws_portability/formatutil.c create mode 100755 src/nws_portability/install-sh create mode 100644 src/nws_portability/messages.c create mode 100644 src/nws_portability/osutil.c create mode 100644 src/nws_portability/protocol.c create mode 100644 src/nws_portability/strutil.c create mode 100644 src/nws_portability/timeouts.c create mode 100644 testsuite/.cvsignore create mode 100644 testsuite/Makefile.am create mode 100644 testsuite/gras/gras_dummy.c create mode 100644 testsuite/gras/gs_example.in create mode 100644 testsuite/gras/gs_example_receive.c create mode 100644 testsuite/gras/gs_example_send.c create mode 100644 testsuite/gras/test_log.c create mode 100644 testsuite/xbt/config_usage.c create mode 100644 testsuite/xbt/dict_crash.c create mode 100644 testsuite/xbt/dict_usage.c create mode 100644 testsuite/xbt/dynar_double.c create mode 100644 testsuite/xbt/dynar_int.c create mode 100644 testsuite/xbt/dynar_string.c create mode 100644 testsuite/xbt/multidict_crash.c diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000000..044f0d05cd --- /dev/null +++ b/AUTHORS @@ -0,0 +1,2 @@ +Martin Quinson +Arnaud Legrand diff --git a/COPYING b/COPYING new file mode 100644 index 0000000000..cf9b6b9972 --- /dev/null +++ b/COPYING @@ -0,0 +1,510 @@ + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 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. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations +below. + + When we speak of free software, we are referring to freedom of use, +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 and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. +^L + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it +becomes a de-facto standard. To achieve this, non-free programs must +be allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. +^L + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, 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 library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete 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 distribute a copy of this License along with the +Library. + + 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 Library or any portion +of it, thus forming a work based on the Library, 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) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +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 Library, 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 Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. +^L + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you 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. + + If distribution of 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 satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. +^L + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at least + three years, to give the same user the materials specified in + Subsection 6a, above, for a charge no more than the cost of + performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be 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. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. +^L + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library 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. + + 9. 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 Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +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 with +this License. +^L + 11. 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 Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library 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 Library. + +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. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library 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. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser 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 Library +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 Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. +^L + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +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 + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "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 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. 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 LIBRARY 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 +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS +^L + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms +of the ordinary General Public License). + + To apply these terms, attach the following notices to the library. +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. + + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; 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. + +You should also get your employer (if you work as a programmer) or +your school, if any, to sign a "copyright disclaimer" for the library, +if necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James + Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000000..e69de29bb2 diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000000..54caf7c190 --- /dev/null +++ b/INSTALL @@ -0,0 +1,229 @@ +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software +Foundation, Inc. + + This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + 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 you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the `--target=TYPE' option to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000000..a83495f9de --- /dev/null +++ b/Makefile.am @@ -0,0 +1,53 @@ +SUBDIRS= doc src +DISTCLEANFILES = *~ + +ACLOCAL = aclocal -I tools/acmacro -I /usr/share/aclocal/gnome2-macros +AUTOMAKE_OPTIONS = gnu + +EXTRA_DIST = bootstrap COPYING INSTALL NEWS README TODO AUTHORS +# Cflags.Makefile.am \ +# doc/FAQ.txt \ +# doc/footer.html \ +# doc/html \ +# doc/index.doc \ +# doc/Makefile.Example.am \ +# doc/Makefile.Example.in \ +# tools/colorize.pl \ +# tools/index_create.pl \ +# tools/acmacro + + +TAGS: + etags `find . -name "*.[ch]"` + +tags: TAGS + +publish: dist + @echo "----[ Put the tarball @VERSION@ on gcl ]----" + scp @PACKAGE@-@VERSION@.tar.gz gcl.ucsd.edu:/home/www/simgrid/dl/ + scp -r doc/html/* gcl.ucsd.edu:/home/www/simgrid/ + scp ChangeLog gcl.ucsd.edu:/home/www/simgrid/dl/ + @echo "----[ Put the tarball @VERSION@ on the local filesystem ]----" + cp @PACKAGE@-@VERSION@.tar.gz ~/public_html/simgrid2 + cp -r doc/html ~/public_html/simgrid2/doc/ + cp ChangeLog ~/public_html/simgrid2/ + +mail: + @ver=`dpkg-parsechangelog -lChangeLog| egrep '^Version: ' | sed 's/Version: //'`;\ + (echo "Hello," ; \ + echo; \ + echo "A new version of GRAS is available. Here is the changelog:";\ + echo;echo;\ + dpkg-parsechangelog -lChangeLog ;\ + echo;echo; \ + echo "It is available from the official website:";\ + echo " http://grail.sdsc.edu/simgrid/";\ + echo;echo "Cheers, Mt.") | \ + mail -e \ + -a "From: Martin.Quinson@ens-lyon.fr" \ + -s "New version of GRAS ($$ver)" \ + martin.quinson@ens-lyon.fr,arnaud.legrand@ens-lyon.fr + + +splint: + splint `find src examples -name '*.c'` +matchanyintegral -warnposix +boolint -Inws_portability/Include/ -Isrc/ diff --git a/NEWS b/NEWS new file mode 100644 index 0000000000..d0fd87606d --- /dev/null +++ b/NEWS @@ -0,0 +1 @@ +Everything is new or even to be written for now. diff --git a/README b/README new file mode 100644 index 0000000000..f70e46fe9e --- /dev/null +++ b/README @@ -0,0 +1,5 @@ +This is the GRAS (Grid Reality And Simulation) library. + +This is a communication wrapper so that the same code can run at the same +time in the reality using sockets and in the SimGrid simulator. See +doc/GRAS.design for more info. diff --git a/ROADMAP b/ROADMAP new file mode 100644 index 0000000000..f4c6126186 --- /dev/null +++ b/ROADMAP @@ -0,0 +1,35 @@ +Dossiers: 2 days + +----[ GRAS ]--------------------------------------- + +Milestone 0: 3 days (01/25) + - core ok (errors, logs ; dynars, dicts, hooks, pools; config, rrdb) + +Milestone 1: 1 week (02/01) + - base API ok (dispatch, type parsing macro) + - binary representation: fixed types (from NWS) + - transport: TCP (from NWS), SG, File + - virtualize (linux, solaris, SG) & conditions + + Possible paper: 1.5 weeks + - implement some NAS benchmarks on top of GRAS, and validate GRAS (plus + SimGrid) by showing that the simulator leads to the same behaviours + +Milestone 2: 2 weeks (02/15) + - binary representation: any type, SNWF (Sender Native Wire Format) + - convertions between linux/i32, linux/alpha, solaris/sparc + + Possible paper: 1.5 weeks + - benchmark GRAS, TCP (NWS), globus, MPI, CORBA, and show the benefit of + SNWF + +Milestone 3 (GRAS 1): 2 weeks (end Feb) + - modules (logs, manage, token ring, bw) + - cleanups, documentation + +----[ NWS ]---------------------------------------- + +Milestone 1: 3 days + - wrapper over GRAS replacing the portability lib + + - diff --git a/TODO b/TODO new file mode 100644 index 0000000000..15ca38de3a --- /dev/null +++ b/TODO @@ -0,0 +1,220 @@ +* Use of data on the stack as argument to MsgNew does not work +* Warn when using a server socket to write, or a client one to poll + +* while (1) { fork; exec the child, wait in father } +* message forwarding + +[autoconf] + Check in autoconf that no datatype is bigger than 64, or dynar_map will + get into trouble... + +[portability layer] + Make a script to test how the padding bytes are on the current arch, and + constitute a bestiary. + Use Arnaud's structure parser in a macro + Dynar of type, such as ref of type + Generate convertors in assembler ? + Mallocators + +[Messaging] + Message forwarding + Message priority + Messages in a tree manner + +[network drivers] + Interface: open_server, open_client, read, write, flush, close + Implementations: TCP, SG (more after my PhD). + +[errors] + Better split casual errors from programing errors. + The first ones should be repported to the user, the second should kill + the program (or, yet better, only the msg handler) + Allows the use of an error handler depending on the current module (ie, + the same philosophy than log4c using GSL's error functions) + Rethink the error codes. Source of inspirations are: + - comerr (common error reporting from ext2) + - libgpg-error + +[logs] + Parse argv (check leonie and tbx_arg_iterator in tbx_parameter.h) + Several appenders; fix the setting stuff to change the appender + Hijack message from a given category to another for a while (to mask + initializations) + +[dict] + Make a real container for the dict, so that the free function may be given + only once for the whole tree (would help to send dicts). + dichotomie in search + speed up the cursors, for example using the contexts when available + fix multi levels dicts + +********* +* GRAS1 * Integrer grassouillet a gras; multiplexage XML; module de comm +********* +[type_bag SG] + un peu comme les type_bag RL, mais sans tenir compte d'incoming ni + outcoming. + La finesse est de simuler la taille des envois sans les faire + On peut aussi imaginer une version faisant ces envois effectivement, qui + serait un peu plus lente, mais permettant de debugger cette partie de + grassouillet + +[pilotes reseaux de sous grassouillet] + TCP: utilise le fd. rien a faire. + SG: Le send fait le boulot de malloc du recv de fd, et les rempli comme le + send de fd. + BLOC: Un nouveau truc, qui envoi des trames les unes derriere les autres, + un write copie dans un buffer qui, quand il est plein, part sur la socket + avec sa taille devant, et son CRC derriere. + C'est le prix a payer pour ne plus mourrir si vite en cas de transmission + pourrie (mais ca resoud tjs pas le pb du code malicieux) + Possibilite de compresser les buffers avant l'envoi.. + +[simuler le select sur les sockets avec des threads] + Le plan, c'est qu'a l'ouverture d'une socket server, on cree un thread + charge de faire du pool blocant dessus, et des que ce thread se debloque + car il commence a lire qqch, il passe la main a un thread de + communication charge de faire la lecture. + Quand la lecture est finie, le thread de comm passe la main aux threads + d'execution (un par couleur). + + Voici comment faire le coeur du truc [dixit Olivier]: + Une liste est utilisee pour stocker ce que le thread de comm a le droit + de lire. Elle est protegee par mutex pour eviter les acces concurents. + c'est la "liste de lecture" + Une semaphore "de lecture" est utilisee pour permettre aux threads + servants des sockets de prevenir le thread de comm qu'ils ont qqch + pour lui + Dans la liste de lecture, on place les messages en cours de creation, et + un ptit mutex pour que le thread de comm dise aux threads servants de + retourner ecouter la socket car il a fini + Chaque couleur a sa file de callback a appeller, proteger par semaphore + et un mutex comme pour la file de lecture + + Init: + initialisation de toutes les semaphore a 0 + comm: sem_P(semaphore lecture) + couleur: sem_P(semaphore de la couleur correspondante) + servant: read (1) sur la socket + + Arrive d'un message + servant: + 1) le read debloque (c'est la version de gras, utilisee pour multiplexe + sur le XML, ou sur les differentes versions de gras/de pilote reseau) + 2) Allocation du message vide pour contenir ce qui s'annonce + 3) initialisation du mutex du message_instance a 0 (verrouille) + 4) placement du message instance dans la file (prise de mutex, + placement, lachage de mutex) + 5) sem_V(sempahore) + 6) mutex_lock sur le mutex_verrouille + sleep + 7) quand on revient, on rebloque un read(1), et on recommence + + comm: + 1) on se reveille quand la semaphore se libere (etape 6 des servants) + 2) prise d'une tache dans la file (protegee par semaphore) + 3) lecture de l'instance de message + 4) lache le mutex dans l'instance pour liberer le servant + 5) pose le message pret dans la file de la couleur correpondant au + premier callback de la pile pour ces {messageID x version} et + augmente le semaphore correspondant. + 6) se rebloque sur le semaphore de lecture et recommence + + couleur: + 1) on se reveille quand quelqu'un a pose qqch dans sa file des messages + prets + 2) on le retire de la file + 3) on acquiere le mutex d'execution de sa couleur (pour les callbacks + cameleon) + 4) on execute le callback qu'il faut + 5) on lache le mutex de sa couleur + Si le callback annonce avoir mange le message + a) on libere le message (le payload doit avoir ete libere par + l'utilisateur) + b) on decremente le TTL du callback, et on le vire si c'etait pas un + callback infini et qu'il arrive en fin de vie + Sinon + a) on place le message dans la liste des messages de la couleur du + suivant dans la pile des callback + 6) On se rendort sur le semaphore de sa couleur et recommence + + Emission d'un message: + A faire. Le thread de comm peut faire ceci, ou on peut faire un nouveau + thread de comm pour cela. + + Fermeture d'une socket client: + Probleme: faut tuer le thread servant. + Solution pour l'instant: fermer la socket depuis ailleurs. + Solution si ca marche pas (ou pas partout): Les servants font des + selects sur un pool {leur socket x un pipe fait pour} + Quand qqch arrive sur le pipe, c'est le signal du suicide. + +[Conversions inter-architectures] + Marquer les padding bytes explicitement aux structures (juste le sizeof + doit suffire) + Marquer les offsetof des fields explicitement a l'ajout. + Prevoir tous les encoding pour les types elementaires + [taille, sexe, signess[non, a un, a deux]] + plus les flotants, justifiant un traitement a part + Tester avec autoconf les encodings sur l'archi courante + Trouver un moyen de convertir un encoding en un autre (si possible par + blocs) + Generer ces convertors en assembleur a chaud, puisqu'on a rien de mieux a + foutre de notre temps + +[XML] + Tout comme c'est dit dans les articles + +[Macro parseuse] + Gerer les typedefs (necessite de l'aide de grassouillet) + Gerer les pointeurs. + Faut des annotations pour dire si c'est : + - un AZT + - un tableau dont la longueur est ailleurs dans la struct + - une ref + Ca peut se faire soit avec des commentaires, soit avec des macros se + reecrivant a rien dans la vraie vie, et parsee. Mais le risque est que + ces macros soient reecrites avant d'etre passee a mon bordel, selon les + cpp. + Gerer les unions => specifier des annotations, mais j'y crois pas + Gerer les enum + Gerer les long long + Gerer les types struct, union et enum anonymes au milieu d'un autre bloc de + donnees. + Verifier que "char"="signed char" sur toutes les archis + + Renomer gs_parse_tok_num en gs_parse_token + Check short a, b; + Check short *** + Check struct { struct { int a } b; } + +[Grassouillet] + Gerer les typedefs pour aliaser un type sur un autre + Merger gs_type_union_append_field et gs_type_struc_append_field si possible. + Gerer les enum ? + gs_type_copy/gs_type_free + A quoi sert le champ name de gs_type_struct_append_field ? + Ca plante bizarement si on met une structure n'existant pas dans le + message (a l'usage) + gs_type_dump, nardin, comment voir ce qui se passe sinon ?? + +[Autres] + Simplifier l'API pour virer les sequences + Faire le parseur automatique de structures + Faire toutes les modifs aux Utils listees plus haut + Simplifier l'envoi de dynar et dico + Mettre les mutex et semaphores dans les dynar directement + Tenter (politiquement) le passage a GPL, pour voler du code. + + +************ +* La suite * +************ +GRAS double (ou encore "GRAS too" ou "too GRAS"): + - Priorite des messages + - Outils de visu pour ce qui se passe dans le simulo + - Outils de visu/deployement/management pour RL + +GRAS (très): + - outils mathematiques pour dire des choses sur la validite du protocole + diff --git a/acmacro/aci.m4 b/acmacro/aci.m4 new file mode 100644 index 0000000000..48f838a541 --- /dev/null +++ b/acmacro/aci.m4 @@ -0,0 +1,576 @@ +dnl +dnl ACI macros -- intra and extra package dependencies handling macros. +dnl those autoconf macro allows you to declare which parts of your project +dnl depend on which external package, or even on other parts of your code. +dnl + +dnl Copyright (C) 2000,2001,2002,2003 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +dnl History: +dnl one day, I'll do a public release. Until then, check the FAST changelogs. + + +dnl ACI_PREREQ: Check that at least version $1 of ACI macros are available + +m4_define([aci_version],[2003.01.16]) +m4_define([ACI_PREREQ], +[m4_if(m4_version_compare(m4_defn([aci_version]), [$1]), -1, + [m4_default([$3], + [m4_fatal([ACI macros version $1 or higher is required])])], + [$2])[]dnl +]) + + +dnl ACI_D: echo something to the config.log +AC_DEFUN([ACI_D],[echo $1>&5;])dnl >&5 +AC_DEFUN([ACI_ECHO],[echo $1;echo $1>&5]) + + +dnl ACI_PACKAGE: defines a package (ie, an external package we should search) +dnl SYNOPSIS: +dnl 1=Package (name of the package) +dnl 2=Description (human readable, for documentation) +dnl 3=Function (the main function to search) +dnl 4=Library list (where to search, space separated list of group of LDFLAGS +dnl each LDFLAGS is ! separated. +dnl example: "-lldap -lldap!-llber" +dnl warning: can't contain tabs or newlines) +dnl 5=Header to check +dnl 6=what to do if found +dnl 7=what to do if not found (default: AC_MSG_ERROR(blabla)) +dnl It is possible to change any of the exported values in $6 or $7 +dnl ACTIONS: +dnl - try to find the function in each part of LDFLAGS and the header. +dnl - AC_SUBST the following values: +dnl HAVE_$1: 'yes' or 'no' +dnl CFLAGS_$1: CFLAGS to acces to this package +dnl LIBS_$1: LDFLAGS to acces to this package +dnl - define the following arguments to ./configure: +dnl --with-$1 root dir of install +dnl --with-$1-includes where to search the header +dnl --with-$1-libs where to search the libs +dnl --with-$1-extra extra LDFLAGS to pass to the linker +AC_DEFUN([ACI_PACKAGE],[ + pushdef([aci_name], [$1]) + pushdef([aci_help], [$2]) + pushdef([aci_func], [$3]) + pushdef([aci_paths], [$4]) + pushdef([aci_header], [$5]) + pushdef([aci_if_yes], [$6]) + pushdef([aci_if_no], [$7]) + + aci_nameok=`echo $1|sed 'y/-/./'` + if test "x$1" != "x$aci_nameok" ; then + AC_MSG_ERROR([ACI error: Please no '-' in package name. (ie, $1 is not a valid name)]) + fi + ACI_D("[BEGINING OF ACI-PACKAGE($1)]") + aci_module_desc_$1="$2" + AC_SUBST([aci_module_desc_$1])dnl + aci_packages="$aci_packages $1" + + dnl + dnl Specify the options + dnl + AC_ARG_WITH([$1], + AC_HELP_STRING([--with-$1=DIR], + [root directory of aci_help installation]), + [with_$1=$withval + good=yes + if test "$withval" = yes ; then good=no; fi + if test "$withval" = no ; then good=no; fi + if test $good = no ; then + AC_MSG_ERROR([You gave me --with-$1=$withval. I wait for a location[,] not yes or no (use --enable-[]aci_help or --disable-[]aci_help for that)]) + fi + aci_pkg_prefix_$1="$withval" + CFLAGS_$1="-I$withval/include $CFLAGS_$1" + LIBS_$1="-L$withval/lib $LIBS_$1" + ]) + + AC_ARG_WITH([$1-includes], + AC_HELP_STRING([--with-$1-includes=DIR], + [specify exact include dir for aci_help headers]), + [CFLAGS_$1="-I$withval $CFLAGS_$1" + aci_pkg_inc_$1="$withval" + ]) + + AC_ARG_WITH([$1-libraries], + AC_HELP_STRING([--with-$1-libraries=DIR], + [specify exact library dir for aci_help library] + ),[LIBS_$1="-L$withval $LIBS_$1" + aci_pkg_lib_$1="$withval"]) + + AC_ARG_WITH([$1-extra], + AC_HELP_STRING([--with-$1-extra=ARG], + [specify extra args to pass to the linker to get the aci_help library (with no space. A sed to change "!" to " " is run)] + ),[LIBS_$1=`echo $withval|sed 's/!/ /g'`" $LIBS_$1" + aci_pkg_extra_$1="$withval"]) + + AC_SUBST([aci_pkg_prefix_$1])dnl + AC_SUBST([aci_pkg_inc_$1])dnl + AC_SUBST([aci_pkg_lib_$1])dnl + AC_SUBST([aci_pkg_extra_$1])dnl + + dnl + dnl Search the lib + dnl + OLD_LDFLAGS=$LDFLAGS + OLD_CFLAGS=$CFLAGS + OLD_CPPFLAGS=$CPPFLAGS + + dnl make sure there is no newline in paths + i=`echo aci_paths|wc -l` + if test $i != 1 && test $i != 0 ; then + AC_MSG_ERROR([Badly formed args for function ACI-PACKAGE. + please no newline and no tab.]) + fi + + ac_func_search_save_LIBS="$LIBS" + ac_func_search_save_this_LIBS="$LIBS_$1" + aci_found="no" + echo "----------------------------------------" >&5 + AC_MSG_CHECKING([for aci_name. Can I access aci_func without new libs]) + AC_TRY_LINK_FUNC([$3],[AC_MSG_RESULT([yes]) aci_found="yes"],[AC_MSG_RESULT([no])]) + if test "$aci_found" = "no"; then + if test -n "$LIBS_$1" ; then + LIBS="$LIBS_$1" + echo "----------------------------------------" >&5 + AC_MSG_CHECKING([for aci_name. Can I access aci_func the specified extra args]) + AC_TRY_LINK_FUNC(aci_func,aci_found="yes",aci_found="no") + AC_MSG_RESULT($aci_found) + fi + fi + for i in aci_paths + do + if test "x$aci_found" = "xno"; then + LIBS_$1=`echo "$i $ac_func_search_save_this_LIBS"|sed 's/!/ /g'` + LIBS="$LIBS_$1 $ac_func_search_save_LIBS" + echo "----------------------------------------" >&5 + AC_MSG_CHECKING([for aci_name. Can I access aci_func with $LIBS_$1]) + AC_TRY_LINK_FUNC(aci_func,aci_found="yes",aci_found="no") + AC_MSG_RESULT($aci_found) + fi + done + LIBS="$ac_func_search_save_LIBS" + + dnl + dnl search for the header (only if the lib was found) + dnl + if test "x$aci_found" = "xyes" && test "x"aci_header != "x" ; then + CPPFLAGS="$CPPFLAGS $CFLAGS_$1" + ACI_D("CPPFLAGS=$CPPFLAGS") + AC_CHECK_HEADER(aci_header,good=yes,good=no) + fi + if test "x$aci_found" = "xno" ; then + dnl Something where not found. + dnl If the caller specified what to do in this case, do it. + dnl Else, complain. + ifelse(aci_if_no, , + [AC_MSG_ERROR(Can't find the package $1. Please install it[,] or if it is installed[,] tell me where with the --with-$1 argument (see ./configure --help=short).)], + aci_if_no) + else + dnl Anything where found + HAVE_$1="yes" + ifelse(aci_if_yes, , echo >/dev/null, aci_if_yes) + fi + if test "x$HAVE_$1" != "xyes" ; then + CFLAGS_$1="" + LIBS_$1="" + fi + dnl AC_SUBST what should be + AC_SUBST(HAVE_$1) + AC_SUBST(CFLAGS_$1) + AC_SUBST(LIBS_$1) + + ACI_D("[END OF ACI-PACKAGE($1)]") + dnl restore the old settings + LDFLAGS=$OLDLDFLAGS + CPPFLAGS=$OLDCPPFLAGS + CFLAGS=$OLDCFLAGS +]) + +dnl ACI_PACKAGE_SAVED: same as ACI_PACKAGE, but with an external cache +dnl SYNOPSIS: +dnl 1=Package (name of the package) +dnl 2=Description (human readable, for documentation) +dnl 3=Cache program.Should accept --libs and --cflags (like gnome-config does) +dnl 4=Extra arg to pass to this prog (like a name of library) +dnl 5=what to do if found +dnl 6=what to do if not found (default AC_MSG_ERROR(blabla)) +dnl ACTIONS: +dnl - try to find the cache program +dnl - AC_SUBST the following values: +dnl HAVE_$1: 'yes' or 'no' +dnl CFLAGS_$1: CFLAGS to acces to this package +dnl LIBS_$1: LDFLAGS to acces to this package + +AC_DEFUN([ACI_PACKAGE_SAVED],[ + ACI_D("[BEGINING OF ACI-PACKAGE-SAVED($1)]") + AC_PATH_PROG(ACI_CACHE_PROG,$3,no) + aci_module_desc_$1="$2" + AC_SUBST([aci_module_desc_$1])dnl + aci_pkg_config_$1=$3 + AC_SUBST([aci_pkg_config_$1])dnl + aci_packages="$aci_packages $1" + if test x$ACI_CACHE_PROG = xno; then + HAVE_$1=no + CFLAGS_$1="" + LIBS_$1="" + ifelse($6, ,[AC_MSG_ERROR([Cannot find $1: Is $3 in your path?])],$6) + else + HAVE_$1=yes + CFLAGS_$1=`$ACI_CACHE_PROG --cflags $4` + LIBS_$1=`$ACI_CACHE_PROG --libs $4` + ifelse($5, ,echo >/dev/null,$5) + fi + dnl AC_SUBST what should be + AC_SUBST([HAVE_$1])dnl + AC_SUBST([CFLAGS_$1])dnl + AC_SUBST([LIBS_$1])dnl + ACI_D("[END OF ACI-PACKAGE-SAVED($1)]") +]) + + +dnl ACI_MODULE: defines a module (ie, a part of the code we are building) +dnl 1=abbrev +dnl 2=human readable description +dnl 3=dependencies (space separated list of abbrev) +dnl 4=submodules (space separated list of abbrev) +dnl 5=default ([yes]/no) (if not given, yes is assumed) +dnl 6=extra childs, which are listed under it in tree, without being a module + +AC_DEFUN([ACI_MODULE],[ + ACI_D("[BEGINING OF ACI-MODULE($1)]") + aci_nameok=`echo $1|sed 'y/-/./'` + if test "x$1" != "x$aci_nameok" ; then + AC_MSG_ERROR([ACI error: Please no '-' in module name. (ie, $1 is not a valid name)]) + fi + aci_module_desc_$1="$2" + aci_module_dep_$1="$3" + aci_module_sub_$1="$4" + aci_module_child_$1="$4 $6" + AC_SUBST(aci_module_desc_$1) + AC_SUBST(aci_module_dep_$1) + AC_SUBST(aci_module_sub_$1) + AC_SUBST(aci_module_child_$1) + AC_SUBST(SUBMODULES_$1) + AC_SUBST(DIST_SUBMODULES_$1) + + AC_ARG_ENABLE($1, + AC_HELP_STRING([--enable-$1], + [Enable the module $1, $2.])) + + ifelse(ifelse([$5], ,[yes],[$5]),[yes], + dnl what to do if module is enabled by default + [aci_module_default_$1="enabled"], + [aci_module_default_$1="disabled"]) + + if test "x$enable_$1" == "xyes" ; then + aci_module_status_$1="enabled" + else if test "x$enable_$1" == "xno" ; then + aci_module_status_$1="disabled" + else + aci_module_status_$1="$aci_module_default_$1" + fi fi + if test "$aci_module_status_$1" == "enabled" ; then + aci_modules_possible="$aci_modules_possible $1" + else + aci_modules_disabled="$aci_modules_disabled $1" + fi + ACI_D("[END OF ACI-MODULE($1). Default:$aci_module_default_$1; Result:$aci_module_status_$1]") +]) + +dnl ACI_MODULES_VERIFY: verify which module can be satisfied +dnl export: +dnl - SUBMODULES_$1 to Makefiles, init'ed to the list of submodules to build +dnl (use it in SUBDIRS in Makefile.am) +dnl - DIST_SUBMODULES_$1 to Makefiles, init'ed to the list of submodules which could +dnl be build but have unsatisfied dependencies +dnl (use it in DIST_SUBDIRS in Makefile.am) +dnl 1: the name of this group of modules + +AC_DEFUN([ACI_MODULES_VERIFY],[ + ## + # Sanity check + ## + if echo $aci_modules_disabled $aci_modules_possible | grep $1 >/dev/null ; then + : + else + AC_MSG_ERROR([ACI Error: You called MODULES_VERIFY($1), but $1 isn't a module]) + fi + + dnl Check the dependencies of everyone + for aci_module in $aci_modules_possible + do + aci_mod_bad="" + ACI_D("Look module $aci_module") + for aci_mod_dep in `eval echo '$aci_module_dep_'"$aci_module"` + do + ACI_D($ECHO_N " it depends on $aci_mod_dep...") + if test `eval echo 'x$'"HAVE_$aci_mod_dep"` != xyes; then + ACI_D("Not satisfied !") + aci_mod_bad=`echo "$aci_mod_bad $aci_mod_dep"|sed 's/^ *//'` + else + ACI_D("Satisfied !") + fi + done + if test -z "$aci_mod_bad"; then + ACI_D("Module $aci_module will be builded") + ACI_D([]) + aci_modules="$aci_modules $aci_module" + eval "HAVE_$aci_module=\"yes\"" + else + ACI_D("Won't build $aci_module because it depends on $aci_mod_bad.") + ACI_D([]) + eval "aci_module_misdep_$aci_module=\"$aci_mod_bad\"" + aci_modules_broken="$aci_modules_broken $aci_module" + eval "HAVE_$aci_module=\"no\"" + fi + done + + dnl Build the list of submodules to build + ACI_D("Build the submodules lists") + for aci_module in $aci_modules_possible + do + ACI_D($ECHO_N " Look for $aci_module: ") + for aci_mod_sub in `eval echo '$aci_module_sub_'"$aci_module"` + do + if test `eval echo 'x$HAVE_'"$aci_mod_sub"` = xyes; then + ACI_D($ECHO_N "$aci_mod_sub ") + eval "SUBMODULES_$aci_module=\"\$MODULES_$aci_module $aci_mod_sub\"" + else + ACI_D($ECHO_N "NOT $aci_mod_sub ") + eval "DIST_SUBMODULES_$aci_module=\"\$DIST_MODULES_$aci_module $aci_mod_sub\"" + fi + done + ACI_D([]) + done + + dnl support for external interactif configurator + AC_SUBST([ac_configure_args])dnl which argument were passed to configure + AC_SUBST([aci_modules_possible])dnl + AC_SUBST([aci_modules])dnl + AC_SUBST([aci_modules_broken])dnl + AC_SUBST([aci_modules_disabled])dnl + AC_SUBST([aci_packages])dnl +]) + +dnl ACI_MODULES_SUMMARY: give a summary of what will be build to user +dnl 1: Name of the root of modules (can be a space separated list) + +AC_DEFUN([ACI_MODULES_SUMMARY],[ + if test "x$aci_modules" != "x"; then + echo "The following modules will be builded: " + for aci_module in $aci_modules + do + echo " - $aci_module: "`eval echo '$aci_module_desc_'"$aci_module"` + if test -n "`echo "\$MODULES_$aci_module"`" ; then + echo " builded submodules: "`eval echo '$MODULES_'"$aci_module"` + fi + done + else + echo "No module will be build." + fi + echo + + if test "x$aci_modules_disabled" != "x"; then + echo "The following modules are disabled, either by you or by default." + for aci_module in $aci_modules_disabled + do + echo " - $aci_module: "`eval echo '$aci_module_desc_'"$aci_module"` + done + echo + fi + + if test "x$aci_modules_broken" != "x"; then + echo "The following modules have BROKEN dependencies:" + for aci_module in $aci_modules_broken + do + echo " - $aci_module: "`eval echo '$aci_module_desc_'"$aci_module"` + echo " Depends on: "`eval echo '$aci_module_misdep_'"$aci_module"` + done + + echo + echo " If you think I'm a dumb script, and these dependencies can be" + echo " satified, please try to use the --with-PACKAGE options. See:" + echo " ./configure --help=short" + echo + echo "The other modules may be build even if these ones are not." + echo + fi +]) + + +dnl ACI_MODULES_SUMMARY_FANCY: same as ACI_MODULES_SUMMARY, in a fancy way. +AC_DEFUN([ACI_MODULES_SUMMARY_FANCY],[ + # the file conftests.nexts is a file containing the modules we still have to + # handle. Each line have the form "level nb module", defining at which + # is defined. It is the th at this level + + ## + # Sanity check + ## + if echo $aci_modules_disabled $aci_modules_possible | grep $1 >/dev/null ; then + : + else + AC_MSG_ERROR([ACI Error: You called MODULES_SUMMARY_FANCY($1), but $1 isn't a module]) + fi + + ### + # Initializations + ### + ACI_ECHO([]) + name="$1" + echo "BEGIN OF ACI_SUMMARY_FANCY">&5 + ACI_ECHO(["Summary of the configuration for $name"]) + aci_sum_more="no" # If there is more modules to handle + rm -f conftest.nexts conftest.nexts.new + + # initialize aci_sum_nexts and aci_sum_more from the given argument + aci_sum_nb=9 + for aci_sum_tmp in $1 + do + echo "0 $aci_sum_nb $aci_sum_tmp" >> conftest.nexts + aci_sum_more="yes" + aci_sum_nb=`expr $aci_sum_nb - 1` + done + +#cat conftest.nexts +#echo "---" + + ### + # Main loop + ### + while test "x$aci_sum_more" = "xyes" ; do + + # sort the list + sort -r -k 1,3 conftest.nexts > conftest.nexts.new + mv conftest.nexts.new conftest.nexts + + changequote(<<, >>)dnl because of the regexp [[:blank:]] + + # get the next elem to handle and its level, and remove it from the list + aci_sum_this=`head -n 1 conftest.nexts|\ + sed -e 's/^[0-9]*[[:blank:]]*[0-9]*[[:blank:]]*\([^[:blank:]]*$\)/\1/'` + aci_sum_lvl=`head -n 1 conftest.nexts |\ + sed -e 's/^\([0-9]*\)[[:blank:]].*$/\1/'` + +# aci_sum_this=`sed -e '1~1000s/^[0-9]*[[:blank:]]*[0-9]*[[:blank:]]*\([^[:blank:]]*$\)/\1/'\ +# -e '2~1d'\ +# conftest.nexts` +# aci_sum_lvl=`sed -e '1~1000s/^\([0-9]*\)[[:blank:]].*$/\1/'\ +# -e '2~1d'\ +# conftest.nexts` + + tail +2l conftest.nexts > conftest.nexts.new + mv conftest.nexts.new conftest.nexts + +#echo "aci_sum_this=$aci_sum_this" +#cat conftest.nexts +#echo "---" + # stop if nothing else to do + if test "x$aci_sum_this" = x ; then + aci_sum_more="no" + else + # Add the sub modules of this on to the file + aci_sum_sub=`expr $aci_sum_lvl + 1` + aci_sum_nb=9 + for aci_sum_tmp in `eval echo '$aci_module_child_'"$aci_sum_this"` + do + echo "$aci_sum_sub $aci_sum_nb $aci_sum_tmp" >> conftest.nexts + aci_sum_nb=`expr $aci_sum_nb - 1` + done + + # compute the status of this module + if echo $aci_modules_disabled|grep $aci_sum_this >/dev/null; then + aci_sum_status="(DISABLED)" + else + if test `eval echo '"x$aci_module_misdep_'"$aci_sum_this\""` = x ; then + aci_sum_status="(OK)" + else + aci_sum_status="(BROKEN)" + fi + fi + + # Outputs the title of this module + aci_sum_header="" + while test $aci_sum_lvl -ne 0 + do + aci_sum_header="$aci_sum_header " + aci_sum_lvl=`expr $aci_sum_lvl - 1` + done + + changequote([, ])dnl back to normality, there is no regexp afterward + ACI_ECHO("$aci_sum_header"'>'" $aci_sum_this$aci_sum_status: "`eval echo '$aci_module_desc_'"$aci_sum_this"`) + + aci_sum_head_dep="$aci_sum_header " + aci_sum_tmp=`eval echo '$'"MODULES_$aci_sum_this"| + sed 's/[^[:blank:]] .*$//'` + if test "x$aci_sum_tmp" != x ; then + ACI_ECHO("$aci_sum_head_dep Optional submodules to build: "`eval echo '$'"MODULES_$aci_sum_this"`) + fi + + + # outputs the dependencies of this module + aci_sum_deps="" + aci_sum_dep_some="no" + for aci_sum_dep in `eval echo '$aci_module_dep_'"$aci_sum_this"` + do + if echo $aci_packages|grep $aci_sum_dep>/dev/null ||\ + echo `eval echo '$aci_module_misdep_'"$aci_sum_this"`|grep $aci_sum_dep >/dev/null; then + aci_sum_deps="$aci_sum_deps $aci_sum_dep" + aci_sum_dep_some="yes" + fi + done + if test "x$aci_sum_dep_some" = xyes ; then + ACI_ECHO("$aci_sum_head_dep Packages and modules it depends on:") + for aci_sum_dep in $aci_sum_deps + do + # compute the status of this package + if test `eval echo 'x$'"HAVE_$aci_sum_dep"` = xyes ; then + aci_sum_pkg_status="(FOUND)" + else + aci_sum_pkg_status="(NOT FOUND)" + fi + + # output the status of this package + ACI_ECHO("$aci_sum_head_dep o $aci_sum_dep$aci_sum_pkg_status: "`eval echo '$aci_module_desc_'"$aci_sum_dep"`) + aci_sum_tmp=`eval echo '$'"LIBS_$aci_sum_dep"| + sed 's/[^[:blank:]] .*$//'` + if test "x$aci_sum_tmp" != x ; then + ACI_ECHO( "$aci_sum_head_dep LIBS: "`eval echo '$'"LIBS_$aci_sum_dep"`) + fi + aci_sum_tmp=`eval echo '$'"CFLAGS_$aci_sum_dep"| + sed 's/[^[:blank:]] .*$//'` + if test "x$aci_sum_tmp" != x ; then + ACI_ECHO("$aci_sum_head_dep CFLAGS: "`eval echo '$'"CFLAGS_$aci_sum_dep"`) + fi + done + fi + fi + ACI_ECHO("$aci_sum_header") + done + if test "x$aci_modules_disabled" != "x"; then + ACI_ECHO( " Some modules are disabled[,] either by you or by default") + ACI_ECHO( ) + fi + if test "x$aci_modules_broken" != "x"; then + ACI_ECHO( " If you think I'm a dumb script[,] and these broken dependencies can") + ACI_ECHO( " be satified[,] please try to use the --with-PACKAGE options. See:") + ACI_ECHO( " ./configure --help=short") + ACI_ECHO([]) + ACI_ECHO( "The other modules may be build even if these ones are not.") + ACI_ECHO([]) + fi + if test "x$aci_modules_disabled$aci_modules_broken" = "x"; then + ACI_ECHO( " Everything went well.") + fi + echo "END OF ACI_SUMMARY_FANCY">&5 +]) diff --git a/acmacro/gnome-warnings.m4 b/acmacro/gnome-warnings.m4 new file mode 100644 index 0000000000..8e6746fb50 --- /dev/null +++ b/acmacro/gnome-warnings.m4 @@ -0,0 +1,59 @@ + + +dnl GNOME_COMPILE_WARNINGS +dnl Turn on many useful compiler warnings +dnl For now, only works on GCC +AC_DEFUN([GNOME_COMPILE_WARNINGS],[ + AC_ARG_ENABLE(compile-warnings, + [ --enable-compile-warnings=[no/minimum/yes] Turn on compiler warnings.],,enable_compile_warnings=yes) + + AC_MSG_CHECKING(what warning flags to pass to the C compiler) + warnCFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + + if test "x$enable_compile_warnings" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *-Wall*) ;; + *) warnCFLAGS="-g -Wall -Wunused" ;; + esac + + ## -W is not all that useful. And it cannot be controlled + ## with individual -Wno-xxx flags, unlike -Wall + if test "x$enable_compile_warnings" = "xyes"; then + warnCFLAGS="$warnCFLAGS -Wmissing-prototypes -Wmissing-declarations\ + -finline-functions -Wshadow -Wpointer-arith \ + -Wwrite-strings -Wno-unused-function -Werror" + fi + fi + fi + AC_MSG_RESULT($warnCFLAGS) + + AC_ARG_ENABLE(iso-c, + [ --enable-iso-c Try to warn if code is not ISO C ],, + enable_iso_c=no) + + AC_MSG_CHECKING(what language compliance flags to pass to the C compiler) + complCFLAGS= + if test "x$enable_iso_c" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *-ansi*) ;; + *) complCFLAGS="$complCFLAGS -ansi" ;; + esac + + case " $CFLAGS " in + *-pedantic*) ;; + *) complCFLAGS="$complCFLAGS -pedantic" ;; + esac + fi + fi + AC_MSG_RESULT($complCFLAGS) + if test "x$cflags_set" != "xyes"; then + CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS" + cflags_set=yes + AC_SUBST(cflags_set) + fi +]) diff --git a/bootstrap b/bootstrap new file mode 100755 index 0000000000..3989daa7ab --- /dev/null +++ b/bootstrap @@ -0,0 +1,178 @@ +#!/bin/sh -e +# Run this to generate all the initial makefiles, etc. + +###### +###### Some defs +###### + +PKG_NAME="GRAS" +# a list of all dirs containing possibly some macros +acmacrodirs="${HOME}/share/aclocal ${PWD}/acmacro /usr/share/aclocal/gnome2-macros" + +###### +###### End of conf part +###### +for dir in $acmacrodirs ; do + if test -d $dir ; then + aclocalinclude="$aclocalinclude -I $dir"; + fi +done + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +echo "Autoregenerate package \`$PKG_NAME' in directory \`$srcdir'"; + +(test -f $srcdir/configure.ac \ + && test -f $srcdir/src/include/gras.h) || { + echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" + echo " top-level $PKG_NAME directory" + exit 1 +} + +###### +###### Some tests (borrowed from macros/autogen.sh from achtung) +###### +# Changlog : +# 27/5/00: Changed "to compile gnome" to "to compile $PKG_NAME" +# 27/5/00: removed gettext + +DIE=0 + +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`autoconf' installed to compile $PKG_NAME." + echo "Download the appropriate package for your distribution," + echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +} + +(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && { + (libtool --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`libtool' installed to compile $PKG_NAME." + echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.4.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + } +} + +(automake-1.7 --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: You must have \`automake' 1.7 installed to compile $PKG_NAME." + echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.7.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 + NO_AUTOMAKE=yes +} + +# if no automake, don't bother testing for aclocal +test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "**Error**: Missing \`aclocal'. The version of \`automake'" + echo "installed doesn't appear recent enough." + echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 +} + +if test "$DIE" -eq 1; then + exit 1 +fi + +###### END of test part + + +###### +###### Action part +###### + + +if test -z "$*"; then + if test -e aci.conf ; then + source aci.conf + echo "**Warning**: I am going to run \`configure' with arguments resulting from aci_configurator execution." + echo "ie, $configure_args." + echo "If you wish to pass other ones, please specify them on the" + echo \`$0\'" command line, or rerun aci_configurator and save the new ones." + echo + else + configure_args="--enable-maintainer-mode" + echo "**Warning**: I am going to run \`configure' with no arguments." + echo "If you wish to pass any to it, please specify them on the" + echo \`$0\'" command line." + echo + fi +else + configure_args="$@" +fi + +case $CC in +xlc ) + am_opt=--include-deps;; +esac + +for coin in `find $srcdir -name configure.ac -print `\ + `find $srcdir -name configure.in -print` +do + dr=`dirname $coin` + if test -f $dr/NO-AUTO-GEN; then + echo skipping $dr -- flagged as no auto-gen + else + echo "************" + echo "* Processing directory $dr" + echo "************" + + if [ -e $dr/configure.in ] ; then + configfile="configure.in" + else + configfile="configure.ac" + fi + macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin` + here=`pwd` + cd $dr + if grep "^AM_PROG_LIBTOOL" $configfile >/dev/null; then + if test -z "$NO_LIBTOOLIZE" ; then + echo "Running libtoolize --force --copy in "`pwd`"..." + libtoolize --force --copy || exit 1 + fi + fi + echo "Running aclocal-1.7 $aclocalinclude..." + aclocal-1.7 $aclocalinclude + if grep "^AM_CONFIG_HEADER" $configfile >/dev/null; then + echo "Running autoheader in "`pwd`"..." + autoheader || exit 1 + fi + if grep "^AM_INIT_AUTOMAKE" $configfile >/dev/null; then + echo "Running automake-1.7 --gnu --add-missing $am_opt ..." + automake-1.7 --gnu --add-missing $am_opt || exit 1 + fi + echo "Running autoconf..." + autoconf || exit 1 + cd $here + fi +done + +#conf_flags="--enable-compile-warnings" +# \ +#--enable-compile-warnings=minimum" +#--enable-iso-c + +#echo "rebuilding the api documentation... " +#cd docs && ./refresh-api " "&& echo "Done with the rebuilding of the api documentation." && cd .. || exit 1 + + +if test x$NOCONFIGURE = x; then + echo "************" + echo "* Running ./configure $configure_args..." + echo "************" + + ./configure $configure_args || exit 1 + +else + echo Skipping configure process. +fi + +echo Now type \`make\' to compile $PKG_NAME + + diff --git a/config.guess b/config.guess new file mode 100755 index 0000000000..11271623bb --- /dev/null +++ b/config.guess @@ -0,0 +1,1415 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +timestamp='2003-10-07' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha*:OpenVMS:*:*) + echo alpha-hp-vms + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7 && exit 0 ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c \ + && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && exit 0 + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + # avoid double evaluation of $set_cc_for_build + test -n "$CC_FOR_BUILD" || eval $set_cc_for_build + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + *:UNICOS/mp:*:*) + echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + # Determine whether the default compiler uses glibc. + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #if __GLIBC__ >= 2 + LIBC=gnu + #else + LIBC= + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + # GNU/KFreeBSD systems have a "k" prefix to indicate we are using + # FreeBSD's kernel, but not the complete OS. + case ${LIBC} in gnu) kernel_only='k' ;; esac + echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:[34]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' + exit 0 ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit 0 ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + case `uname -p` in + *86) UNAME_PROCESSOR=i686 ;; + powerpc) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[DGKLNPTVWY]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config.sub b/config.sub new file mode 100755 index 0000000000..79657cd182 --- /dev/null +++ b/config.sub @@ -0,0 +1,1510 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +timestamp='2003-10-07' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | msp430 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32r-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | msp430-* \ + | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nv1) + basic_machine=nv1-cray + os=-unicosmp + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/configure b/configure new file mode 100755 index 0000000000..deffbd9848 --- /dev/null +++ b/configure @@ -0,0 +1,23880 @@ +#! /bin/sh +# From configure.ac Revision: 1.3 . +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.58 for GRAS 0.1. +# +# Report bugs to . +# +# Copyright (C) 2003 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval 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="eval 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 + + + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` + ;; +esac + +echo=${ECHO-echo} +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" +fi + + + + +tagnames=${tagnames+${tagnames},}CXX + +tagnames=${tagnames+${tagnames},}F77 + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME='GRAS' +PACKAGE_TARNAME='gras' +PACKAGE_VERSION='0.1' +PACKAGE_STRING='GRAS 0.1' +PACKAGE_BUGREPORT='martin.quinson@ens-lyon.fr' + +ac_unique_file="src/include/gras.h" +ac_subdirs_all="$ac_subdirs_all src/nws_portability" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS subdirs build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL GTKDOC HAVE_GTK_DOC_TRUE HAVE_GTK_DOC_FALSE HAVE_GTK_DOC ENABLE_GTK_DOC_TRUE ENABLE_GTK_DOC_FALSE FLIBS LIBOBJS ACI_CACHE_PROG aci_module_desc_XML aci_pkg_config_XML HAVE_XML CFLAGS_XML LIBS_XML aci_module_desc_SimGrid aci_pkg_prefix_SimGrid aci_pkg_inc_SimGrid aci_pkg_lib_SimGrid aci_pkg_extra_SimGrid HAVE_SimGrid CFLAGS_SimGrid LIBS_SimGrid MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT cflags_set BASH WARNING LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP +ac_env_CXX_set=${CXX+set} +ac_env_CXX_value=$CXX +ac_cv_env_CXX_set=${CXX+set} +ac_cv_env_CXX_value=$CXX +ac_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_env_CXXFLAGS_value=$CXXFLAGS +ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_cv_env_CXXFLAGS_value=$CXXFLAGS +ac_env_CXXCPP_set=${CXXCPP+set} +ac_env_CXXCPP_value=$CXXCPP +ac_cv_env_CXXCPP_set=${CXXCPP+set} +ac_cv_env_CXXCPP_value=$CXXCPP +ac_env_F77_set=${F77+set} +ac_env_F77_value=$F77 +ac_cv_env_F77_set=${F77+set} +ac_cv_env_F77_value=$F77 +ac_env_FFLAGS_set=${FFLAGS+set} +ac_env_FFLAGS_value=$FFLAGS +ac_cv_env_FFLAGS_set=${FFLAGS+set} +ac_cv_env_FFLAGS_value=$FFLAGS + +# +# 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 GRAS 0.1 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of GRAS 0.1:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-shared[=PKGS] + build shared libraries [default=yes] + --enable-static[=PKGS] + build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors + --disable-libtool-lock avoid locking (might break parallel builds) + --enable-gtk-doc Use gtk-doc to build documentation default=auto + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --enable-compile-warnings=no/minimum/yes Turn on compiler warnings. + --enable-iso-c Try to warn if code is not ISO C + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-pic try to use only PIC/non-PIC objects [default=use + both] + --with-tags[=TAGS] + include additional configurations [automatic] + --with-SimGrid=DIR root directory of the SimGrid simulator installation + --with-SimGrid-includes=DIR + specify exact include dir for the SimGrid simulator headers + --with-SimGrid-libraries=DIR + specify exact library dir for the SimGrid simulator library + --with-SimGrid-extra=ARG + specify extra args to pass to the linker to get the + the SimGrid simulator library (with no space. A sed to change "!" + to " " is run) + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags + CXXCPP C++ preprocessor + F77 Fortran 77 compiler command + FFLAGS Fortran 77 compiler flags + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_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 + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + 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 +GRAS configure 0.1 +generated by GNU Autoconf 2.58 + +Copyright (C) 2003 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 GRAS $as_me 0.1, which was +generated by GNU Autoconf 2.58. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + 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_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. + + + +subdirs="$subdirs src/nws_portability" + + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking target system type" >&5 +echo $ECHO_N "checking target system type... $ECHO_C" >&6 +if test "${ac_cv_target+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_target_alias=$target_alias +test "x$ac_cv_target_alias" = "x" && + ac_cv_target_alias=$ac_cv_host_alias +ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_target" >&5 +echo "${ECHO_T}$ac_cv_target" >&6 +target=$ac_cv_target +target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- +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_config_headers="$ac_config_headers src/gras_config.h" + +am__api_version="1.7" +# 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" +# OS/2's system install, which has a completely different semantic +# ./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/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +test "$program_prefix" != NONE && + program_transform_name="s,^,$program_prefix,;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + + # test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='gras' + VERSION='0.1' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. + + + + +# Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=yes +fi; + +# Check whether --enable-static or --disable-static was given. +if test "${enable_static+set}" = set; then + enableval="$enable_static" + p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi; + +# Check whether --enable-fast-install or --disable-fast-install was given. +if test "${enable_fast_install+set}" = set; then + enableval="$enable_fast_install" + p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi; + +DEPDIR="${am__leading_dot}deps" + + ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6 +rm -f confinc confmf + +# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval="$enable_dependency_tracking" + +fi; +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err 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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* 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; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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 \ + '' \ + '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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +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>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err 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 + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + : > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # (even with -Werror). So we grep stderr for any message + # that says an option was ignored. + if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 +echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6 +if test "${lt_cv_path_SED+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && break + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +SED=$lt_cv_path_SED + +fi + +echo "$as_me:$LINENO: result: $SED" >&5 +echo "${ECHO_T}$SED" >&6 + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi; +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo "$as_me:$LINENO: checking for ld used by $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 +else + echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 +fi +if test "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 +if test "${lt_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +case `$LD -v 2>&1 &5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + +echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 +echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 +if test "${lt_cv_ld_reload_flag+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_ld_reload_flag='-r' +fi +echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 +echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' + +echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5 +echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 +if test "${lt_cv_path_NM+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/${ac_tool_prefix}nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + esac + fi + done + IFS="$lt_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi +fi +echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 +echo "${ECHO_T}$lt_cv_path_NM" >&6 +NM="$lt_cv_path_NM" + +echo "$as_me:$LINENO: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6 +fi + +echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5 +echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6 +if test "${lt_cv_deplibs_check_method+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # win32_libid shell function, so use a weaker test based on 'objdump'. + lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | kfreebsd*-gnu) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case "$host_cpu" in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx*) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 +echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + +fi; +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + 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 + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line 3665 "configure"' > conftest.$ac_ext + 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 + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + 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 + case "`/usr/bin/file conftest.o`" in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 +echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 +if test "${lt_cv_cc_needs_belf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + 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 + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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 + lt_cv_cc_needs_belf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +lt_cv_cc_needs_belf=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext 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 + +fi +echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 +echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +esac + +need_locks="$enable_libtool_lock" + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for 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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err 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 dlfcn.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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err 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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag 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 compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + 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: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&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;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------------- ## +## Report this to martin.quinson@ens-lyon.fr ## +## ----------------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC + 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_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # 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_CXX="$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 +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC +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_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +echo "${ECHO_T}$ac_ct_CXX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CXX" && break +done +test -n "$ac_ct_CXX" || ac_ct_CXX="g++" + + CXX=$ac_ct_CXX +fi + + +# 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 &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +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_cxx_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 +GXX=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cxx_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cxx_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +for ac_declaration in \ + '' \ + '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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +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>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err 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 + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +depcc="$CXX" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + : > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # (even with -Werror). So we grep stderr for any message + # that says an option was ignored. + if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_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 +if test -z "$CXXCPP"; then + if test "${ac_cv_prog_CXXCPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +echo "$as_me:$LINENO: result: $CXXCPP" >&5 +echo "${ECHO_T}$CXXCPP" >&6 +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran + 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_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$F77"; then + ac_cv_prog_F77="$F77" # 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_F77="$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 +F77=$ac_cv_prog_F77 +if test -n "$F77"; then + echo "$as_me:$LINENO: result: $F77" >&5 +echo "${ECHO_T}$F77" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$F77" && break + done +fi +if test -z "$F77"; then + ac_ct_F77=$F77 + for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran +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_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_F77"; then + ac_cv_prog_ac_ct_F77="$ac_ct_F77" # 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_F77="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_F77=$ac_cv_prog_ac_ct_F77 +if test -n "$ac_ct_F77"; then + echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 +echo "${ECHO_T}$ac_ct_F77" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_F77" && break +done + + F77=$ac_ct_F77 +fi + + +# Provide some information about the compiler. +echo "$as_me:5222:" \ + "checking for Fortran 77 compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +rm -f a.out + +# If we don't use `.F' as extension, the preprocessor is not run on the +# input file. (Note that this only needs to work for GNU compilers.) +ac_save_ext=$ac_ext +ac_ext=F +echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 +if test "${ac_cv_f77_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF + program main +#ifndef __GNUC__ + choke me +#endif + + end +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_f77_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 +ac_ext=$ac_save_ext +ac_test_FFLAGS=${FFLAGS+set} +ac_save_FFLAGS=$FFLAGS +FFLAGS= +echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 +echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_f77_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + FFLAGS=-g +cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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_f77_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_f77_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 +echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 +if test "$ac_test_FFLAGS" = set; then + FFLAGS=$ac_save_FFLAGS +elif test $ac_cv_prog_f77_g = yes; then + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-g -O2" + else + FFLAGS="-g" + fi +else + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-O2" + else + FFLAGS= + fi +fi + +G77=`test $ac_compiler_gnu = yes && echo yes` +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 + + + +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! + +# find the maximum length of command line arguments +echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 +echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6 +if test "${lt_cv_sys_max_cmd_len+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + i=0 + testring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while (test "X"`$CONFIG_SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \ + = "XX$testring") >/dev/null 2>&1 && + new_result=`expr "X$testring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + testring=$testring$testring + done + testring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 +echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6 +else + echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6 +fi + + + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 +echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6 +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris* | sysv5*) + symcode='[BDRT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{ +EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + 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); } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + echo "$as_me:$LINENO: result: failed" >&5 +echo "${ECHO_T}failed" >&6 +else + echo "$as_me:$LINENO: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +fi + +echo "$as_me:$LINENO: checking for objdir" >&5 +echo $ECHO_N "checking for objdir... $ECHO_C" >&6 +if test "${lt_cv_objdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 +echo "${ECHO_T}$lt_cv_objdir" >&6 +objdir=$lt_cv_objdir + + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; 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_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # 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_AR="${ac_tool_prefix}ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; 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_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # 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_AR="ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false" +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 +echo "${ECHO_T}$ac_ct_AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + AR=$ac_ct_AR +else + AR="$ac_cv_prog_AR" +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; 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_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # 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_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; 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_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # 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_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 +echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + echo "$as_me:$LINENO: checking for file" >&5 +echo $ECHO_N "checking for file... $ECHO_C" >&6 +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 +echo "${ECHO_T}$MAGIC_CMD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +enable_dlopen=no +enable_win32_dll=no + +# Check whether --enable-libtool-lock or --disable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then + enableval="$enable_libtool_lock" + +fi; +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + + +# Check whether --with-pic or --without-pic was given. +if test "${with_pic+set}" = set; then + withval="$with_pic" + pic_mode="$withval" +else + pic_mode=default +fi; +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +lt_save_CC="$CC" +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 + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# +# Check for any special shared library compilation flags. +# +lt_prog_cc_shlib= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + lt_prog_cc_shlib='-belf' + ;; + esac +fi +if test -n "$lt_prog_cc_shlib"; then + { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5 +echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;} + if echo "$old_CC $old_CFLAGS " | grep "[ ]$lt_prog_cc_shlib[ ]" >/dev/null; then : + else + { echo "$as_me:$LINENO: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 +echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} + lt_cv_prog_cc_can_build_shared=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +echo "$as_me:$LINENO: checking if $compiler static flag $lt_prog_compiler_static works" >&5 +echo $ECHO_N "checking if $compiler static flag $lt_prog_compiler_static works... $ECHO_C" >&6 +if test "${lt_prog_compiler_static_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_prog_compiler_static" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + else + lt_prog_compiler_static_works=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_static_works" >&6 + +if test x"$lt_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag=' -fno-builtin' + + +echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6254: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:6258: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + linux*) + case $CC in + icc* | ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + sco3.2v5*) + lt_prog_compiler_pic='-Kpic' + lt_prog_compiler_static='-dn' + ;; + + solaris*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6487: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:6491: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6 + +if test x"$lt_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + # According to Tom Tromey, Ian Lance Taylor reported there are C compilers + # that will create temporary files in the current directory regardless of + # the output directory. Thus, making CWD read-only will cause this test + # to fail, enabling locking or at least warning the user not to do parallel + # builds. + chmod -w . + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:6554: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:6558: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag= + enable_shared_with_static_runtimes=no + archive_cmds= + archive_expsym_cmds= + old_archive_From_new_cmds= + old_archive_from_expsyms_cmds= + export_dynamic_flag_spec= + whole_archive_flag_spec= + thread_safe_flag_spec= + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld= + hardcode_libdir_separator= + hardcode_direct=no + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + link_all_deplibs=unknown + hardcode_automatic=no + module_cmds= + module_expsym_cmds= + always_export_symbols=no + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + linux*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_cmds="$tmp_archive_cmds" + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds="$tmp_archive_cmds" + fi + else + ld_shlibs=no + fi + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + + if test "$GCC" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec=' ' + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + bsdi4*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes=yes + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes ; then + archive_cmds_need_lc=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + 10.*) + allow_undefined_flag='-undefined dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='-all_load $convenience' + link_all_deplibs=yes + else + ld_shlibs=no + fi + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_libdir_separator=: + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + ia64*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=no + hardcode_shlibpath_var=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + *) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld='-rpath $libdir' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + openbsd*) + hardcode_direct=yes + hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag=' -z text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $ld_shlibs" >&5 +echo "${ECHO_T}$ld_shlibs" >&6 +test "$ld_shlibs" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc=no + else + archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 +echo "${ECHO_T}$archive_cmds_need_lc" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` + sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=yes + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var " || \ + test "X$hardcode_automatic"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action" >&5 +echo "${ECHO_T}$hardcode_action" >&6 + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* 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 shl_load (); +/* 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_shl_load) || defined (__stub___shl_load) +choke me +#else +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shl_load; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_dlopen) || defined (__stub___dlopen) +choke me +#else +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_svld_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dld_link (); +int +main () +{ +dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_dld_link=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# Report which librarie types wil actually be built +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + darwin* | rhapsody*) + if test "$GCC" = yes; then + archive_cmds_need_lc=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag='-flat_namespace -undefined suppress' + ;; + 10.*) + allow_undefined_flag='-undefined dynamic_lookup' + ;; + esac + fi + ;; + esac + output_verbose_link_cmd='echo' + archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' + module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + whole_archive_flag_spec='-all_load $convenience' + link_all_deplibs=yes + else + ld_shlibs=no + fi + ;; +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler \ + CC \ + LD \ + lt_prog_compiler_wl \ + lt_prog_compiler_pic \ + lt_prog_compiler_static \ + lt_prog_compiler_no_builtin_flag \ + export_dynamic_flag_spec \ + thread_safe_flag_spec \ + whole_archive_flag_spec \ + enable_shared_with_static_runtimes \ + old_archive_cmds \ + old_archive_from_new_cmds \ + predep_objects \ + postdep_objects \ + predeps \ + postdeps \ + compiler_lib_search_path \ + archive_cmds \ + archive_expsym_cmds \ + postinstall_cmds \ + postuninstall_cmds \ + old_archive_from_expsyms_cmds \ + allow_undefined_flag \ + no_undefined_flag \ + export_symbols_cmds \ + hardcode_libdir_flag_spec \ + hardcode_libdir_flag_spec_ld \ + hardcode_libdir_separator \ + hardcode_automatic \ + module_cmds \ + module_expsym_cmds \ + lt_cv_prog_compiler_c_o \ + exclude_expsyms \ + include_expsyms; do + + case $var in + old_archive_cmds | \ + old_archive_from_new_cmds | \ + archive_cmds | \ + archive_expsym_cmds | \ + module_cmds | \ + module_expsym_cmds | \ + old_archive_from_expsyms_cmds | \ + export_symbols_cmds | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="${ofile}T" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + $rm -f "$cfgfile" + { echo "$as_me:$LINENO: creating $ofile" >&5 +echo "$as_me: creating $ofile" >&6;} + + cat <<__EOF__ >> "$cfgfile" +#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="$SED -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU C compiler? +with_gcc=$GCC + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# ### END LIBTOOL CONFIG + +__EOF__ + + + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 + +CC="$lt_save_CC" + + +# Check whether --with-tags or --without-tags was given. +if test "${with_tags+set}" = set; then + withval="$with_tags" + tagnames="$withval" +fi; + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;} + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5 +echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;} + else + { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5 +echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;} + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in + "") ;; + *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5 +echo "$as_me: error: invalid tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5 +echo "$as_me: error: tag name \"$tagname\" already exists" >&2;} + { (exit 1); exit 1; }; } + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + if test -n "$CXX" && test "X$CXX" != "Xno"; then + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + + +archive_cmds_need_lc_CXX=no +allow_undefined_flag_CXX= +always_export_symbols_CXX=no +archive_expsym_cmds_CXX= +export_dynamic_flag_spec_CXX= +hardcode_direct_CXX=no +hardcode_libdir_flag_spec_CXX= +hardcode_libdir_flag_spec_ld_CXX= +hardcode_libdir_separator_CXX= +hardcode_minus_L_CXX=no +hardcode_automatic_CXX=no +module_cmds_CXX= +module_expsym_cmds_CXX= +link_all_deplibs_CXX=unknown +old_archive_cmds_CXX=$old_archive_cmds +no_undefined_flag_CXX= +whole_archive_flag_spec_CXX= +enable_shared_with_static_runtimes_CXX=no + +# Dependencies to place before and after the object being linked: +predep_objects_CXX= +postdep_objects_CXX= +predeps_CXX= +postdeps_CXX= +compiler_lib_search_path_CXX= + +# Source file extension for C++ test sources. +ac_ext=cc + +# Object file extension for compiled C++ test sources. +objext=o +objext_CXX=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_LD=$LD +lt_save_GCC=$GCC +GCC=$GXX +lt_save_with_gnu_ld=$with_gnu_ld +lt_save_path_LD=$lt_cv_path_LD +if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx +else + unset lt_cv_prog_gnu_ld +fi +if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX +else + unset lt_cv_path_LD +fi +test -z "${LDCXX+set}" || LD=$LDCXX +CC=${CXX-"c++"} +compiler=$CC +compiler_CXX=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' +else + lt_prog_compiler_no_builtin_flag_CXX= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + +# Check whether --with-gnu-ld or --without-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi; +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo "$as_me:$LINENO: checking for ld used by $CC" >&5 +echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6 + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 +else + echo "$as_me:$LINENO: checking for non-GNU ld" >&5 +echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 +fi +if test "${lt_cv_path_LD+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +echo "${ECHO_T}$LD" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 +echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 +if test "${lt_cv_prog_gnu_ld+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. +case `$LD -v 2>&1 &5 +echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_CXX= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 +ld_shlibs_CXX=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_CXX='' + hardcode_direct_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + + if test "$GXX" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_CXX=yes + else + # We have old collect2 + hardcode_direct_CXX=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_CXX=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_CXX='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_CXX="-z nodefs" + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_CXX=' ${wl}-bernotok' + allow_undefined_flag_CXX=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_CXX=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_CXX=' ' + archive_cmds_need_lc_CXX=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_CXX='-L$libdir' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=no + enable_shared_with_static_runtimes_CXX=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs_CXX=no + fi + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes; then + archive_cmds_need_lc_CXX=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_CXX='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_CXX='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_CXX='-flat_namespace -undefined suppress' + ;; + 10.*) + allow_undefined_flag_CXX='-undefined dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_CXX='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_CXX='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + whole_archive_flag_spec_CXX='-all_load $convenience' + link_all_deplibs_CXX=yes + else + ld_shlibs_CXX=no + fi + ;; + + dgux*) + case $cc_basename in + ec++) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + ghcx) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + freebsd12*) + # C++ shared libraries reported to be fairly broken before switch to ELF + ld_shlibs_CXX=no + ;; + freebsd-elf*) + archive_cmds_need_lc_CXX=no + ;; + freebsd* | kfreebsd*-gnu) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + ld_shlibs_CXX=yes + ;; + gnu*) + ;; + hpux9*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC) + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_CXX='+b $libdir' + hardcode_libdir_separator_CXX=: + ;; + ia64*) + hardcode_libdir_flag_spec_CXX='-L$libdir' + ;; + *) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + ;; + esac + fi + case "$host_cpu" in + hppa*64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + ;; + ia64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + *) + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC) + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case "$host_cpu" in + ia64*|hppa*64*) + archive_cmds_CXX='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + ;; + *) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC) + # SGI C++ + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' + fi + fi + link_all_deplibs_CXX=yes + ;; + esac + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + ;; + linux*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc) + # Intel C++ + with_gnu_ld=yes + archive_cmds_need_lc_CXX=no + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + cxx) + # Compaq C++ + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + mvs*) + case $cc_basename in + cxx) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + osf3*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx) + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx) + allow_undefined_flag_CXX=' -expect_unresolved \*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + sco*) + archive_cmds_need_lc_CXX=no + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + lcc) + # Lucid + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_shlibpath_var_CXX=no + case $host_os in + solaris2.0-5 | solaris2.0-5.*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. + # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + link_all_deplibs_CXX=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[LR]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + gcx) + # Green Hills C++ Compiler + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + no_undefined_flag_CXX=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + archive_cmds_need_lc_CXX=no + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; +esac +echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6 +test "$ld_shlibs_CXX" = no && can_build_shared=no + +GCC_CXX="$GXX" +LD_CXX="$LD" + + +cat > conftest.$ac_ext <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + # The `*' in the case matches for architectures that use `case' in + # $output_verbose_cmd can trigger glob expansion during the loop + # eval without this substitution. + output_verbose_link_cmd="`$echo \"X$output_verbose_link_cmd\" | $Xsed -e \"$no_glob_subst\"`" + + for p in `eval $output_verbose_link_cmd`; do + case $p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" \ + || test $p = "-R"; then + prev=$p + continue + else + prev= + fi + + if test "$pre_test_object_deps_done" = no; then + case $p in + -L* | -R*) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$compiler_lib_search_path_CXX"; then + compiler_lib_search_path_CXX="${prev}${p}" + else + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$postdeps_CXX"; then + postdeps_CXX="${prev}${p}" + else + postdeps_CXX="${postdeps_CXX} ${prev}${p}" + fi + fi + ;; + + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$predep_objects_CXX"; then + predep_objects_CXX="$p" + else + predep_objects_CXX="$predep_objects_CXX $p" + fi + else + if test -z "$postdep_objects_CXX"; then + postdep_objects_CXX="$p" + else + postdep_objects_CXX="$postdep_objects_CXX $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling CXX test program" +fi + +$rm -f confest.$objext + +case " $postdeps_CXX " in +*" -lc "*) archive_cmds_need_lc_CXX=no ;; +esac + +lt_prog_compiler_wl_CXX= +lt_prog_compiler_pic_CXX= +lt_prog_compiler_static_CXX= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_CXX=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++) + lt_prog_compiler_pic_CXX='-KPIC' + ;; + ghcx) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | kfreebsd*-gnu) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + lt_prog_compiler_pic_CXX='+Z' + fi + ;; + aCC) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_CXX='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC) + # KAI C++ Compiler + lt_prog_compiler_wl_CXX='--backend -Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + ;; + icpc) + # Intel C++ + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-static' + ;; + cxx) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + gcx) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + lt_prog_compiler_pic_CXX='-pic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + lcc) + # Lucid + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + lt_prog_compiler_pic_CXX='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + lt_prog_compiler_can_build_shared_CXX=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_CXX"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:11004: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:11008: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works_CXX=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6 + +if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_CXX=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + # According to Tom Tromey, Ian Lance Taylor reported there are C compilers + # that will create temporary files in the current directory regardless of + # the output directory. Thus, making CWD read-only will cause this test + # to fail, enabling locking or at least warning the user not to do parallel + # builds. + chmod -w . + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:11071: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:11075: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX="$ltdll_cmds" + ;; + cygwin* | mingw*) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + +echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5 +echo "${ECHO_T}$ld_shlibs_CXX" >&6 +test "$ld_shlibs_CXX" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_CXX in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_CXX + allow_undefined_flag_CXX= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_CXX=no + else + archive_cmds_need_lc_CXX=yes + fi + allow_undefined_flag_CXX=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` + sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=yes + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_CXX= +if test -n "$hardcode_libdir_flag_spec_CXX" || \ + test -n "$runpath_var CXX" || \ + test "X$hardcode_automatic_CXX"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_CXX" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no && + test "$hardcode_minus_L_CXX" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_CXX=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_CXX=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_CXX=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5 +echo "${ECHO_T}$hardcode_action_CXX" >&6 + +if test "$hardcode_action_CXX" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* 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 shl_load (); +/* 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_shl_load) || defined (__stub___shl_load) +choke me +#else +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shl_load; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_dlopen) || defined (__stub___dlopen) +choke me +#else +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_svld_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dld_link (); +int +main () +{ +dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_dld_link=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_CXX \ + CC_CXX \ + LD_CXX \ + lt_prog_compiler_wl_CXX \ + lt_prog_compiler_pic_CXX \ + lt_prog_compiler_static_CXX \ + lt_prog_compiler_no_builtin_flag_CXX \ + export_dynamic_flag_spec_CXX \ + thread_safe_flag_spec_CXX \ + whole_archive_flag_spec_CXX \ + enable_shared_with_static_runtimes_CXX \ + old_archive_cmds_CXX \ + old_archive_from_new_cmds_CXX \ + predep_objects_CXX \ + postdep_objects_CXX \ + predeps_CXX \ + postdeps_CXX \ + compiler_lib_search_path_CXX \ + archive_cmds_CXX \ + archive_expsym_cmds_CXX \ + postinstall_cmds_CXX \ + postuninstall_cmds_CXX \ + old_archive_from_expsyms_cmds_CXX \ + allow_undefined_flag_CXX \ + no_undefined_flag_CXX \ + export_symbols_cmds_CXX \ + hardcode_libdir_flag_spec_CXX \ + hardcode_libdir_flag_spec_ld_CXX \ + hardcode_libdir_separator_CXX \ + hardcode_automatic_CXX \ + module_cmds_CXX \ + module_expsym_cmds_CXX \ + lt_cv_prog_compiler_c_o_CXX \ + exclude_expsyms_CXX \ + include_expsyms_CXX; do + + case $var in + old_archive_cmds_CXX | \ + old_archive_from_new_cmds_CXX | \ + archive_cmds_CXX | \ + archive_expsym_cmds_CXX | \ + module_cmds_CXX | \ + module_expsym_cmds_CXX | \ + old_archive_from_expsyms_cmds_CXX | \ + export_symbols_cmds_CXX | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_CXX + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_CXX +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_CXX + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_CXX + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_CXX" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 + +CC=$lt_save_CC +LDCXX=$LD +LD=$lt_save_LD +GCC=$lt_save_GCC +with_gnu_ldcxx=$with_gnu_ld +with_gnu_ld=$lt_save_with_gnu_ld +lt_cv_path_LDCXX=$lt_cv_path_LD +lt_cv_path_LD=$lt_save_path_LD +lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld +lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld + + else + tagname="" + fi + ;; + + F77) + if test -n "$F77" && test "X$F77" != "Xno"; then + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu + + +archive_cmds_need_lc_F77=no +allow_undefined_flag_F77= +always_export_symbols_F77=no +archive_expsym_cmds_F77= +export_dynamic_flag_spec_F77= +hardcode_direct_F77=no +hardcode_libdir_flag_spec_F77= +hardcode_libdir_flag_spec_ld_F77= +hardcode_libdir_separator_F77= +hardcode_minus_L_F77=no +hardcode_automatic_F77=no +module_cmds_F77= +module_expsym_cmds_F77= +link_all_deplibs_F77=unknown +old_archive_cmds_F77=$old_archive_cmds +no_undefined_flag_F77= +whole_archive_flag_spec_F77= +enable_shared_with_static_runtimes_F77=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +objext_F77=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code=" subroutine t\n return\n end\n" + +# Code to be used in simple link tests +lt_simple_link_test_code=" program t\n end\n" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${F77-"f77"} +compiler=$CC +compiler_F77=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 +echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $can_build_shared" >&5 +echo "${ECHO_T}$can_build_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 +echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; +aix4*) + test "$enable_shared" = yes && enable_static=no + ;; +esac +echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6 + +echo "$as_me:$LINENO: checking whether to build static libraries" >&5 +echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +echo "$as_me:$LINENO: result: $enable_static" >&5 +echo "${ECHO_T}$enable_static" >&6 + +test "$ld_shlibs_F77" = no && can_build_shared=no + +GCC_F77="$G77" +LD_F77="$LD" + +lt_prog_compiler_wl_F77= +lt_prog_compiler_pic_F77= +lt_prog_compiler_static_F77= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + if test "$GCC" = yes; then + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_static_F77='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_F77='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_F77=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_F77=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_F77='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_F77='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_F77='-Bstatic' + else + lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_F77='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_F77='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_F77='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_F77='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_F77='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + linux*) + case $CC in + icc* | ecc*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-static' + ;; + ccc*) + lt_prog_compiler_wl_F77='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_F77='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_F77='-non_shared' + ;; + + sco3.2v5*) + lt_prog_compiler_pic_F77='-Kpic' + lt_prog_compiler_static_F77='-dn' + ;; + + solaris*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sunos4*) + lt_prog_compiler_wl_F77='-Qoption ld ' + lt_prog_compiler_pic_F77='-PIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_prog_compiler_wl_F77='-Wl,' + lt_prog_compiler_pic_F77='-KPIC' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_F77='-Kconform_pic' + lt_prog_compiler_static_F77='-Bstatic' + fi + ;; + + uts4*) + lt_prog_compiler_pic_F77='-pic' + lt_prog_compiler_static_F77='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_F77=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_F77"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_F77=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_F77" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:13350: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:13354: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works_F77=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6 + +if test x"$lt_prog_compiler_pic_works_F77" = xyes; then + case $lt_prog_compiler_pic_F77 in + "" | " "*) ;; + *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;; + esac +else + lt_prog_compiler_pic_F77= + lt_prog_compiler_can_build_shared_F77=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_F77= + ;; + *) + lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_F77=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + # According to Tom Tromey, Ian Lance Taylor reported there are C compilers + # that will create temporary files in the current directory regardless of + # the output directory. Thus, making CWD read-only will cause this test + # to fail, enabling locking or at least warning the user not to do parallel + # builds. + chmod -w . + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:13417: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:13421: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o_F77=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag_F77= + enable_shared_with_static_runtimes_F77=no + archive_cmds_F77= + archive_expsym_cmds_F77= + old_archive_From_new_cmds_F77= + old_archive_from_expsyms_cmds_F77= + export_dynamic_flag_spec_F77= + whole_archive_flag_spec_F77= + thread_safe_flag_spec_F77= + hardcode_libdir_flag_spec_F77= + hardcode_libdir_flag_spec_ld_F77= + hardcode_libdir_separator_F77= + hardcode_direct_F77=no + hardcode_minus_L_F77=no + hardcode_shlibpath_var_F77=unsupported + link_all_deplibs_F77=unknown + hardcode_automatic_F77=no + module_cmds_F77= + module_expsym_cmds_F77= + always_export_symbols_F77=no + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_F77= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_F77="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_F77=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_F77=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_F77=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_F77='-L$libdir' + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=no + enable_shared_with_static_runtimes_F77=yes + export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_F77=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + + sunos4*) + archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + linux*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_cmds_F77="$tmp_archive_cmds" + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_F77="$tmp_archive_cmds" + fi + else + ld_shlibs_F77=no + fi + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_F77=no + fi + ;; + esac + + if test "$ld_shlibs_F77" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_F77='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_F77= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_F77=unsupported + always_export_symbols_F77=yes + archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_F77=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_F77=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_F77='' + hardcode_direct_F77=yes + hardcode_libdir_separator_F77=':' + link_all_deplibs_F77=yes + + if test "$GCC" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_F77=yes + else + # We have old collect2 + hardcode_direct_F77=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_F77=yes + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_libdir_separator_F77= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_F77=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_F77='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_F77="-z nodefs" + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_F77=' ${wl}-bernotok' + allow_undefined_flag_F77=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_F77=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_F77=' ' + archive_cmds_need_lc_F77=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_F77=no + ;; + + bsdi4*) + export_dynamic_flag_spec_F77=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_F77=' ' + allow_undefined_flag_F77=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_F77='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_F77='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_F77=yes + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes ; then + archive_cmds_need_lc_F77=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_F77='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_F77='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_F77='-flat_namespace -undefined suppress' + ;; + 10.*) + allow_undefined_flag_F77='-undefined dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_F77='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_F77='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_F77='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct_F77=no + hardcode_automatic_F77=yes + hardcode_shlibpath_var_F77=unsupported + whole_archive_flag_spec_F77='-all_load $convenience' + link_all_deplibs_F77=yes + else + ld_shlibs_F77=no + fi + ;; + + dgux*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + freebsd1*) + ld_shlibs_F77=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu) + archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_F77='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_F77='+b $libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + ;; + ia64*) + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_direct_F77=no + hardcode_shlibpath_var_F77=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + ;; + *) + hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_direct_F77=yes + export_dynamic_flag_spec_F77='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_F77=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_F77='-rpath $libdir' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + link_all_deplibs_F77=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + newsos6) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + hardcode_shlibpath_var_F77=no + ;; + + openbsd*) + hardcode_direct_F77=yes + hardcode_shlibpath_var_F77=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + export_dynamic_flag_spec_F77='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-R$libdir' + ;; + *) + archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_minus_L_F77=yes + allow_undefined_flag_F77=unsupported + archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_F77=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_F77=' -expect_unresolved \*' + archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_F77='-rpath $libdir' + fi + hardcode_libdir_separator_F77=: + ;; + + sco3.2v5*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + export_dynamic_flag_spec_F77='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag_F77=' -z text' + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_F77='-R$libdir' + hardcode_shlibpath_var_F77=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs_F77=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_direct_F77=yes + hardcode_minus_L_F77=yes + hardcode_shlibpath_var_F77=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_F77='$CC -r -o $output$reload_objs' + hardcode_direct_F77=no + ;; + motorola) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_F77=no + ;; + + sysv4.3*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + export_dynamic_flag_spec_F77='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_F77=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_F77=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_F77=yes + hardcode_minus_L_F77=no + hardcode_shlibpath_var_F77=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag_F77='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_F77='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_F77=no + ;; + + sysv5*) + no_undefined_flag_F77=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec_F77= + hardcode_shlibpath_var_F77=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_F77='-L$libdir' + hardcode_shlibpath_var_F77=no + ;; + + *) + ld_shlibs_F77=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5 +echo "${ECHO_T}$ld_shlibs_F77" >&6 +test "$ld_shlibs_F77" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_F77" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_F77=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_F77 in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_F77 + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_F77 + allow_undefined_flag_F77= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_F77=no + else + archive_cmds_need_lc_F77=yes + fi + allow_undefined_flag_F77=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` + sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=yes + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_F77= +if test -n "$hardcode_libdir_flag_spec_F77" || \ + test -n "$runpath_var F77" || \ + test "X$hardcode_automatic_F77"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_F77" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no && + test "$hardcode_minus_L_F77" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_F77=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_F77=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_F77=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5 +echo "${ECHO_T}$hardcode_action_F77" >&6 + +if test "$hardcode_action_F77" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_F77 \ + CC_F77 \ + LD_F77 \ + lt_prog_compiler_wl_F77 \ + lt_prog_compiler_pic_F77 \ + lt_prog_compiler_static_F77 \ + lt_prog_compiler_no_builtin_flag_F77 \ + export_dynamic_flag_spec_F77 \ + thread_safe_flag_spec_F77 \ + whole_archive_flag_spec_F77 \ + enable_shared_with_static_runtimes_F77 \ + old_archive_cmds_F77 \ + old_archive_from_new_cmds_F77 \ + predep_objects_F77 \ + postdep_objects_F77 \ + predeps_F77 \ + postdeps_F77 \ + compiler_lib_search_path_F77 \ + archive_cmds_F77 \ + archive_expsym_cmds_F77 \ + postinstall_cmds_F77 \ + postuninstall_cmds_F77 \ + old_archive_from_expsyms_cmds_F77 \ + allow_undefined_flag_F77 \ + no_undefined_flag_F77 \ + export_symbols_cmds_F77 \ + hardcode_libdir_flag_spec_F77 \ + hardcode_libdir_flag_spec_ld_F77 \ + hardcode_libdir_separator_F77 \ + hardcode_automatic_F77 \ + module_cmds_F77 \ + module_expsym_cmds_F77 \ + lt_cv_prog_compiler_c_o_F77 \ + exclude_expsyms_F77 \ + include_expsyms_F77; do + + case $var in + old_archive_cmds_F77 | \ + old_archive_from_new_cmds_F77 | \ + archive_cmds_F77 | \ + archive_expsym_cmds_F77 | \ + module_cmds_F77 | \ + module_expsym_cmds_F77 | \ + old_archive_from_expsyms_cmds_F77 | \ + export_symbols_cmds_F77 | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_F77 + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77 + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_F77 + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_F77 + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_F77 + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_F77 + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_F77 +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77 + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_F77 + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77 + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77 + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77 + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77 + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_F77 +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77 + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77 + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_F77 +archive_expsym_cmds=$lt_archive_expsym_cmds_F77 +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_F77 +module_expsym_cmds=$lt_module_expsym_cmds_F77 + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_F77 + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_F77 + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_F77 + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_F77 + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_F77 + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_F77 + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_F77 + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77 + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77 + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77 + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_F77 + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_F77 + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_F77 + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_F77 + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_F77 + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_F77" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_F77 + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_F77 + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_F77 + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_F77 + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + GCJ) + if test -n "$GCJ" && test "X$GCJ" != "Xno"; then + + + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +objext_GCJ=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String argv) {}; }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${GCJ-"gcj"} +compiler=$CC +compiler_GCJ=$CC + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +archive_cmds_need_lc_GCJ=no + + +lt_prog_compiler_no_builtin_flag_GCJ= + +if test "$GCC" = yes; then + lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin' + + +echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:15449: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:15453: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6 + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions" +else + : +fi + +fi + +lt_prog_compiler_wl_GCJ= +lt_prog_compiler_pic_GCJ= +lt_prog_compiler_static_GCJ= + +echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 +echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 + + if test "$GCC" = yes; then + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_static_GCJ='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_GCJ='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared_GCJ=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_GCJ=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + ;; + + *) + lt_prog_compiler_pic_GCJ='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl_GCJ='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_GCJ='-Bstatic' + else + lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_GCJ='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_GCJ='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl_GCJ='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + newsos6) + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + linux*) + case $CC in + icc* | ecc*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-static' + ;; + ccc*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + esac + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl_GCJ='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static_GCJ='-non_shared' + ;; + + sco3.2v5*) + lt_prog_compiler_pic_GCJ='-Kpic' + lt_prog_compiler_static_GCJ='-dn' + ;; + + solaris*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sunos4*) + lt_prog_compiler_wl_GCJ='-Qoption ld ' + lt_prog_compiler_pic_GCJ='-PIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + lt_prog_compiler_wl_GCJ='-Wl,' + lt_prog_compiler_pic_GCJ='-KPIC' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic_GCJ='-Kconform_pic' + lt_prog_compiler_static_GCJ='-Bstatic' + fi + ;; + + uts4*) + lt_prog_compiler_pic_GCJ='-pic' + lt_prog_compiler_static_GCJ='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared_GCJ=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6 + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_GCJ"; then + +echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5 +echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6 +if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_prog_compiler_pic_works_GCJ=no + ac_outfile=conftest.$ac_objext + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_GCJ" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:15682: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:15686: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + lt_prog_compiler_pic_works_GCJ=yes + fi + fi + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5 +echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6 + +if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then + case $lt_prog_compiler_pic_GCJ in + "" | " "*) ;; + *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;; + esac +else + lt_prog_compiler_pic_GCJ= + lt_prog_compiler_can_build_shared_GCJ=no +fi + +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_GCJ= + ;; + *) + lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ" + ;; +esac + +echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 +echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 +if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + lt_cv_prog_compiler_c_o_GCJ=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + # According to Tom Tromey, Ian Lance Taylor reported there are C compilers + # that will create temporary files in the current directory regardless of + # the output directory. Thus, making CWD read-only will cause this test + # to fail, enabling locking or at least warning the user not to do parallel + # builds. + chmod -w . + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:15749: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:15753: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + lt_cv_prog_compiler_c_o_GCJ=yes + fi + fi + chmod u+w . + $rm conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files + $rm out/* && rmdir out + cd .. + rmdir conftest + $rm conftest* + +fi +echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5 +echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6 + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 +echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$as_me:$LINENO: result: $hard_links" >&5 +echo "${ECHO_T}$hard_links" >&6 + if test "$hard_links" = no; then + { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + +echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6 + + runpath_var= + allow_undefined_flag_GCJ= + enable_shared_with_static_runtimes_GCJ=no + archive_cmds_GCJ= + archive_expsym_cmds_GCJ= + old_archive_From_new_cmds_GCJ= + old_archive_from_expsyms_cmds_GCJ= + export_dynamic_flag_spec_GCJ= + whole_archive_flag_spec_GCJ= + thread_safe_flag_spec_GCJ= + hardcode_libdir_flag_spec_GCJ= + hardcode_libdir_flag_spec_ld_GCJ= + hardcode_libdir_separator_GCJ= + hardcode_direct_GCJ=no + hardcode_minus_L_GCJ=no + hardcode_shlibpath_var_GCJ=unsupported + link_all_deplibs_GCJ=unknown + hardcode_automatic_GCJ=no + module_cmds_GCJ= + module_expsym_cmds_GCJ= + always_export_symbols_GCJ=no + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms_GCJ= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms_GCJ="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs_GCJ=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + ld_shlibs_GCJ=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_GCJ=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_GCJ='-L$libdir' + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=no + enable_shared_with_static_runtimes_GCJ=yes + export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGS] /s/.* \([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW] /s/.* //'\'' | sort | uniq > $export_symbols' + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs_GCJ=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + + sunos4*) + archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + linux*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + tmp_archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_cmds_GCJ="$tmp_archive_cmds" + supports_anon_versioning=no + case `$LD -v 2>/dev/null` in + *\ 01.* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + if test $supports_anon_versioning = yes; then + archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~ +cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ +$echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + else + archive_expsym_cmds_GCJ="$tmp_archive_cmds" + fi + else + ld_shlibs_GCJ=no + fi + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs_GCJ=no + fi + ;; + esac + + if test "$ld_shlibs_GCJ" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_GCJ='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_GCJ= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag_GCJ=unsupported + always_export_symbols_GCJ=yes + archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L_GCJ=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct_GCJ=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_GCJ='' + hardcode_direct_GCJ=yes + hardcode_libdir_separator_GCJ=':' + link_all_deplibs_GCJ=yes + + if test "$GCC" = yes; then + case $host_os in aix4.012|aix4.012.*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct_GCJ=yes + else + # We have old collect2 + hardcode_direct_GCJ=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_GCJ=yes + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_libdir_separator_GCJ= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols_GCJ=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_GCJ='-berok' + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_GCJ="-z nodefs" + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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 + +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi + + hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_GCJ=' ${wl}-bernotok' + allow_undefined_flag_GCJ=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + always_export_symbols_GCJ=yes + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_GCJ=' ' + archive_cmds_need_lc_GCJ=yes + # This is similar to how AIX traditionally builds it's shared libraries. + archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + # see comment about different semantics on the GNU ld section + ld_shlibs_GCJ=no + ;; + + bsdi4*) + export_dynamic_flag_spec_GCJ=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_GCJ=' ' + allow_undefined_flag_GCJ=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_From_new_cmds_GCJ='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds_GCJ='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + enable_shared_with_static_runtimes_GCJ=yes + ;; + + darwin* | rhapsody*) + if test "$GXX" = yes ; then + archive_cmds_need_lc_GCJ=no + case "$host_os" in + rhapsody* | darwin1.[012]) + allow_undefined_flag_GCJ='-undefined suppress' + ;; + *) # Darwin 1.3 on + if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then + allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' + else + case ${MACOSX_DEPLOYMENT_TARGET} in + 10.[012]) + allow_undefined_flag_GCJ='-flat_namespace -undefined suppress' + ;; + 10.*) + allow_undefined_flag_GCJ='-undefined dynamic_lookup' + ;; + esac + fi + ;; + esac + lt_int_apple_cc_single_mod=no + output_verbose_link_cmd='echo' + if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then + lt_int_apple_cc_single_mod=yes + fi + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_cmds_GCJ='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + else + archive_cmds_GCJ='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' + fi + module_cmds_GCJ='$CC ${wl}-bind_at_load $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' + # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's + if test "X$lt_int_apple_cc_single_mod" = Xyes ; then + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + else + archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' + hardcode_direct_GCJ=no + hardcode_automatic_GCJ=yes + hardcode_shlibpath_var_GCJ=unsupported + whole_archive_flag_spec_GCJ='-all_load $convenience' + link_all_deplibs_GCJ=yes + else + ld_shlibs_GCJ=no + fi + ;; + + dgux*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + freebsd1*) + ld_shlibs_GCJ=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | kfreebsd*-gnu) + archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + ;; + + hpux10* | hpux11*) + if test "$GCC" = yes -a "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case "$host_cpu" in + hppa*64*|ia64*) + archive_cmds_GCJ='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + ;; + *) + archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + ;; + esac + fi + if test "$with_gnu_ld" = no; then + case "$host_cpu" in + hppa*64*) + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld_GCJ='+b $libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + ;; + ia64*) + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_direct_GCJ=no + hardcode_shlibpath_var_GCJ=no + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + ;; + *) + hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_direct_GCJ=yes + export_dynamic_flag_spec_GCJ='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L_GCJ=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + link_all_deplibs_GCJ=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + newsos6) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + hardcode_shlibpath_var_GCJ=no + ;; + + openbsd*) + hardcode_direct_GCJ=yes + hardcode_shlibpath_var_GCJ=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + export_dynamic_flag_spec_GCJ='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-R$libdir' + ;; + *) + archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_minus_L_GCJ=yes + allow_undefined_flag_GCJ=unsupported + archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_GCJ=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag_GCJ=' -expect_unresolved \*' + archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec_GCJ='-rpath $libdir' + fi + hardcode_libdir_separator_GCJ=: + ;; + + sco3.2v5*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + export_dynamic_flag_spec_GCJ='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag_GCJ=' -z text' + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + hardcode_libdir_flag_spec_GCJ='-R$libdir' + hardcode_shlibpath_var_GCJ=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract' ;; + esac + link_all_deplibs_GCJ=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=yes + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds_GCJ='$CC -r -o $output$reload_objs' + hardcode_direct_GCJ=no + ;; + motorola) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_GCJ=no + ;; + + sysv4.3*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + export_dynamic_flag_spec_GCJ='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var_GCJ=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs_GCJ=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct_GCJ=yes + hardcode_minus_L_GCJ=no + hardcode_shlibpath_var_GCJ=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) + no_undefined_flag_GCJ='${wl}-z ${wl}text' + if test "$GCC" = yes; then + archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds_GCJ='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var_GCJ=no + ;; + + sysv5*) + no_undefined_flag_GCJ=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + hardcode_libdir_flag_spec_GCJ= + hardcode_shlibpath_var_GCJ=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec_GCJ='-L$libdir' + hardcode_shlibpath_var_GCJ=no + ;; + + *) + ld_shlibs_GCJ=no + ;; + esac + fi + +echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5 +echo "${ECHO_T}$ld_shlibs_GCJ" >&6 +test "$ld_shlibs_GCJ" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_GCJ" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_GCJ=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_GCJ in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 +echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + 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); } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_GCJ + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ + allow_undefined_flag_GCJ= + if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 + (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + then + archive_cmds_need_lc_GCJ=no + else + archive_cmds_need_lc_GCJ=yes + fi + allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5 +echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6 + ;; + esac + fi + ;; +esac + +echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 +echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + shrext=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/./-/g'`${versuffix}${shared_ext}' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext='$(test .$module = .yes && echo .so || echo .dylib)' + # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. + if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` + else + sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib' + fi + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +kfreebsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.01* | freebsdelf3.01*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case "$host_cpu" in + ia64*) + shrext='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + ld_extra=`$SED -e 's/:,\t/ /g;s/=^=*$//;s/=^= * / /g' /etc/ld.so.conf` + sys_lib_dlsearch_path_spec="/lib /usr/lib $ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +knetbsd*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='GNU ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=yes + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$as_me:$LINENO: result: $dynamic_linker" >&5 +echo "${ECHO_T}$dynamic_linker" >&6 +test "$dynamic_linker" = no && can_build_shared=no + +echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 +echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 +hardcode_action_GCJ= +if test -n "$hardcode_libdir_flag_spec_GCJ" || \ + test -n "$runpath_var GCJ" || \ + test "X$hardcode_automatic_GCJ"="Xyes" ; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct_GCJ" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no && + test "$hardcode_minus_L_GCJ" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_GCJ=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_GCJ=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_GCJ=unsupported +fi +echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5 +echo "${ECHO_T}$hardcode_action_GCJ" >&6 + +if test "$hardcode_action_GCJ" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +striplib= +old_striplib= +echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 +echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + ;; + *) + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + ;; + esac +fi + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + echo "$as_me:$LINENO: checking for shl_load" >&5 +echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 +if test "${ac_cv_func_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* 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 shl_load (); +/* 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_shl_load) || defined (__stub___shl_load) +choke me +#else +char (*f) () = shl_load; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != shl_load; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +echo "${ECHO_T}$ac_cv_func_shl_load" >&6 +if test $ac_cv_func_shl_load = yes; then + lt_cv_dlopen="shl_load" +else + echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load (); +int +main () +{ +shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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_dld_shl_load=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_shl_load=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 +if test $ac_cv_lib_dld_shl_load = yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" +else + echo "$as_me:$LINENO: checking for dlopen" >&5 +echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 +if test "${ac_cv_func_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_dlopen) || defined (__stub___dlopen) +choke me +#else +char (*f) () = dlopen; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != dlopen; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +echo "${ECHO_T}$ac_cv_func_dlopen" >&6 +if test $ac_cv_func_dlopen = yes; then + lt_cv_dlopen="dlopen" +else + echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dl_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 +if test $ac_cv_lib_dl_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 +echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 +if test "${ac_cv_lib_svld_dlopen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main () +{ +dlopen (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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_svld_dlopen=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_svld_dlopen=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 +if test $ac_cv_lib_svld_dlopen = yes; then + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 +echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 +if test "${ac_cv_lib_dld_dld_link+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dld_link (); +int +main () +{ +dld_link (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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_dld_dld_link=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_dld_dld_link=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 +if test $ac_cv_lib_dld_dld_link = yes; then + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 +echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self" >&6 + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 +echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +} +EOF + 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); } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 +echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_GCJ \ + CC_GCJ \ + LD_GCJ \ + lt_prog_compiler_wl_GCJ \ + lt_prog_compiler_pic_GCJ \ + lt_prog_compiler_static_GCJ \ + lt_prog_compiler_no_builtin_flag_GCJ \ + export_dynamic_flag_spec_GCJ \ + thread_safe_flag_spec_GCJ \ + whole_archive_flag_spec_GCJ \ + enable_shared_with_static_runtimes_GCJ \ + old_archive_cmds_GCJ \ + old_archive_from_new_cmds_GCJ \ + predep_objects_GCJ \ + postdep_objects_GCJ \ + predeps_GCJ \ + postdeps_GCJ \ + compiler_lib_search_path_GCJ \ + archive_cmds_GCJ \ + archive_expsym_cmds_GCJ \ + postinstall_cmds_GCJ \ + postuninstall_cmds_GCJ \ + old_archive_from_expsyms_cmds_GCJ \ + allow_undefined_flag_GCJ \ + no_undefined_flag_GCJ \ + export_symbols_cmds_GCJ \ + hardcode_libdir_flag_spec_GCJ \ + hardcode_libdir_flag_spec_ld_GCJ \ + hardcode_libdir_separator_GCJ \ + hardcode_automatic_GCJ \ + module_cmds_GCJ \ + module_expsym_cmds_GCJ \ + lt_cv_prog_compiler_c_o_GCJ \ + exclude_expsyms_GCJ \ + include_expsyms_GCJ; do + + case $var in + old_archive_cmds_GCJ | \ + old_archive_from_new_cmds_GCJ | \ + archive_cmds_GCJ | \ + archive_expsym_cmds_GCJ | \ + module_cmds_GCJ | \ + module_expsym_cmds_GCJ | \ + old_archive_from_expsyms_cmds_GCJ | \ + export_symbols_cmds_GCJ | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_GCJ + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_GCJ + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_GCJ + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_GCJ + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_GCJ + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_GCJ +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_GCJ + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_GCJ +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_GCJ +archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_GCJ +module_expsym_cmds=$lt_module_expsym_cmds_GCJ + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_GCJ + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_GCJ + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_GCJ + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_GCJ + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_GCJ + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_GCJ + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_GCJ + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_GCJ + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_GCJ + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_GCJ + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_GCJ" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_GCJ + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_GCJ + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_GCJ + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_GCJ + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 + +CC="$lt_save_CC" + + else + tagname="" + fi + ;; + + RC) + + + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +objext_RC=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${RC-"windres"} +compiler=$CC +compiler_RC=$CC +lt_cv_prog_compiler_c_o_RC=yes + +# The else clause should only fire when bootstrapping the +# libtool distribution, otherwise you forgot to ship ltmain.sh +# with your package, and you will get complaints that there are +# no rules to generate ltmain.sh. +if test -f "$ltmain"; then + # See if we are running on zsh, and set the options which allow our commands through + # without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + # Now quote all the things that may contain metacharacters while being + # careful not to overquote the AC_SUBSTed values. We take copies of the + # variables and quote the copies for generation of the libtool script. + for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC NM \ + SED SHELL STRIP \ + libname_spec library_names_spec soname_spec extract_expsyms_cmds \ + old_striplib striplib file_magic_cmd finish_cmds finish_eval \ + deplibs_check_method reload_flag reload_cmds need_locks \ + lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \ + lt_cv_sys_global_symbol_to_c_name_address \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + old_postinstall_cmds old_postuninstall_cmds \ + compiler_RC \ + CC_RC \ + LD_RC \ + lt_prog_compiler_wl_RC \ + lt_prog_compiler_pic_RC \ + lt_prog_compiler_static_RC \ + lt_prog_compiler_no_builtin_flag_RC \ + export_dynamic_flag_spec_RC \ + thread_safe_flag_spec_RC \ + whole_archive_flag_spec_RC \ + enable_shared_with_static_runtimes_RC \ + old_archive_cmds_RC \ + old_archive_from_new_cmds_RC \ + predep_objects_RC \ + postdep_objects_RC \ + predeps_RC \ + postdeps_RC \ + compiler_lib_search_path_RC \ + archive_cmds_RC \ + archive_expsym_cmds_RC \ + postinstall_cmds_RC \ + postuninstall_cmds_RC \ + old_archive_from_expsyms_cmds_RC \ + allow_undefined_flag_RC \ + no_undefined_flag_RC \ + export_symbols_cmds_RC \ + hardcode_libdir_flag_spec_RC \ + hardcode_libdir_flag_spec_ld_RC \ + hardcode_libdir_separator_RC \ + hardcode_automatic_RC \ + module_cmds_RC \ + module_expsym_cmds_RC \ + lt_cv_prog_compiler_c_o_RC \ + exclude_expsyms_RC \ + include_expsyms_RC; do + + case $var in + old_archive_cmds_RC | \ + old_archive_from_new_cmds_RC | \ + archive_cmds_RC | \ + archive_expsym_cmds_RC | \ + module_cmds_RC | \ + module_expsym_cmds_RC | \ + old_archive_from_expsyms_cmds_RC | \ + export_symbols_cmds_RC | \ + extract_expsyms_cmds | reload_cmds | finish_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case $lt_echo in + *'\$0 --fallback-echo"') + lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + +cfgfile="$ofile" + + cat <<__EOF__ >> "$cfgfile" +# ### BEGIN LIBTOOL TAG CONFIG: $tagname + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_RC + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_compiler_RC + +# Is the compiler the GNU C compiler? +with_gcc=$GCC_RC + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_LD_RC + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A symbol stripping program +STRIP=$lt_STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_RC + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Shared library suffix (normally ".so"). +shrext='$shrext' + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_RC +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_RC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_old_archive_cmds_RC +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC + +# Commands used to build and install a shared archive. +archive_cmds=$lt_archive_cmds_RC +archive_expsym_cmds=$lt_archive_expsym_cmds_RC +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to build a loadable module (assumed same as above if empty) +module_cmds=$lt_module_cmds_RC +module_expsym_cmds=$lt_module_expsym_cmds_RC + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_predep_objects_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_postdep_objects_RC + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_predeps_RC + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_postdeps_RC + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_RC + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_RC + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_RC + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_RC + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC + +# If ld is used when linking, flag to hardcode \$libdir into +# a binary during linking. This must work even if \$libdir does +# not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC + +# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct_RC + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L_RC + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_RC + +# Set to yes if building a shared library automatically hardcodes DIR into the library +# and all subsequent libraries and executables linked against it. +hardcode_automatic=$hardcode_automatic_RC + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_RC + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path_RC" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols_RC + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_RC + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_RC + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_RC + +# ### END LIBTOOL TAG CONFIG: $tagname + +__EOF__ + + +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'` + if test -f "$ltmain_in"; then + test -f Makefile && make "$ltmain" + fi +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 + +CC="$lt_save_CC" + + ;; + + *) + { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5 +echo "$as_me: error: Unsupported tag name: $tagname" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + + # Append the new tag name to the list of available tags. + if test -n "$tagname" ; then + available_tags="$available_tags $tagname" + fi + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5 +echo "$as_me: error: unable to update list of available tagged configurations." >&2;} + { (exit 1); exit 1; }; } + fi +fi + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + +# Prevent multiple expansion + + + + + + + + + + + + + + + + + + + + + + # Extract the first word of "gtkdoc-mkdb", so it can be a program name with args. +set dummy gtkdoc-mkdb; 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_GTKDOC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$GTKDOC"; then + ac_cv_prog_GTKDOC="$GTKDOC" # 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_GTKDOC="true" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_GTKDOC" && ac_cv_prog_GTKDOC="false" +fi +fi +GTKDOC=$ac_cv_prog_GTKDOC +if test -n "$GTKDOC"; then + echo "$as_me:$LINENO: result: $GTKDOC" >&5 +echo "${ECHO_T}$GTKDOC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + +if $GTKDOC; then + HAVE_GTK_DOC_TRUE= + HAVE_GTK_DOC_FALSE='#' +else + HAVE_GTK_DOC_TRUE='#' + HAVE_GTK_DOC_FALSE= +fi + + + + # Check whether --enable-gtk-doc or --disable-gtk-doc was given. +if test "${enable_gtk_doc+set}" = set; then + enableval="$enable_gtk_doc" + enable_gtk_doc="$enableval" +else + enable_gtk_doc=auto +fi; + + if test x$enable_gtk_doc = xauto ; then + if test x$GTKDOC = xtrue ; then + enable_gtk_doc=yes + else + enable_gtk_doc=no + fi + fi + + + +if test x$enable_gtk_doc = xyes; then + ENABLE_GTK_DOC_TRUE= + ENABLE_GTK_DOC_FALSE='#' +else + ENABLE_GTK_DOC_TRUE='#' + ENABLE_GTK_DOC_FALSE= +fi + + + +# declare the modules (no optional module) + +test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" +ACLOCAL="$ACLOCAL -I acmacro" + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err 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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* 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; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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 \ + '' \ + '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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +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>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err 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 + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + : > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # (even with -Werror). So we grep stderr for any message + # that says an option was ignored. + if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +ac_ext=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran + 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_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$F77"; then + ac_cv_prog_F77="$F77" # 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_F77="$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 +F77=$ac_cv_prog_F77 +if test -n "$F77"; then + echo "$as_me:$LINENO: result: $F77" >&5 +echo "${ECHO_T}$F77" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$F77" && break + done +fi +if test -z "$F77"; then + ac_ct_F77=$F77 + for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran +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_F77+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_F77"; then + ac_cv_prog_ac_ct_F77="$ac_ct_F77" # 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_F77="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_F77=$ac_cv_prog_ac_ct_F77 +if test -n "$ac_ct_F77"; then + echo "$as_me:$LINENO: result: $ac_ct_F77" >&5 +echo "${ECHO_T}$ac_ct_F77" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_F77" && break +done + + F77=$ac_ct_F77 +fi + + +# Provide some information about the compiler. +echo "$as_me:20036:" \ + "checking for Fortran 77 compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +rm -f a.out + +# If we don't use `.F' as extension, the preprocessor is not run on the +# input file. (Note that this only needs to work for GNU compilers.) +ac_save_ext=$ac_ext +ac_ext=F +echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6 +if test "${ac_cv_f77_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF + program main +#ifndef __GNUC__ + choke me +#endif + + end +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_f77_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6 +ac_ext=$ac_save_ext +ac_test_FFLAGS=${FFLAGS+set} +ac_save_FFLAGS=$FFLAGS +FFLAGS= +echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5 +echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_f77_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + FFLAGS=-g +cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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_f77_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_f77_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5 +echo "${ECHO_T}$ac_cv_prog_f77_g" >&6 +if test "$ac_test_FFLAGS" = set; then + FFLAGS=$ac_save_FFLAGS +elif test $ac_cv_prog_f77_g = yes; then + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-g -O2" + else + FFLAGS="-g" + fi +else + if test "x$ac_cv_f77_compiler_gnu" = xyes; then + FFLAGS="-O2" + else + FFLAGS= + fi +fi + +G77=`test $ac_compiler_gnu = yes && echo yes` +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=f +ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5' +ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu +echo "$as_me:$LINENO: checking how to get verbose linking output from $F77" >&5 +echo $ECHO_N "checking how to get verbose linking output from $F77... $ECHO_C" >&6 +if test "${ac_cv_prog_f77_v+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_f77_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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_f77_v= +# Try some options frequently used verbose output +for ac_verb in -v -verbose --verbose -V -\#\#\#; do + cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF + +# Compile and link our simple test program by passing a flag (argument +# 1 to this macro) to the Fortran compiler in order to get +# "verbose" output that we can then parse for the Fortran linker +# flags. +ac_save_FFLAGS=$FFLAGS +FFLAGS="$FFLAGS $ac_verb" +(eval echo $as_me:20228: \"$ac_link\") >&5 +ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'` +echo "$ac_f77_v_output" >&5 +FFLAGS=$ac_save_FFLAGS + +rm -f conftest* + +# On HP/UX there is a line like: "LPATH is: /foo:/bar:/baz" where +# /foo, /bar, and /baz are search directories for the Fortran linker. +# Here, we change these into -L/foo -L/bar -L/baz (and put it first): +ac_f77_v_output="`echo $ac_f77_v_output | + grep 'LPATH is:' | + sed 's,.*LPATH is\(: *[^ ]*\).*,\1,;s,: */, -L/,g'` $ac_f77_v_output" + +case $ac_f77_v_output in + # If we are using xlf then replace all the commas with spaces. + *xlfentry*) + ac_f77_v_output=`echo $ac_f77_v_output | sed 's/,/ /g'` ;; + + # With Intel ifc, ignore the quoted -mGLOB_options_string stuff (quoted + # $LIBS confuse us, and the libraries appear later in the output anyway). + *mGLOB_options_string*) + ac_f77_v_output=`echo $ac_f77_v_output | sed 's/\"-mGLOB[^\"]*\"/ /g'` ;; + + # If we are using Cray Fortran then delete quotes. + # Use "\"" instead of '"' for font-lock-mode. + # FIXME: a more general fix for quoted arguments with spaces? + *cft90*) + ac_f77_v_output=`echo $ac_f77_v_output | sed "s/\"//g"` ;; +esac + + + # look for -l* and *.a constructs in the output + for ac_arg in $ac_f77_v_output; do + case $ac_arg in + [\\/]*.a | ?:[\\/]*.a | -[lLRu]*) + ac_cv_prog_f77_v=$ac_verb + break 2 ;; + esac + done +done +if test -z "$ac_cv_prog_f77_v"; then + { echo "$as_me:$LINENO: WARNING: cannot determine how to obtain linking information from $F77" >&5 +echo "$as_me: WARNING: cannot determine how to obtain linking information from $F77" >&2;} +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ echo "$as_me:$LINENO: WARNING: compilation failed" >&5 +echo "$as_me: WARNING: compilation failed" >&2;} +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_f77_v" >&5 +echo "${ECHO_T}$ac_cv_prog_f77_v" >&6 +echo "$as_me:$LINENO: checking for Fortran libraries of $F77" >&5 +echo $ECHO_N "checking for Fortran libraries of $F77... $ECHO_C" >&6 +if test "${ac_cv_f77_libs+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "x$FLIBS" != "x"; then + ac_cv_f77_libs="$FLIBS" # Let the user override the test. +else + +cat >conftest.$ac_ext <<_ACEOF + program main + + end +_ACEOF + +# Compile and link our simple test program by passing a flag (argument +# 1 to this macro) to the Fortran compiler in order to get +# "verbose" output that we can then parse for the Fortran linker +# flags. +ac_save_FFLAGS=$FFLAGS +FFLAGS="$FFLAGS $ac_cv_prog_f77_v" +(eval echo $as_me:20306: \"$ac_link\") >&5 +ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'` +echo "$ac_f77_v_output" >&5 +FFLAGS=$ac_save_FFLAGS + +rm -f conftest* + +# On HP/UX there is a line like: "LPATH is: /foo:/bar:/baz" where +# /foo, /bar, and /baz are search directories for the Fortran linker. +# Here, we change these into -L/foo -L/bar -L/baz (and put it first): +ac_f77_v_output="`echo $ac_f77_v_output | + grep 'LPATH is:' | + sed 's,.*LPATH is\(: *[^ ]*\).*,\1,;s,: */, -L/,g'` $ac_f77_v_output" + +case $ac_f77_v_output in + # If we are using xlf then replace all the commas with spaces. + *xlfentry*) + ac_f77_v_output=`echo $ac_f77_v_output | sed 's/,/ /g'` ;; + + # With Intel ifc, ignore the quoted -mGLOB_options_string stuff (quoted + # $LIBS confuse us, and the libraries appear later in the output anyway). + *mGLOB_options_string*) + ac_f77_v_output=`echo $ac_f77_v_output | sed 's/\"-mGLOB[^\"]*\"/ /g'` ;; + + # If we are using Cray Fortran then delete quotes. + # Use "\"" instead of '"' for font-lock-mode. + # FIXME: a more general fix for quoted arguments with spaces? + *cft90*) + ac_f77_v_output=`echo $ac_f77_v_output | sed "s/\"//g"` ;; +esac + + + +ac_cv_f77_libs= + +# Save positional arguments (if any) +ac_save_positional="$@" + +set X $ac_f77_v_output +while test $# != 1; do + shift + ac_arg=$1 + case $ac_arg in + [\\/]*.a | ?:[\\/]*.a) + ac_exists=false + for ac_i in $ac_cv_f77_libs; do + if test x"$ac_arg" = x"$ac_i"; then + ac_exists=true + break + fi + done + + if test x"$ac_exists" = xtrue; then + : +else + ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" +fi + + ;; + -bI:*) + ac_exists=false + for ac_i in $ac_cv_f77_libs; do + if test x"$ac_arg" = x"$ac_i"; then + ac_exists=true + break + fi + done + + if test x"$ac_exists" = xtrue; then + : +else + if test "$ac_compiler_gnu" = yes; then + for ac_link_opt in $ac_arg; do + ac_cv_f77_libs="$ac_cv_f77_libs -Xlinker $ac_link_opt" + done +else + ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" +fi +fi + + ;; + # Ignore these flags. + -lang* | -lcrt[01].o | -lcrtbegin.o | -lc | -lgcc | -libmil | -LANG:=*) + ;; + -lkernel32) + test x"$CYGWIN" != xyes && ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" + ;; + -[LRuY]) + # These flags, when seen by themselves, take an argument. + # We remove the space between option and argument and re-iterate + # unless we find an empty arg or a new option (starting with -) + case $2 in + "" | -*);; + *) + ac_arg="$ac_arg$2" + shift; shift + set X $ac_arg "$@" + ;; + esac + ;; + -YP,*) + for ac_j in `echo $ac_arg | sed -e 's/-YP,/-L/;s/:/ -L/g'`; do + ac_exists=false + for ac_i in $ac_cv_f77_libs; do + if test x"$ac_j" = x"$ac_i"; then + ac_exists=true + break + fi + done + + if test x"$ac_exists" = xtrue; then + : +else + ac_arg="$ac_arg $ac_j" + ac_cv_f77_libs="$ac_cv_f77_libs $ac_j" +fi + + done + ;; + -[lLR]*) + ac_exists=false + for ac_i in $ac_cv_f77_libs; do + if test x"$ac_arg" = x"$ac_i"; then + ac_exists=true + break + fi + done + + if test x"$ac_exists" = xtrue; then + : +else + ac_cv_f77_libs="$ac_cv_f77_libs $ac_arg" +fi + + ;; + # Ignore everything else. + esac +done +# restore positional arguments +set X $ac_save_positional; shift + +# We only consider "LD_RUN_PATH" on Solaris systems. If this is seen, +# then we insist that the "run path" must be an absolute path (i.e. it +# must begin with a "/"). +case `(uname -sr) 2>/dev/null` in + "SunOS 5"*) + ac_ld_run_path=`echo $ac_f77_v_output | + sed -n 's,^.*LD_RUN_PATH *= *\(/[^ ]*\).*$,-R\1,p'` + test "x$ac_ld_run_path" != x && + if test "$ac_compiler_gnu" = yes; then + for ac_link_opt in $ac_ld_run_path; do + ac_cv_f77_libs="$ac_cv_f77_libs -Xlinker $ac_link_opt" + done +else + ac_cv_f77_libs="$ac_cv_f77_libs $ac_ld_run_path" +fi + ;; +esac +fi # test "x$[]_AC_LANG_PREFIX[]LIBS" = "x" + +fi +echo "$as_me:$LINENO: result: $ac_cv_f77_libs" >&5 +echo "${ECHO_T}$ac_cv_f77_libs" >&6 +FLIBS="$ac_cv_f77_libs" + + +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 whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + +# Checks for header files. +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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + + + + + +for ac_header in stddef.h stdlib.h string.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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err 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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag 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 compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + 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: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&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;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------------- ## +## Report this to martin.quinson@ens-lyon.fr ## +## ----------------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +# Checks for typedefs, structures, and compiler characteristics. +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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +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>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_const=no +fi +rm -f conftest.err 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 for inline" >&5 +echo $ECHO_N "checking for inline... $ECHO_C" >&6 +if test "${ac_cv_c_inline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_inline=$ac_kw; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 +echo "${ECHO_T}$ac_cv_c_inline" >&6 + + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + +echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_size_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 +if test $ac_cv_type_size_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned +_ACEOF + +fi + + +# Checks for library functions. + +for ac_header in stdlib.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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err 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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag 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 compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + 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: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&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;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------------- ## +## Report this to martin.quinson@ens-lyon.fr ## +## ----------------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5 +echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6 +if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_malloc_0_nonnull=no +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#if STDC_HEADERS || HAVE_STDLIB_H +# include +#else +char *malloc (); +#endif + +int +main () +{ +exit (malloc (0) ? 0 : 1); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_malloc_0_nonnull=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_malloc_0_nonnull=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5 +echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6 +if test $ac_cv_func_malloc_0_nonnull = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MALLOC 1 +_ACEOF + +else + cat >>confdefs.h <<\_ACEOF +#define HAVE_MALLOC 0 +_ACEOF + + case $LIBOBJS in + "malloc.$ac_objext" | \ + *" malloc.$ac_objext" | \ + "malloc.$ac_objext "* | \ + *" malloc.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; +esac + + +cat >>confdefs.h <<\_ACEOF +#define malloc rpl_malloc +_ACEOF + +fi + + + +echo "$as_me:$LINENO: checking for working memcmp" >&5 +echo $ECHO_N "checking for working memcmp... $ECHO_C" >&6 +if test "${ac_cv_func_memcmp_working+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_memcmp_working=no +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* Some versions of memcmp are not 8-bit clean. */ + char c0 = 0x40, c1 = 0x80, c2 = 0x81; + if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) + exit (1); + + /* The Next x86 OpenStep bug shows up only when comparing 16 bytes + or more and with at least one buffer not starting on a 4-byte boundary. + William Lewis provided this test program. */ + { + char foo[21]; + char bar[21]; + int i; + for (i = 0; i < 4; i++) + { + char *a = foo + i; + char *b = bar + i; + strcpy (a, "--------01111111"); + strcpy (b, "--------10000000"); + if (memcmp (a, b, 16) >= 0) + exit (1); + } + exit (0); + } + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_memcmp_working=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_memcmp_working=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5 +echo "${ECHO_T}$ac_cv_func_memcmp_working" >&6 +test $ac_cv_func_memcmp_working = no && case $LIBOBJS in + "memcmp.$ac_objext" | \ + *" memcmp.$ac_objext" | \ + "memcmp.$ac_objext "* | \ + *" memcmp.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; +esac + + + + + +for ac_func in memset strchr 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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err 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 "BEGINING OF ACI-PACKAGE-SAVED(XML)">&5; + # Extract the first word of "xml2-config", so it can be a program name with args. +set dummy xml2-config; 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_ACI_CACHE_PROG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ACI_CACHE_PROG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ACI_CACHE_PROG="$ACI_CACHE_PROG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ACI_CACHE_PROG="$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 + + test -z "$ac_cv_path_ACI_CACHE_PROG" && ac_cv_path_ACI_CACHE_PROG="no" + ;; +esac +fi +ACI_CACHE_PROG=$ac_cv_path_ACI_CACHE_PROG + +if test -n "$ACI_CACHE_PROG"; then + echo "$as_me:$LINENO: result: $ACI_CACHE_PROG" >&5 +echo "${ECHO_T}$ACI_CACHE_PROG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + aci_module_desc_XML="XML library (version XML2)" + aci_pkg_config_XML=xml2-config + aci_packages="$aci_packages XML" + if test x$ACI_CACHE_PROG = xno; then + HAVE_XML=no + CFLAGS_XML="" + LIBS_XML="" + : + else + HAVE_XML=yes + CFLAGS_XML=`$ACI_CACHE_PROG --cflags ` + LIBS_XML=`$ACI_CACHE_PROG --libs ` + echo >/dev/null + fi + echo "END OF ACI-PACKAGE-SAVED(XML)">&5; + + + + + + + + + + + aci_nameok=`echo SimGrid|sed 'y/-/./'` + if test "xSimGrid" != "x$aci_nameok" ; then + { { echo "$as_me:$LINENO: error: ACI error: Please no '-' in package name. (ie, SimGrid is not a valid name)" >&5 +echo "$as_me: error: ACI error: Please no '-' in package name. (ie, SimGrid is not a valid name)" >&2;} + { (exit 1); exit 1; }; } + fi + echo "BEGINING OF ACI-PACKAGE(SimGrid)">&5; + aci_module_desc_SimGrid="the SimGrid simulator" + aci_packages="$aci_packages SimGrid" + + +# Check whether --with-SimGrid or --without-SimGrid was given. +if test "${with_SimGrid+set}" = set; then + withval="$with_SimGrid" + with_SimGrid=$withval + good=yes + if test "$withval" = yes ; then good=no; fi + if test "$withval" = no ; then good=no; fi + if test $good = no ; then + { { echo "$as_me:$LINENO: error: You gave me --with-SimGrid=$withval. I wait for a location, not yes or no (use --enable-the SimGrid simulator or --disable-the SimGrid simulator for that)" >&5 +echo "$as_me: error: You gave me --with-SimGrid=$withval. I wait for a location, not yes or no (use --enable-the SimGrid simulator or --disable-the SimGrid simulator for that)" >&2;} + { (exit 1); exit 1; }; } + fi + aci_pkg_prefix_SimGrid="$withval" + CFLAGS_SimGrid="-I$withval/include $CFLAGS_SimGrid" + LIBS_SimGrid="-L$withval/lib $LIBS_SimGrid" + +fi; + + +# Check whether --with-SimGrid-includes or --without-SimGrid-includes was given. +if test "${with_SimGrid_includes+set}" = set; then + withval="$with_SimGrid_includes" + CFLAGS_SimGrid="-I$withval $CFLAGS_SimGrid" + aci_pkg_inc_SimGrid="$withval" + +fi; + + +# Check whether --with-SimGrid-libraries or --without-SimGrid-libraries was given. +if test "${with_SimGrid_libraries+set}" = set; then + withval="$with_SimGrid_libraries" + LIBS_SimGrid="-L$withval $LIBS_SimGrid" + aci_pkg_lib_SimGrid="$withval" +fi; + + +# Check whether --with-SimGrid-extra or --without-SimGrid-extra was given. +if test "${with_SimGrid_extra+set}" = set; then + withval="$with_SimGrid_extra" + LIBS_SimGrid=`echo $withval|sed 's/!/ /g'`" $LIBS_SimGrid" + aci_pkg_extra_SimGrid="$withval" +fi; + + + OLD_LDFLAGS=$LDFLAGS + OLD_CFLAGS=$CFLAGS + OLD_CPPFLAGS=$CPPFLAGS + + i=`echo -lsimgrid|wc -l` + if test $i != 1 && test $i != 0 ; then + { { echo "$as_me:$LINENO: error: Badly formed args for function ACI-PACKAGE. + please no newline and no tab." >&5 +echo "$as_me: error: Badly formed args for function ACI-PACKAGE. + please no newline and no tab." >&2;} + { (exit 1); exit 1; }; } + fi + + ac_func_search_save_LIBS="$LIBS" + ac_func_search_save_this_LIBS="$LIBS_SimGrid" + aci_found="no" + echo "----------------------------------------" >&5 + echo "$as_me:$LINENO: checking for SimGrid. Can I access SG_init without new libs" >&5 +echo $ECHO_N "checking for SimGrid. Can I access SG_init without new libs... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char SG_init (); +int +main () +{ +SG_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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 + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 aci_found="yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test "$aci_found" = "no"; then + if test -n "$LIBS_SimGrid" ; then + LIBS="$LIBS_SimGrid" + echo "----------------------------------------" >&5 + echo "$as_me:$LINENO: checking for SimGrid. Can I access SG_init the specified extra args" >&5 +echo $ECHO_N "checking for SimGrid. Can I access SG_init the specified extra args... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char SG_init (); +int +main () +{ +SG_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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 + aci_found="yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +aci_found="no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + echo "$as_me:$LINENO: result: $aci_found" >&5 +echo "${ECHO_T}$aci_found" >&6 + fi + fi + for i in -lsimgrid + do + if test "x$aci_found" = "xno"; then + LIBS_SimGrid=`echo "$i $ac_func_search_save_this_LIBS"|sed 's/!/ /g'` + LIBS="$LIBS_SimGrid $ac_func_search_save_LIBS" + echo "----------------------------------------" >&5 + echo "$as_me:$LINENO: checking for SimGrid. Can I access SG_init with $LIBS_SimGrid" >&5 +echo $ECHO_N "checking for SimGrid. Can I access SG_init with $LIBS_SimGrid... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char SG_init (); +int +main () +{ +SG_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { 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 + aci_found="yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +aci_found="no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + echo "$as_me:$LINENO: result: $aci_found" >&5 +echo "${ECHO_T}$aci_found" >&6 + fi + done + LIBS="$ac_func_search_save_LIBS" + + if test "x$aci_found" = "xyes" && test "x"simgrid.h != "x" ; then + CPPFLAGS="$CPPFLAGS $CFLAGS_SimGrid" + echo "CPPFLAGS=$CPPFLAGS">&5; + if test "${ac_cv_header_simgrid_h+set}" = set; then + echo "$as_me:$LINENO: checking for simgrid.h" >&5 +echo $ECHO_N "checking for simgrid.h... $ECHO_C" >&6 +if test "${ac_cv_header_simgrid_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_simgrid_h" >&5 +echo "${ECHO_T}$ac_cv_header_simgrid_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking simgrid.h usability" >&5 +echo $ECHO_N "checking simgrid.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err 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 simgrid.h presence" >&5 +echo $ECHO_N "checking simgrid.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: simgrid.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: simgrid.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: simgrid.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: simgrid.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: simgrid.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: simgrid.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: simgrid.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: simgrid.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: simgrid.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: simgrid.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: simgrid.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: simgrid.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: simgrid.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: simgrid.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: simgrid.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: simgrid.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ----------------------------------------- ## +## Report this to martin.quinson@ens-lyon.fr ## +## ----------------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for simgrid.h" >&5 +echo $ECHO_N "checking for simgrid.h... $ECHO_C" >&6 +if test "${ac_cv_header_simgrid_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_simgrid_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_simgrid_h" >&5 +echo "${ECHO_T}$ac_cv_header_simgrid_h" >&6 + +fi +if test $ac_cv_header_simgrid_h = yes; then + good=yes +else + good=no +fi + + + fi + if test "x$aci_found" = "xno" ; then + { { echo "$as_me:$LINENO: error: Can't find the package SimGrid. Please install it, or if it is installed, tell me where with the --with-SimGrid argument (see ./configure --help=short)." >&5 +echo "$as_me: error: Can't find the package SimGrid. Please install it, or if it is installed, tell me where with the --with-SimGrid argument (see ./configure --help=short)." >&2;} + { (exit 1); exit 1; }; } + else + HAVE_SimGrid="yes" + echo >/dev/null + fi + if test "x$HAVE_SimGrid" != "xyes" ; then + CFLAGS_SimGrid="" + LIBS_SimGrid="" + fi + + + + + echo "END OF ACI-PACKAGE(SimGrid)">&5; + LDFLAGS=$OLDLDFLAGS + CPPFLAGS=$OLDCPPFLAGS + CFLAGS=$OLDCFLAGS + + + +echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi; + echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 +echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 + + +if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + +if test x$USE_MAINTAINER_MODE = xyes +then + + # Check whether --enable-compile-warnings or --disable-compile-warnings was given. +if test "${enable_compile_warnings+set}" = set; then + enableval="$enable_compile_warnings" + +else + enable_compile_warnings=yes +fi; + + echo "$as_me:$LINENO: checking what warning flags to pass to the C compiler" >&5 +echo $ECHO_N "checking what warning flags to pass to the C compiler... $ECHO_C" >&6 + warnCFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + + if test "x$enable_compile_warnings" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *-Wall*) ;; + *) warnCFLAGS="-g -Wall -Wunused" ;; + esac + + ## -W is not all that useful. And it cannot be controlled + ## with individual -Wno-xxx flags, unlike -Wall + if test "x$enable_compile_warnings" = "xyes"; then + warnCFLAGS="$warnCFLAGS -Wmissing-prototypes -Wmissing-declarations\ + -finline-functions -Wshadow -Wpointer-arith \ + -Wwrite-strings -Wno-unused-function -Werror" + fi + fi + fi + echo "$as_me:$LINENO: result: $warnCFLAGS" >&5 +echo "${ECHO_T}$warnCFLAGS" >&6 + + # Check whether --enable-iso-c or --disable-iso-c was given. +if test "${enable_iso_c+set}" = set; then + enableval="$enable_iso_c" + +else + enable_iso_c=no +fi; + + echo "$as_me:$LINENO: checking what language compliance flags to pass to the C compiler" >&5 +echo $ECHO_N "checking what language compliance flags to pass to the C compiler... $ECHO_C" >&6 + complCFLAGS= + if test "x$enable_iso_c" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *-ansi*) ;; + *) complCFLAGS="$complCFLAGS -ansi" ;; + esac + + case " $CFLAGS " in + *-pedantic*) ;; + *) complCFLAGS="$complCFLAGS -pedantic" ;; + esac + fi + fi + echo "$as_me:$LINENO: result: $complCFLAGS" >&5 +echo "${ECHO_T}$complCFLAGS" >&6 + if test "x$cflags_set" != "xyes"; then + CFLAGS="$CFLAGS $warnCFLAGS $complCFLAGS" + cflags_set=yes + + fi + +fi + + + + + +# Extract the first word of "bash", so it can be a program name with args. +set dummy bash; 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_BASH+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$BASH"; then + ac_cv_prog_BASH="$BASH" # 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_BASH="`which bash`" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_BASH" && ac_cv_prog_BASH="/bin/sh" +fi +fi +BASH=$ac_cv_prog_BASH +if test -n "$BASH"; then + echo "$as_me:$LINENO: result: $BASH" >&5 +echo "${ECHO_T}$BASH" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +WARNING="This file is generated, do not edit" + + + ac_config_files="$ac_config_files Makefile src/Makefile src/base/Makefile src/base/Tests/Makefile src/base/Tests/gs_example src/modules/Makefile src/examples/Makefile src/examples/ping/Makefile src/examples/bandwidth/Makefile src/examples/saturate/Makefile src/examples/alnem/Makefile doc/Makefile" + + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${HAVE_GTK_DOC_TRUE}" && test -z "${HAVE_GTK_DOC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"HAVE_GTK_DOC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"HAVE_GTK_DOC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${ENABLE_GTK_DOC_TRUE}" && test -z "${ENABLE_GTK_DOC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"ENABLE_GTK_DOC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"ENABLE_GTK_DOC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval 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="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by GRAS $as_me 0.1, which was +generated by GNU Autoconf 2.58. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +GRAS config.status 0.1 +configured by $0, generated by GNU Autoconf 2.58, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "src/base/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/base/Makefile" ;; + "src/base/Tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/base/Tests/Makefile" ;; + "src/base/Tests/gs_example" ) CONFIG_FILES="$CONFIG_FILES src/base/Tests/gs_example" ;; + "src/modules/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/modules/Makefile" ;; + "src/examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/examples/Makefile" ;; + "src/examples/ping/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/examples/ping/Makefile" ;; + "src/examples/bandwidth/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/examples/bandwidth/Makefile" ;; + "src/examples/saturate/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/examples/saturate/Makefile" ;; + "src/examples/alnem/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/examples/alnem/Makefile" ;; + "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "src/gras_config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/gras_config.h" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@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,@subdirs@,$subdirs,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@target@,$target,;t t +s,@target_cpu@,$target_cpu,;t t +s,@target_vendor@,$target_vendor,;t t +s,@target_os@,$target_os,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@CYGPATH_W@,$CYGPATH_W,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@AMTAR@,$AMTAR,;t t +s,@install_sh@,$install_sh,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t +s,@AWK@,$AWK,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@am__leading_dot@,$am__leading_dot,;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,@DEPDIR@,$DEPDIR,;t t +s,@am__include@,$am__include,;t t +s,@am__quote@,$am__quote,;t t +s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t +s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t +s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t +s,@CCDEPMODE@,$CCDEPMODE,;t t +s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t +s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t +s,@EGREP@,$EGREP,;t t +s,@LN_S@,$LN_S,;t t +s,@ECHO@,$ECHO,;t t +s,@AR@,$AR,;t t +s,@ac_ct_AR@,$ac_ct_AR,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@CPP@,$CPP,;t t +s,@CXX@,$CXX,;t t +s,@CXXFLAGS@,$CXXFLAGS,;t t +s,@ac_ct_CXX@,$ac_ct_CXX,;t t +s,@CXXDEPMODE@,$CXXDEPMODE,;t t +s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t +s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t +s,@CXXCPP@,$CXXCPP,;t t +s,@F77@,$F77,;t t +s,@FFLAGS@,$FFLAGS,;t t +s,@ac_ct_F77@,$ac_ct_F77,;t t +s,@LIBTOOL@,$LIBTOOL,;t t +s,@GTKDOC@,$GTKDOC,;t t +s,@HAVE_GTK_DOC_TRUE@,$HAVE_GTK_DOC_TRUE,;t t +s,@HAVE_GTK_DOC_FALSE@,$HAVE_GTK_DOC_FALSE,;t t +s,@HAVE_GTK_DOC@,$HAVE_GTK_DOC,;t t +s,@ENABLE_GTK_DOC_TRUE@,$ENABLE_GTK_DOC_TRUE,;t t +s,@ENABLE_GTK_DOC_FALSE@,$ENABLE_GTK_DOC_FALSE,;t t +s,@FLIBS@,$FLIBS,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@ACI_CACHE_PROG@,$ACI_CACHE_PROG,;t t +s,@aci_module_desc_XML@,$aci_module_desc_XML,;t t +s,@aci_pkg_config_XML@,$aci_pkg_config_XML,;t t +s,@HAVE_XML@,$HAVE_XML,;t t +s,@CFLAGS_XML@,$CFLAGS_XML,;t t +s,@LIBS_XML@,$LIBS_XML,;t t +s,@aci_module_desc_SimGrid@,$aci_module_desc_SimGrid,;t t +s,@aci_pkg_prefix_SimGrid@,$aci_pkg_prefix_SimGrid,;t t +s,@aci_pkg_inc_SimGrid@,$aci_pkg_inc_SimGrid,;t t +s,@aci_pkg_lib_SimGrid@,$aci_pkg_lib_SimGrid,;t t +s,@aci_pkg_extra_SimGrid@,$aci_pkg_extra_SimGrid,;t t +s,@HAVE_SimGrid@,$HAVE_SimGrid,;t t +s,@CFLAGS_SimGrid@,$CFLAGS_SimGrid,;t t +s,@LIBS_SimGrid@,$LIBS_SimGrid,;t t +s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t +s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t +s,@MAINT@,$MAINT,;t t +s,@cflags_set@,$cflags_set,;t t +s,@BASH@,$BASH,;t t +s,@WARNING@,$WARNING,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + 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 + + # Run the commands associated with the file. + case $ac_file in + Makefile ) ( cd src/include ; test -e gras || ln -s . gras ) + test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example ;; + src/Makefile ) ( cd src/include ; test -e gras || ln -s . gras ) + test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example ;; + src/base/Makefile ) ( cd src/include ; test -e gras || ln -s . gras ) + test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example ;; + src/base/Tests/Makefile ) ( cd src/include ; test -e gras || ln -s . gras ) + test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example ;; + src/base/Tests/gs_example ) ( cd src/include ; test -e gras || ln -s . gras ) + test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example ;; + src/modules/Makefile ) ( cd src/include ; test -e gras || ln -s . gras ) + test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example ;; + src/examples/Makefile ) ( cd src/include ; test -e gras || ln -s . gras ) + test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example ;; + src/examples/ping/Makefile ) ( cd src/include ; test -e gras || ln -s . gras ) + test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example ;; + src/examples/bandwidth/Makefile ) ( cd src/include ; test -e gras || ln -s . gras ) + test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example ;; + src/examples/saturate/Makefile ) ( cd src/include ; test -e gras || ln -s . gras ) + test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example ;; + src/examples/alnem/Makefile ) ( cd src/include ; test -e gras || ln -s . gras ) + test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example ;; + doc/Makefile ) ( cd src/include ; test -e gras || ln -s . gras ) + test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example ;; + esac +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # 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 + + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +_ACEOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # grep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +# Compute $ac_file's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $ac_file | $ac_file:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $ac_file" >`(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'`/stamp-h$_am_stamp_count +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`(dirname "$mf") 2>/dev/null || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + else + continue + fi + grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n -e '/^U = / s///p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n -e ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`(dirname "$file") 2>/dev/null || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p $dirpart/$fdir + else + as_dir=$dirpart/$fdir + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 +echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; }; } + + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + esac +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + +# +# CONFIG_SUBDIRS section. +# +if test "$no_recursion" != yes; then + + # Remove --cache-file and --srcdir arguments so they do not pile up. + ac_sub_configure_args= + ac_prev= + for ac_arg in $ac_configure_args; do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case $ac_arg in + -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=*) + ;; + --config-cache | -C) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + ;; + *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; + esac + done + + # Always prepend --prefix to ensure using the same prefix + # in subdir configurations. + ac_sub_configure_args="--prefix=$prefix $ac_sub_configure_args" + + ac_popdir=`pwd` + for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + test -d $srcdir/$ac_dir || continue + + { echo "$as_me:$LINENO: configuring in $ac_dir" >&5 +echo "$as_me: configuring in $ac_dir" >&6;} + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + cd $ac_dir + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + ac_sub_configure="$SHELL '$ac_srcdir/configure.gnu'" + elif test -f $ac_srcdir/configure; then + ac_sub_configure="$SHELL '$ac_srcdir/configure'" + elif test -f $ac_srcdir/configure.in; then + ac_sub_configure=$ac_configure + else + { echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5 +echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + # Make the cache file name correct relative to the subdirectory. + case $cache_file in + [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; + *) # Relative path. + ac_sub_cache_file=$ac_top_builddir$cache_file ;; + esac + + { echo "$as_me:$LINENO: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 +echo "$as_me: running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} + # The eval makes quoting arguments work. + eval $ac_sub_configure $ac_sub_configure_args \ + --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir || + { { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5 +echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;} + { (exit 1); exit 1; }; } + fi + + cd "$ac_popdir" + done +fi + + +echo " + +Configuration of package \`${PACKAGE}': + + Compiler: ${CC} + + CFlags: ${CFLAGS} + LDFlags: ${LDFLAGS} +" + +exit 0; diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000000..ccb572b6c7 --- /dev/null +++ b/configure.ac @@ -0,0 +1,99 @@ +AC_PREREQ(2.57) + +#We need a recent ACI +ACI_PREREQ(2003.01.16) + +AC_INIT([GRAS],[0.1],[martin.quinson@ens-lyon.fr]) +AC_CONFIG_SRCDIR([src/include/gras.h]) +AC_REVISION($Revision$) +AC_CONFIG_SUBDIRS(src/nws_portability) + +AC_CANONICAL_TARGET +AC_LANG([C]) + +AM_CONFIG_HEADER(src/gras_config.h) +AM_INIT_AUTOMAKE + +AM_PROG_LIBTOOL +GNOME_GTKDOC_CHECK + +# declare the modules (no optional module) + +dnl +dnl Load anything under acmacro/*.m4 +dnl +test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" +ACLOCAL="$ACLOCAL -I acmacro" + + +AC_PROG_CC +AC_PROG_F77 +AC_F77_LIBRARY_LDFLAGS +AM_SANITY_CHECK +AC_PROG_MAKE_SET + +# Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS([stddef.h stdlib.h string.h unistd.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_C_INLINE +AC_TYPE_SIZE_T + +# Checks for library functions. +AC_FUNC_MALLOC +AC_FUNC_MEMCMP +AC_CHECK_FUNCS([memset strchr strerror]) + +dnl ####[ Search libs ]####################################################### +ACI_PACKAGE_SAVED(XML,[XML library (version XML2)],xml2-config,,,:) +ACI_PACKAGE([SimGrid],[the SimGrid simulator],[SG_init],[-lsimgrid],[simgrid.h]) + +dnl A C_CHECK_LIB(pthread, pthread_mutex_lock) + +dnl ####[ maint mode ]####################################################### +AM_MAINTAINER_MODE +if test x$USE_MAINTAINER_MODE = xyes +then + GNOME_COMPILE_WARNINGS(yes) +fi + +AC_SUBST(CFLAGS) +AC_SUBST(CPPFLAGS) +AC_SUBST(LDFLAGS) + +dnl ####[ check for some programms ]########################################### +AC_CHECK_PROG(BASH, bash, `which bash`, /bin/sh) +WARNING="This file is generated, do not edit" +AC_SUBST(WARNING) + +dnl ####[ Makes the output ]################################################### +AC_CONFIG_FILES([ + Makefile + src/Makefile + src/base/Makefile + src/base/Tests/Makefile + src/base/Tests/gs_example + src/modules/Makefile + src/examples/Makefile + src/examples/ping/Makefile + src/examples/bandwidth/Makefile src/examples/saturate/Makefile + src/examples/alnem/Makefile + doc/Makefile +],[( cd src/include ; test -e gras || ln -s . gras ) + test -e src/base/Tests/gs_example && chmod +x src/base/Tests/gs_example]) + +AC_OUTPUT + +echo " + +Configuration of package \`${PACKAGE}': + + Compiler: ${CC} + + CFlags: ${CFLAGS} + LDFlags: ${LDFLAGS} +" + +exit 0; diff --git a/cruft/doc/Makefile.am b/cruft/doc/Makefile.am new file mode 100644 index 0000000000..bf8f5576d7 --- /dev/null +++ b/cruft/doc/Makefile.am @@ -0,0 +1,191 @@ +## Process this file with automake to produce Makefile.in + +# This is a blank Makefile.am for using gtk-doc. +# Copy this to your project's API docs directory and modify the variables to +# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples +# of using the various options. + +# The name of the module, e.g. 'glib'. +DOC_MODULE=gras +HTML_DIR=. + +# The top-level SGML file. Change it if you want. +DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml + +# The directory containing the source code. Relative to $(srcdir). +# gtk-doc will search all .c & .h files beneath here for inline comments +# documenting functions and macros. +DOC_SOURCE_DIR=../src + +# Extra options to pass to gtkdoc-scanobj or gtkdoc-scangobj. +SCANOBJ_OPTIONS= + +# Extra options to supply to gtkdoc-scan. +SCAN_OPTIONS= + +# Extra options to supply to gtkdoc-mkdb. +MKDB_OPTIONS=--sgml-mode --ignore-files="nws_portability include/gras/gras" + +# Extra options to supply to gtkdoc-fixref. +FIXXREF_OPTIONS= + +# Used for dependencies. +HFILE_GLOB=$(shell find $(top_srcdir)/src -name "*.h") +CFILE_GLOB=$(shell find $(top_srcdir)/src -name "*.c") +#CFILE_GLOB=$(top_srcdir)/src/core/*.c + +# Header files to ignore when scanning. +IGNORE_HFILES= + +# Images to copy into HTML directory. +HTML_IMAGES = + +# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). +content_files = + +# Other files to distribute. +extra_files = + +# CFLAGS and LDFLAGS for compiling scan program. Only needed if your app/lib +# contains GtkObjects/GObjects and you want to document signals and properties. +GTKDOC_CFLAGS = +GTKDOC_LIBS = + +#GTKDOC_CC=$(LIBTOOL) --mode=compile $(CC) +#GTKDOC_LD=$(LIBTOOL) --mode=link $(CC) + +# If you need to override some of the declarations, place them in the +# $(DOC_MODULE)-overrides.txt file and uncomment the second line here. +DOC_OVERRIDES = +#DOC_OVERRIDES = $(DOC_MODULE)-overrides.txt + + + +########################################################################### +# Everything below here is generic and you shouldn't need to change it. +########################################################################### + +TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE) + +EXTRA_DIST = \ + $(content_files) \ + $(extra_files) \ + $(HTML_IMAGES) \ + $(DOC_MAIN_SGML_FILE) \ + $(DOC_MODULE).types \ + $(DOC_MODULE)-sections.txt \ + $(DOC_OVERRIDES) + +DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \ + $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp + +SCANOBJ_FILES = \ + $(DOC_MODULE).args \ + $(DOC_MODULE).hierarchy \ + $(DOC_MODULE).interfaces \ + $(DOC_MODULE).prerequisites \ + $(DOC_MODULE).signals + +if ENABLE_GTK_DOC +all-local: html-build.stamp + +#### scan #### + +scan-build.stamp: $(HFILE_GLOB) + @echo '*** Scanning header files ***' + if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null ; then \ + CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scanobj $(SCANOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \ + else \ + cd $(srcdir) ; \ + for i in $(SCANOBJ_FILES) ; do \ + test -f $$i || touch $$i ; \ + done \ + fi + cd $(srcdir) && \ + gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES) + touch scan-build.stamp + +$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES): scan-build.stamp + @true + +#### templates #### + +tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_OVERRIDES) + @echo '*** Rebuilding template files ***' + cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE) + touch tmpl-build.stamp + +tmpl.stamp: tmpl-build.stamp + @true + +#### sgml #### + +sgml-build.stamp: tmpl.stamp $(CFILE_GLOB) $(srcdir)/tmpl/*.sgml + @echo '*** Building SGML ***' + cd $(srcdir) && \ + gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --main-sgml-file=$(DOC_MAIN_SGML_FILE) $(MKDB_OPTIONS) + touch sgml-build.stamp + +sgml.stamp: sgml-build.stamp + @true + +#### html #### + +html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) + @echo '*** Building HTML ***' + test -d $(srcdir)/html || mkdir $(srcdir)/html + cd $(srcdir)/html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) + test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html ) + @echo '-- Fixing Crossreferences' + cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) + touch html-build.stamp +endif + +############## + +clean-local: + rm -f *~ *.bak $(SCANOBJ_FILES) *-unused.txt $(DOC_STAMPS) + +maintainer-clean-local: clean + cd $(srcdir) && rm -rf sgml html $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt + +install-data-local: + $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR) + (installfiles=`echo $(srcdir)/html/*.html`; \ + if test "$$installfiles" = '$(srcdir)/html/*.html'; \ + then echo '-- Nothing to install' ; \ + else \ + for i in $$installfiles; do \ + echo '-- Installing '$$i ; \ + $(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \ + done; \ + echo '-- Installing $(srcdir)/html/index.sgml' ; \ + $(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR); \ + fi) + +# +# Require gtk-doc when making dist +# +if ENABLE_GTK_DOC +dist-check-gtkdoc: +else +dist-check-gtkdoc: + @echo "*** gtk-doc must be installed and enabled in order to make dist" + @false +endif + +dist-hook: dist-check-gtkdoc dist-hook-local + mkdir $(distdir)/tmpl + mkdir $(distdir)/sgml + mkdir $(distdir)/html + -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl + -cp $(srcdir)/sgml/*.sgml $(distdir)/sgml + -cp $(srcdir)/html/index.sgml $(distdir)/html + -cp $(srcdir)/html/*.html $(srcdir)/html/*.css $(distdir)/html + + images=$(HTML_IMAGES) ; \ + for i in $$images ; do \ + cp $(srcdir)/$$i $(distdir)/html ; \ + done + +.PHONY : dist-hook-local diff --git a/cruft/doc/README b/cruft/doc/README new file mode 100644 index 0000000000..e82cb1c8a0 --- /dev/null +++ b/cruft/doc/README @@ -0,0 +1,29 @@ +This directory contains the reference documentation +for GRAS. For more information about it see: + + http://www.ens-lyon.fr/~mquinson/hacking.html + + +REQUIREMENTS +============ + +To build the documentation, you must have the gtk-doc +package installed. To rebuild the template files, +you must have the current version of the GRAS +header files installed. + + +BUILD +===== + +First, run configure to generate the makefiles for this +module. There is one option specific to this package + + --with-html-dir=DIR top of installed HTML documentation tree + +To build and install the documentation, do: + + make + + make install + diff --git a/cruft/doc/Roadmap.gnumeric b/cruft/doc/Roadmap.gnumeric new file mode 100644 index 0000000000000000000000000000000000000000..23bcd7129dde4d35c48a437f1e48c0ca30a357f9 GIT binary patch literal 3680 zcmV-m4xjNKiwFQz6AVBA1MOXHZ{oNX{=UB=Lc05HXkLKQ?v@oyr!P`F%WavR)vQ*? zB?h8~7&)db^Xso22gsXC(%rjToYRp;ENA0G&LGCw^i^K)|+tQMGh zlP00FqbJL3y3B3Fx-X%Z(tUO!E!#A$qu+0D?k97+Kp(syWGI+m-YfJ@!$^2TCWuA8 zDNogHzJzY0_k&?XZuS|Y-ouLFP>8ZZDT}3Sy~MrN&qv$O$;JRJaBp+Xzj^ri^fa84 z=kc6S?>h+?^2gzX65oG7RGNr-BuzXae}#LayDy)lf;^U99Tm9sce~2(EAu7?;AlV? z7NRjj58?as(IsQFVq`oai=~eR9N(XhUN~M-K8zEF-B-Q4=-=FzaxWtaw-I)~S}YJ< zCobWd;YHp-v|Re03}3ZJA3|z4dIj|k&E||BnP#hTl)k<&dw%2G3zt4xUl6)j`6xVVOpzb*)P3c- z_#37qCAg%Xn-Y8^{uM?prYY$idCo}Vv;4YZz87GA7DiWG93S7W7Z1b_2iPai#Z7ne zlA@**5DM4s5PP$1DWN8cu@5)D|+ivoEW(+BwehEB&!IOo&gQ*@5gfX(H*vZFJ zw(ZjHG&?8BE<;w(g^EG1*k>Ny_id+Rv)Mh~+i6O8!YkcrbCWW|DKX7wNoCH?pK&zpK1XqpG8ZKb(aK$jGAUQdDa`jN%y?*QTJ!et6As4SbW8$&Jr3F0$Dvwz zK>{+FQy$xD9hV}0Kb6hQW3Qfq;w46GEU*{rs8k}{sB{SBH@oMK*_>ZqoU5fQtLKT) zkD_8pD5J<@8|__7x{u5t#tJ__KeKV`xvtNB_z^9ZKm9T45B_WzaaPE=bs_PT?K{mW0U7+4|>m|j1gw&l?#)Q?_^bqT`g{$`OWgm-wxl?qOeDdS1#tl>1|!JSBa zc1MtQchkT>Zp68WiL4n{eczi2y5BHW|osjPhL0#gUZH4?^>l|7#cnGJp9$I}BtFj{B&z1OhiYRw=s?BKMg+_t1<4 z$ls@Tho3&|)r}cO@c<=u%KOQ&4a1pl&9h-mU=k7C`+kLcJU$t3$n92O&>HhoB z1~6xY6~OE$7>WZ71sIA}NKbKbyO@k~F+jbRP}i7@TPiYc0U6hfjK87YqA~Do1-G$* z+h~^X>&Ips6`OH@&1eShx)XO(#b3-f@|OdzxV!_Xza##l71UE}RI6S5z^KZjQON4= z73#1?RjyHw3zw)s)wN(Vbw|3bBJMU2_c}sdD{!Z%x>HDB9Dp`F8a)UwJ1R2n02v1| zt`*c%dAqp6Qi6VWpv3b2p$?CT)SCjj#hU`UkmEG~J``Nkn*xd}F0c&MVi^hy=ED|emve$(HRHmjAr15C98tKm~SL7uw>PUz-R?^OGQ~Mpe&kYbztWT0%HS# zsUy_20(Yv|*ea|w!XB5}KwIN1ZmF`k1zB7(s6%m4S$}C2mS6T}_%6Wy{lmU~&{&A2tzzvquy)OWUq7C1 zDjtQJKv?wR>9EsWS&1nw#K7`Y2iQX$CP`k3Svwa4)N2X#x@7p|a@B$5s%EUc?m6C4 zEl@33plSy7x@UD;!P{-Uc)R(Z1Hd?Z3giER>LgdOfveOpfolbBN3{ZVU(B!V1K1AmmkKaeaRCO_sP&=lT7lb9ksAld%>iZge}vp<1$XwSYSU_OvNMP#1)su9_20C*g1QP&*9_|Q19zvTSYC?F=)3P=wA&6;On{pl z2By<%%wnp|#Q^8Sf3y#4O!aPbv+(IBFqQf+6^)_psB*jmIUaJnR!~n>4y|_K!~FeO zT@ZbEn*ZLh4%=ANl^3VD@&ZX-2jJH)ty?N^TL5m&zzSJiy+_L_<}+1*4|GN&;A;i- zbS1J?T#1Cjx()>ys6?t?cVwOF94Lwo6s30c z^F%|ql?f5QrqDRYQ?&Bgz4sjtSs1-eIukKm?K+qe<1>jdAP^$nI(>`i%nSO__{h(L zc&t_e!=2qVNf*TVQV#I2$~$1$&Es~~2d=sG!P@vBHFs{92{%#$nloW?9hmjND9q8_VGj{h|u`Bq9LK11(Q6=zdSA7OZmbcOZDp} z8HaY~PeTU#yL*_B85=GvGbPW1$Y0^nddY{b!xO_DLGA)AV;t}fdu_CGHirBnN*J(| z25yPF@^J|hj?%=4xTJ&uJ2ueH88|0F6%Xt<=j^BPyHYU1xV0jZ(Wk|aFhs122 zRB-7e@6tLzrLM{@H1Rk1WSKdqt_XRoGSZfnPeg?HRV?Jw;YSioy;+5k$=FZ~jZ?)d zC!eJ6&IeU2IrxO&GNzN-xWL^cUrNX#OzTNm`=fim51;!mNLn!QGBY%fm z`P9Gz`w3S9uAR>gzu(@JytXaj$_Mjr9%U=OaQj|mqAjp9q-27_DjCx*$O|0E_v=bV z3gX#YREY+=h;{_7CrE7-NAhN_r&apr^TGfJr2=YuCHc%CscfYI%^N96qP7EsOVOOrTvumQLt=G3t zPWw(gD@#$a+VN@M?(SD>akb8VHIu9DKdIF@?OP{%)wpX`d#_gew7=J}LHl&D-+Slu zQ<3ipQFh4X%6E=2yFqKRV#bIpMZxE+(N8XGBQ4_d^lXgyk{rv`@dpkGc^Cmh9P*6! z;Nyjah9zop%atfhh^73CNJ8J$F;IKdEV;x zgYX&CJK2DPkmsZ)kFBNP##?wSl%I!~PWki{A5b!*NFHP^Yl1n`_DC3u<0ZTpl31`k z77i|bv=+18%18XNrpOO*RAa>7FeNF$CH35tfREW#6!R%5AG(Y*KFhBwCaQ(}ER3$W zI6l5#FCK^=4zMrAyr?NEzr{_dOZ|)%xOah9p6_E@US}jq1txmoe)c}Zb9sE2(cnHO zHN;_3;~OE1p4Bv?KdBXok~%}`1x(a{1cAs`nq}c9kr`q+BTHjQcvn6w-FDM#iCc@O zvVb&Mq$`0@j|W-gtk%gFHP20#cBk1nNp=~sf-W>FdRFT*k8b?7)3Mp?9`EfmC4`ml zw7E%{;f$frBg|k?tS&L-fx!4w&@gtN#VRmg3Vaf++=VAG3lx?2=KB<8JT^A1dHeVY z2V-wKCV{^mhf(cSt-K%snan9!V6~1*5x<|xX6CV1PeJh#BQ_S;i*-~g5pGmEvJ~x( z*_>ZqJn?7B)3Kf>Mn8%Qv67?6V;k*VOS+FtA%;xdJi&UdE0X7rXtDh1k5PZ{C!f4! zTFAL|A@P*$I^?(Cko|}K%TKQuSRxLXUcV)Mlt-zVM-}V4ry4nAR@yEAZ^(d60~$R- zO7oLfp7UggOyN@xGxgNNEc4Jq6=vox$jmB_JTh(q*{mJebbxFE*#xo)WE03HkWC<) yKsJGF{`+JzaTtwb)aT3fIbz6=BaGb + + + + + + + + + + + + + + + + +]> + + + Grid Reality And Simulation Reference Manual + + + + GRAS user manual + &overview; + + &gras-DataDesc; + &gras-Socks; + &gras-Messages; + &gras-Globals; + + + + + + + GRAS toolbox + &gras-err; + &gras-log; + &gras-dynar; + &gras-dico; + &gras-cfg; + + + + GRAS implementation + &gras-gras-private; + &gras-gras-rl; + &gras-gras-sg; + + diff --git a/cruft/doc/gras-overview.fig b/cruft/doc/gras-overview.fig new file mode 100644 index 0000000000..8f3ac8bdee --- /dev/null +++ b/cruft/doc/gras-overview.fig @@ -0,0 +1,187 @@ +#FIG 3.2 +Landscape +Center +Metric +A4 +100.00 +Single +-2 +1200 2 +6 8797 2835 9877 3150 +4 1 0 40 -1 2 13 0.0000 6 135 1005 9336 2970 Conditional\001 +4 1 0 40 -1 2 13 0.0000 6 135 810 9336 3150 execution\001 +-6 +6 7605 3465 8370 3690 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 7 0 0 5 + 7620 3465 8340 3465 8340 3690 7620 3690 7620 3465 +4 1 0 40 -1 0 12 0.0000 6 120 75 7979 3645 ?\001 +-6 +6 8640 3330 10035 3555 +6 9360 3330 10035 3555 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 9360 3330 10035 3330 10035 3555 9360 3555 9360 3330 +4 1 0 40 -1 0 12 0.0000 6 120 465 9720 3502 Simul.\001 +-6 +6 8640 3330 9315 3555 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 8640 3330 9315 3330 9315 3555 8640 3555 8640 3330 +4 1 0 40 -1 0 12 0.0000 6 165 495 8977 3502 Reality\001 +-6 +-6 +6 3510 4365 4320 4635 +2 2 0 1 0 7 50 -1 17 0.000 0 0 -1 0 0 5 + 3510 4365 4320 4365 4320 4635 3510 4635 3510 4365 +4 1 0 40 -1 0 12 0.0000 6 165 360 3915 4545 Logs\001 +-6 +6 9135 4230 9945 4770 +6 9135 4230 9945 4500 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 9135 4230 9945 4230 9945 4500 9135 4500 9135 4230 +4 1 0 40 -1 0 12 0.0000 6 120 600 9540 4410 Forecast\001 +-6 +6 9135 4500 9945 4770 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 9135 4500 9945 4500 9945 4770 9135 4770 9135 4500 +4 1 0 40 -1 0 12 0.0000 6 120 495 9540 4680 RRDB\001 +-6 +-6 +6 4455 4365 5265 4635 +2 2 0 1 0 7 50 -1 17 0.000 0 0 -1 0 0 5 + 4455 4365 5265 4365 5265 4635 4455 4635 4455 4365 +4 1 0 40 -1 0 12 0.0000 6 120 450 4860 4545 Errors\001 +-6 +6 5400 4365 6210 4635 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 5400 4365 6210 4365 6210 4635 5400 4635 5400 4365 +4 1 0 40 -1 0 12 0.0000 6 165 540 5805 4545 Config.\001 +-6 +6 6345 4365 7155 4635 +2 2 0 1 0 7 50 -1 17 0.000 0 0 -1 0 0 5 + 6345 4365 7155 4365 7155 4635 6345 4635 6345 4365 +4 1 0 40 -1 0 12 0.0000 6 120 420 6750 4545 Dicos\001 +-6 +6 7290 4365 8100 4635 +2 2 0 1 0 7 50 -1 17 0.000 0 0 -1 0 0 5 + 7290 4365 8100 4365 8100 4635 7290 4635 7290 4365 +4 1 0 40 -1 0 12 0.0000 6 165 495 7695 4545 Arrays\001 +-6 +6 8235 4365 9045 4635 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 8235 4365 9045 4365 9045 4635 8235 4635 8235 4365 +4 1 0 40 -1 0 12 0.0000 6 120 480 8640 4545 Hooks\001 +-6 +6 6240 3465 6390 3497 +1 3 0 1 0 0 50 -1 20 0.000 1 0.0000 6315 3481 9 9 6315 3481 6324 3481 +1 3 0 1 0 0 50 -1 20 0.000 1 0.0000 6256 3481 9 9 6256 3481 6265 3481 +1 3 0 1 0 0 50 -1 20 0.000 1 0.0000 6374 3481 9 9 6374 3481 6383 3481 +-6 +6 5400 3330 6030 3600 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 5418 3330 6011 3330 6011 3600 5418 3600 5418 3330 +4 1 0 40 -1 0 12 0.0000 6 120 405 5714 3527 XML\001 +-6 +6 3465 3015 6660 3285 +2 2 0 1 0 7 50 -1 17 0.000 0 0 -1 0 0 5 + 3465 3015 6660 3015 6660 3285 3465 3285 3465 3015 +4 1 0 40 -1 0 12 0.0000 6 165 1485 5062 3207 Message dispatching\001 +-6 +6 5445 3645 6660 3915 +6 5445 3645 6255 3870 +2 2 0 1 0 7 50 -1 17 0.000 0 0 -1 0 0 5 + 5453 3645 6232 3645 6232 3870 5453 3870 5453 3645 +4 1 0 40 -1 0 12 0.0000 6 120 615 5842 3817 SimGrid\001 +-6 +6 6255 3645 6660 3915 +2 2 0 1 0 7 50 -1 17 0.000 0 0 -1 0 0 5 + 6284 3647 6644 3647 6644 3872 6284 3872 6284 3647 +4 1 0 40 -1 0 12 0.0000 6 120 270 6464 3819 File\001 +-6 +-6 +6 5220 3735 5370 3767 +1 3 0 1 0 0 50 -1 20 0.000 1 0.0000 5295 3751 9 9 5295 3751 5304 3751 +1 3 0 1 0 0 50 -1 20 0.000 1 0.0000 5236 3751 9 9 5236 3751 5245 3751 +1 3 0 1 0 0 50 -1 20 0.000 1 0.0000 5354 3751 9 9 5354 3751 5363 3751 +-6 +6 4050 3600 4590 3870 +6 4050 3600 4590 3870 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 4079 3641 4550 3641 4550 3866 4079 3866 4079 3641 +-6 +4 1 0 40 -1 0 12 0.0000 6 120 375 4314 3813 UDP\001 +-6 +6 4635 3600 5175 3870 +6 4635 3600 5175 3870 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 4664 3641 5135 3641 5135 3866 4664 3866 4664 3641 +-6 +4 1 0 40 -1 0 12 0.0000 6 120 345 4899 3813 SSH\001 +-6 +2 4 0 1 0 7 50 -1 -1 0.000 0 0 7 0 0 5 + 10125 1800 10125 1215 3375 1215 3375 1800 10125 1800 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 3060 2025 3060 4815 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 3060 1800 3060 1215 +2 4 0 1 0 7 50 -1 -1 0.000 0 0 7 0 0 5 + 10125 2655 10125 2070 3375 2070 3375 2655 10125 2655 +2 2 0 1 0 7 50 -1 17 0.000 0 0 -1 0 0 5 + 8550 2250 9855 2250 9855 2520 8550 2520 8550 2250 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 4815 2250 6075 2250 6075 2520 4815 2520 4815 2250 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 6232 2250 6772 2250 6772 2520 6232 2520 6232 2250 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 6930 2250 8415 2250 8415 2520 6930 2520 6930 2250 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 8550 1395 9360 1395 9360 1665 8550 1665 8550 1395 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 7425 1395 8235 1395 8235 1665 7425 1665 7425 1395 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 6300 1395 7110 1395 7110 1665 6300 1665 6300 1395 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 5175 1395 5985 1395 5985 1665 5175 1665 5175 1395 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 4050 1395 4860 1395 4860 1665 4050 1665 4050 1395 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 7 0 0 5 + 3645 2250 4680 2250 4680 2520 3645 2520 3645 2250 +2 4 0 1 0 7 50 -1 -1 0.000 0 0 7 0 0 5 + 10125 4860 10125 4140 3375 4140 3375 4860 10125 4860 +2 4 0 1 0 7 50 -1 -1 0.000 0 0 7 0 0 5 + 8460 3780 8460 2790 6840 2790 6840 3780 8460 3780 +2 4 0 1 0 7 50 -1 -1 0.000 0 0 7 0 0 5 + 10125 3780 10125 2790 8505 2790 8505 3780 10125 3780 +2 4 0 1 0 7 50 -1 -1 0.000 0 0 7 0 0 5 + 6750 3960 6750 2790 3375 2790 3375 3960 6750 3960 +2 2 0 1 0 7 50 -1 17 0.000 0 0 -1 0 0 5 + 3465 3641 3936 3641 3936 3866 3465 3866 3465 3641 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 3465 3330 5265 3330 5265 3600 3465 3600 3465 3330 +2 2 0 1 0 7 40 -1 -1 0.000 0 0 7 0 0 5 + 6946 3195 7540 3195 7540 3420 6946 3420 6946 3195 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 7 0 0 5 + 7620 3195 8340 3195 8340 3420 7620 3420 7620 3195 +2 2 0 1 0 7 40 -1 -1 0.000 0 0 7 0 0 5 + 6946 3465 7540 3465 7540 3690 6946 3690 6946 3465 +4 1 0 40 -1 2 13 0.0000 6 135 1440 4522 2970 Communications\001 +4 1 0 40 -1 2 13 1.5708 6 135 525 2970 3330 GRAS\001 +4 1 0 40 -1 2 13 1.5708 6 135 615 2970 1530 AMOK\001 +4 1 0 40 -1 2 13 1.5708 6 135 405 3285 3375 Base\001 +4 1 0 40 -1 2 13 1.5708 6 135 720 3285 2385 Modules\001 +4 1 0 40 -1 0 12 0.0000 6 165 1275 7694 2445 Host management\001 +4 1 0 40 -1 0 12 0.0000 6 120 435 6501 2445 Locks\001 +4 1 0 40 -1 0 12 0.0000 6 120 1065 5444 2445 Leader election\001 +4 1 0 40 -1 0 12 0.0000 6 165 900 4162 2445 Logs control\001 +4 1 0 40 -1 0 12 0.0000 6 120 1065 9202 2445 Bandwidth test\001 +4 1 0 40 -1 0 12 0.0000 6 120 615 8954 1590 ALNeM\001 +4 1 0 40 -1 0 12 0.0000 6 120 450 7830 1590 APST\001 +4 1 0 40 -1 0 12 0.0000 6 120 300 6705 1590 GIS\001 +4 1 0 40 -1 0 12 0.0000 6 120 300 5580 1590 PKI\001 +4 1 0 40 -1 0 12 0.0000 6 120 405 4454 1590 NWS\001 +4 1 0 40 -1 2 13 0.0000 6 180 675 7649 2970 Syscalls\001 +4 1 0 40 -1 2 13 0.0000 6 135 1170 7650 3150 virtualization\001 +4 1 0 40 -1 0 12 0.0000 6 120 420 7230 3367 Linux\001 +4 1 0 40 -1 0 12 0.0000 6 120 615 7979 3367 SimGrid\001 +4 1 0 40 -1 0 12 0.0000 6 120 495 7242 3637 Solaris\001 +4 1 0 40 -1 2 13 1.5708 6 135 420 3285 4500 Core\001 +4 1 0 40 -1 0 12 0.0000 6 120 330 3729 3813 TCP\001 +4 1 0 40 -1 0 12 0.0000 6 165 1575 4365 3527 Binary Representation\001 diff --git a/cruft/doc/gras-sections.txt b/cruft/doc/gras-sections.txt new file mode 100644 index 0000000000..a82a2328f5 --- /dev/null +++ b/cruft/doc/gras-sections.txt @@ -0,0 +1,325 @@ +
+core_err +Errors +gras_error_t +gras_error_name +
+ +
+core_log +logging +gras_log_priority_t + +gras_log_control_set + +GRAS_LOG_NEW_CATEGORY +GRAS_LOG_NEW_SUBCATEGORY +GRAS_LOG_NEW_DEFAULT_CATEGORY +GRAS_LOG_NEW_DEFAULT_SUBCATEGORY + +GRAS_LOG_DEFAULT_CATEGORY +GRAS_LOG_EXTERNAL_CATEGORY + +GRAS_LOG_ISENABLED +GRAS_LOG_STATIC_THRESHOLD + +gras_log_appender_set +gras_log_default_appender + +CDEBUG6 +CVERB6 +CINFO6 +CWARNING6 +CERROR6 +CCRITICAL6 + + +DEBUG6 +VERB6 +INFO6 +WARNING6 +ERROR6 +CRITICAL6 + + +GRAS_LOG_ROOT_CAT +gras_log_parent_set +gras_log_threshold_set + +CLOG0 +CLOG1 +CLOG2 +CLOG3 +CLOG4 +CLOG5 +CLOG6 +CDEBUG0 +CDEBUG1 +CDEBUG2 +CDEBUG3 +CDEBUG4 +CDEBUG5 +CVERB0 +CVERB1 +CVERB2 +CVERB3 +CVERB4 +CVERB5 +CINFO0 +CINFO1 +CINFO2 +CINFO3 +CINFO4 +CINFO5 +CWARNING0 +CWARNING1 +CWARNING2 +CWARNING3 +CWARNING4 +CWARNING5 +CERROR0 +CERROR1 +CERROR2 +CERROR3 +CERROR4 +CERROR5 +CCRITICAL0 +CCRITICAL1 +CCRITICAL2 +CCRITICAL3 +CCRITICAL4 +CCRITICAL5 + +LOG0 +LOG1 +LOG2 +LOG3 +LOG4 +LOG5 +LOG6 +DEBUG0 +DEBUG1 +DEBUG2 +DEBUG3 +DEBUG4 +DEBUG5 +VERB0 +VERB1 +VERB2 +VERB3 +VERB4 +VERB5 +INFO0 +INFO1 +INFO2 +INFO3 +INFO4 +INFO5 +WARNING0 +WARNING1 +WARNING2 +WARNING3 +WARNING4 +WARNING5 +ERROR0 +ERROR1 +ERROR2 +ERROR3 +ERROR4 +ERROR5 +CRITICAL0 +CRITICAL1 +CRITICAL2 +CRITICAL3 +CRITICAL4 +CRITICAL5 + +GRAS_LOG_MAYDAY + +
+ +
+core_dynar +gras_dynar_new +gras_dynar_free +gras_dynar_free_container +gras_dynar_length +gras_dynar_reset +gras_dynar_get +gras_dynar_set +gras_dynar_remplace +gras_dynar_insert_at +gras_dynar_remove_at +gras_dynar_map +gras_dynar_push +gras_dynar_pop +gras_dynar_shift +gras_dynar_unshift +gras_dynar_foreach +
+ +
+core_dico +gras_dict_free +gras_dict_insert +gras_dict_retrieve +gras_dict_remove +gras_dict_dump +gras_dict_print +gras_dict_prints +gras_dict_cursor_new +gras_dict_cursor_free +gras_dict_cursor_next +gras_dict_cursor_rewind +gras_dict_cursor_get_data +gras_dict_cursor_get_key +
+ +
+core_cfg +gras_cfg_new +gras_cfg_cpy +gras_cfg_free +gras_cfg_dump + +gras_cfg_register +gras_cfg_register_str +gras_cfg_check + +gras_cfg_set_parse +gras_cfg_set +gras_cfg_set_vargs + +gras_cfg_set_int +gras_cfg_set_double +gras_cfg_set_string +gras_cfg_set_host + +gras_cfg_rm_int +gras_cfg_rm_double +gras_cfg_rm_string +gras_cfg_rm_host +gras_cfg_empty + +gras_cfg_get_int +gras_cfg_get_double +gras_cfg_get_string +gras_cfg_get_host +gras_cfg_get_dynar + + +gras_cfgelm_type_t +gras_cfg_get_type +
+ + + + + + + + + + +
+DataDesc +DataDescriptor +DataTypes +SIMPLE_DATA +SIMPLE_MEMBER +PAD_BYTES +
+ +
+Socks +Sockets +gras_sock_client_open +gras_sock_server_open +gras_sock_close +gras_sock_get_peer_name +gras_sock_get_peer_addr +
+ +
+Messages +Messages +gras_msgtype_register +gras_cb_t +gras_cb_register +gras_msg_new +gras_msg_free +gras_msg_handle +gras_msg_send +gras_msg_wait +
+ +
+Globals +Globals +gras_userdata_get +gras_userdata_set +gras_userdata_new +
+ +
+gras_private +gras_lock +gras_unlock +gras_msg_discard +FormatTypes +gras_datadesc_cmp +SIMPLE_TYPE_COUNT +
+ +
+gras_rl +Real life specific stuff +grasMsgRecv +ConvertData +DataSize +DifferentFormat +DifferentOrder +DifferentSize +HomogenousConvertData +HomogenousDataSize +ReverseData + +headerDescriptorCount +countDescriptorCount +PEER_NAME_LEN +
+ +
+gras_sg +CloseSocket +
+ + + + + +
+cruft +Cruft to ignore in the documentation + +BEGIN_DECL +END_DECL +PACKAGE +PACKAGE_BUGREPORT +PACKAGE_NAME +PACKAGE_STRING +PACKAGE_TARNAME +PACKAGE_VERSION +VERSION +HAVE_UNISTD_H +HAVE_STDLIB_H +HAVE_DLFCN_H +HAVE_STDINT_H +HAVE_STRING_H +HAVE_STRINGS_H +HAVE_MEMORY_H +HAVE_SYS_STAT_H +HAVE_INTTYPES_H +HAVE_SYS_TYPES_H +STDC_HEADERS +
diff --git a/cruft/doc/overview.sgml b/cruft/doc/overview.sgml new file mode 100644 index 0000000000..2f757b3488 --- /dev/null +++ b/cruft/doc/overview.sgml @@ -0,0 +1,109 @@ + + +Overview +3 +GRAS Library + + + +OverviewOverview on the GRAS library + + + +Introduction +This document introduce the GRAS library (Grid Reality And + Simulation, or according to my english dictionary, + Generally Recognized As Safe ;). + +Here are the problems when you want to do so: + + + Communication in SG is done by passing tasks, while in + RL, you have to deal with sockets (or any wrapper to it). + + In RL, each process should provide a main() + function, and it's obviously not the case in SG. + + + + + + + Application class target + If you want to run your code both in RL and in SG, you won't be + able to use the full set of features offered by any of those two + worlds. GRAS tries to provide a suffisent set of features to develop + your application, and implement them in both worlds. + + GRAS uses the paradigm of event-driven + programming, which is an extension to the message-passing + one. Any process of a typical event-driven application declares + callback to incoming events, which can be messages from other + processes, timers or others. + + All messages have an header, specifying its type, and attached + data, represented as one or several C structures. In order to send the + data over the network in RL, a type-description mecanism is provided, and + the RL version of GRAS implements XDR functionnalities. That is to say + that the data are converted to a intermediate representation before being + sent. A possible extension would be to use CDR, where data are sent in + the native format of the sender host, and converted on the destination + host only if needed, but this is still to do. + + In order to not reimplement the wheel, GRAS use existing code, and + adapt them to make them work together. The SG version naturally use the + SimGrid toolkit, while the RL version is based over the communication + library used in NWSOnly the actual sending/receiving + features and formattypes features were taken from NWS. GRAS messaging + stuff is quite different from the NWS one, which was not easily adaptable + in SG as is.. That's why we will now present the NWS + project in order to give you a better understanding of its internals used + here. + + + + The Network Weather Service and its "portability" library + + The purpose of the NWS project is to provide any kind of usefull + information about the availability of a Grid platform. like the CPU load, + free memory and disk of all hosts, the bandwidth and latency between each + host pair, and so on. It is also able to predict the future trend of each + value by applying some statistical treatement to the measurements. + + In order to achieve this goal, the NWS system is composed of four + kind of processes: + + Sensors: those process are in charge or realizing the + actual measurement needed by the system. + + Memory servers: they store on disk the result of the experiments + conducted by the sensors for a later use. + + Forecasters: when a client application asks to, the + forecasters retrieves the measurements from the memory servers, apply + the needed statistical treatement, and then inform the client of the + predicted variations. + + NameServer: Every process in the NWS system have to + register itself to the nameserver, so that any process looks for another + element, it can find the answer by asking to the nameserver. + + + As you can see, this system is distributed by nature, and its + authors builded a specific toolbox they call the portability library. It + contains a great quantity of cool stuff to do various kind of things. The + main part is a very high level messaging library, where processes declare + callbacks to strongly typed messages sent from other processes. + + One of the limitation of this system is that even if processes can + ear to several sockets, all messages received from the different sources + are mixed together and handled by the same control loop. GRAS inherit + this limitation, but in fact, we don't think that it's really limitating, + thanks to the fact that messages are strongly typed. + + The philosophy of this library constitues the heart of GRAS, which + actually provide the same kind of features. + + + + diff --git a/cruft/doc/tmpl/DataDesc.sgml b/cruft/doc/tmpl/DataDesc.sgml new file mode 100644 index 0000000000..1dd8f0f0cd --- /dev/null +++ b/cruft/doc/tmpl/DataDesc.sgml @@ -0,0 +1,180 @@ + +DataDescriptor API + + +Describing the data + + +In order to allow GRAS to send data over the network (or simply to +dupplicate it in SG), you have to describe the structure of data attached +with each message. This mecanism is stolen from NWS message passing +interface. + +For each message, you have to declare a structure representing the +data to send as payload with the message. + + + Sending (or receiving) simple structures + Let's imagin you want to declare a STORE_STATE + message, which will send some data to the memory server for inclusion in + the database. Here is the structure we want to send: + + + struct state { + char id[STATE_NAME_SIZE]; + int rec_size; + int rec_count; + double seq_no; + double time_out; + }; + + + And here is the structure description GRAS needs to be able to send + this over the network: + + + const static DataDescriptor stateDescriptor[] = + {SIMPLE_MEMBER(CHAR_TYPE, STATE_NAME_SIZE, offsetof(struct state, id)), + SIMPLE_MEMBER(INT_TYPE, 1, offsetof(struct state, rec_size)), + SIMPLE_MEMBER(INT_TYPE, 1, offsetof(struct state, rec_count)), + SIMPLE_MEMBER(DOUBLE_TYPE, 1, offsetof(struct state, seq_no)), + SIMPLE_MEMBER(DOUBLE_TYPE, 1, offsetof(struct state, time_out))}; + + + Contrary to what one could think when you first see it, it's pretty + easy. A structure descriptor is a list of descriptions, describing each + field of the structure. For example, for the first field, you say that + the base type is CHAR_TYPE, that there is + STATE_NAME_SIZE element of this type and that it's + position in the structure is computed by offsetof(struct state, + id). This leads to two remarks: + + + + it's impossible to send dynamic sized strings that way. It's a + known limitation, but I think we can live with it. + + + Yes, the offsetof(struct state, id) + construction is C ANSI and is portable. + + + + + + Sending (or receiving) complex structure + How to send non-flat structures, do you ask? It's not harder. Let's + imagin you want to send the following structure: + + + typedef struct { + unsigned long address; + unsigned long port; + } CliqueMember; + + typedef struct { + char name[MAX_CLIQUE_NAME_SIZE]; + double whenGenerated; + double instance; + char skill[MAX_SKILL_SIZE]; + char options[MAX_OPTIONS_SIZE]; + double period; + double timeOut; + CliqueMember members[MAX_MEMBERS]; + unsigned int count; + unsigned int leader; + } Clique; + + + As you can see, this structure contains an array of another user + defined structure. To be able to send struct Clique, + you have to describe each structures that way: + + + static const DataDescriptor cliqueMemberDescriptor[] = + {SIMPLE_MEMBER(UNSIGNED_LONG_TYPE, 1, offsetof(CliqueMember, address)), + SIMPLE_MEMBER(UNSIGNED_LONG_TYPE, 1, offsetof(CliqueMember, port))}; + + static const DataDescriptor cliqueDescriptor[] = + {SIMPLE_MEMBER(CHAR_TYPE, MAX_CLIQUE_NAME_SIZE, offsetof(Clique, name)), + SIMPLE_MEMBER(DOUBLE_TYPE, 1, offsetof(Clique, whenGenerated)), + SIMPLE_MEMBER(DOUBLE_TYPE, 1, offsetof(Clique, instance)), + SIMPLE_MEMBER(CHAR_TYPE, MAX_SKILL_SIZE, offsetof(Clique, skill)), + SIMPLE_MEMBER(CHAR_TYPE, MAX_OPTIONS_SIZE, offsetof(Clique, options)), + SIMPLE_MEMBER(DOUBLE_TYPE, 1, offsetof(Clique, period)), + SIMPLE_MEMBER(DOUBLE_TYPE, 1, offsetof(Clique, timeOut)), + {STRUCT_TYPE, MAX_MEMBERS, offsetof(Clique, members), + (DataDescriptor *)&cliqueMemberDescriptor, cliqueMemberDescriptorLength, + PAD_BYTES(CliqueMember, port, unsigned long, 1)}, + SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(Clique, count)), + SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(Clique, leader))}; + + + So, even if less natural, it is possible to send structures + containing structures with these tools. + + You can see that it's not only impossible to send dynamic-sized + strings, it impossible to send dynamic-sized arrays. Here, + MAX_MEMBERS is the maximum of members a clique can + contain. In NWS, this value is defined to 100. I'm not + sure, but I think that all the 100 values are sent each time, even if + there is only 3 non-null members. Yes, that's + bad. + + The DataDescriptor_t MUST be const. Malloc'ing them and + then casting them on argument passing IS NOT OK. This is because we get + the number of elements in the array with the sizeof(dd)/sizeof(dd[0]). + + + + + + + + + + + + + +@CHAR_TYPE: +@DOUBLE_TYPE: +@FLOAT_TYPE: +@INT_TYPE: +@LONG_TYPE: +@SHORT_TYPE: +@UNSIGNED_INT_TYPE: +@UNSIGNED_LONG_TYPE: +@UNSIGNED_SHORT_TYPE: +@STRUCT_TYPE: + + + + + + +@type: +@repetitions: + + + + + + + +@type: +@repetitions: +@offset: + + + + + + + +@structType: +@lastMember: +@memberType: +@repetitions: + + diff --git a/cruft/doc/tmpl/Globals.sgml b/cruft/doc/tmpl/Globals.sgml new file mode 100644 index 0000000000..a0a65ae147 --- /dev/null +++ b/cruft/doc/tmpl/Globals.sgml @@ -0,0 +1,43 @@ + +Globals API + + +Handling globals + + +In GRAS, using globals is forbidden since the daemons will +sometimes run as a thread inside the same process. So, you have to put +all globals in a structure, and tell GRAS that it's your globals. + +Use the grasUserdataNew() macro to create a new user data (or malloc it +yourself and use grasUserdataSet yourself), and grasUserdataGet() to +retrive a reference to it. + + + + + + + + + + + + + + + + + + +@ud: + + + + + + + +@type: + + diff --git a/cruft/doc/tmpl/Messages.sgml b/cruft/doc/tmpl/Messages.sgml new file mode 100644 index 0000000000..23582ef6de --- /dev/null +++ b/cruft/doc/tmpl/Messages.sgml @@ -0,0 +1,99 @@ + +Messages API + + +High level messages + + + + + + + + + + + + + + + + +@msgId: +@name: +@sequence_count: +@Varargs: +@Returns: + + + + + + + +@msg: +@Returns: + + + + + + + +@message: +@TTL: +@cb: +@Returns: + + + + + + + +@msgId: +@free_data_on_free: +@seqCount: +@Varargs: +@Returns: + + + + + + + +@msg: + + + + + + + +@timeOut: +@Returns: + + + + + + + +@sd: +@msg: +@freeDirective: +@Returns: + + + + + + + +@timeout: +@id: +@message: +@Returns: + + diff --git a/cruft/doc/tmpl/Socks.sgml b/cruft/doc/tmpl/Socks.sgml new file mode 100644 index 0000000000..2cfaaaff29 --- /dev/null +++ b/cruft/doc/tmpl/Socks.sgml @@ -0,0 +1,65 @@ + +Sockets API + + +Handling sockets + + + + + + + + + + + + + + + + +@host: +@Param2: +@sock: +@Returns: + + + + + + + +@Param1: +@Param2: +@sock: +@Returns: + + + + + + + +@sock: +@Returns: + + + + + + + +@sd: +@Returns: + + + + + + + +@sd: +@Returns: + + diff --git a/cruft/doc/tmpl/core_cfg.sgml b/cruft/doc/tmpl/core_cfg.sgml new file mode 100644 index 0000000000..57ab241914 --- /dev/null +++ b/cruft/doc/tmpl/core_cfg.sgml @@ -0,0 +1,215 @@ + +Config + + +Configuration facilities. + + + + + + + + + + + + + + + + +@whereto: +@Returns: + + + + + + + +@whereto: +@tocopy: +@Returns: + + + + + + + +@cfg: + + + + + + + +@name: +@indent: +@cfg: + + + + + + + +@cfg: +@name: +@type: +@min: +@max: +@Returns: + + + + + + + +@cfg: +@entry: +@Returns: + + + + + + + +@cfg: +@Returns: + + + + + + + +@cfg: +@options: +@Returns: + + + + + + + +@cfg: +@Varargs: +@Returns: + + + + + + + +@cfg: +@pa: +@Returns: + + + + + + + +@cfg: +@name: +@val: +@Returns: + + + + + + + +@cfg: +@name: +@val: +@Returns: + + + + + + + +@cfg: +@name: +@val: +@Returns: + + + + + + + +@cfg: +@name: +@host: +@port: +@Returns: + + + + + + + +@cfg: +@name: +@val: +@Returns: + + + + + + + +@cfg: +@name: +@val: +@Returns: + + + + + + + +@cfg: +@name: +@val: +@Returns: + + + + + + + +@cfg: +@name: +@host: +@port: +@Returns: + + + + + + + +@cfg: +@name: +@Returns: + + diff --git a/cruft/doc/tmpl/core_dico.sgml b/cruft/doc/tmpl/core_dico.sgml new file mode 100644 index 0000000000..c91fa78369 --- /dev/null +++ b/cruft/doc/tmpl/core_dico.sgml @@ -0,0 +1,143 @@ + +Dictionnary + + +Data container associating data to a string key. + + + + + + + + + + + + + + + + +@dict: + +@Returns: + + + + + + + +@head: +@key: +@data: +@free_ctn: +@Returns: + + + + + + + +@head: +@key: +@data: +@Returns: + + + + + + + +@head: +@key: +@Returns: + + + + + + + +@head: +@output: +@Returns: + + + + + + + +@data: + + + + + + + +@data: + + + + + + + +@head: +@cursor: +@Returns: + + + + + + + +@cursor: + +@Returns: + + + + + + + +@cursor: +@Returns: + + + + + + + +@cursor: +@Returns: + + + + + + + +@cursor: +@data: +@Returns: + + + + + + + +@cursor: +@key: +@Returns: + + diff --git a/cruft/doc/tmpl/core_dynar.sgml b/cruft/doc/tmpl/core_dynar.sgml new file mode 100644 index 0000000000..1fa3503b48 --- /dev/null +++ b/cruft/doc/tmpl/core_dynar.sgml @@ -0,0 +1,198 @@ + +Dynamic array + + +Use arrays, forget about malloc + + + +This module provide the quite usual dynamic array facility. + + + + + + + + + + + + +@whereto: +@elm_size: +@free_func: +@Returns: + + + + + + + +@dynar: + +@Returns: + + + + + + + +@dynar: + +@Returns: + + + + + + + +@dynar: +@Returns: + + + + + + + +@dynar: + +@Returns: + + + + + + + +@dynar: +@idx: +@dst: + +@whereto: +@Returns: + + + + + + + +@dynar: +@idx: +@src: +@Returns: + +@object: + + + + + + + +@dynar: +@idx: +@object: +@Returns: + + + + + + + +@dynar: +@idx: +@src: +@Returns: + +@object: + + + + + + + +@dynar: +@idx: +@object: + +@Returns: + + + + + + + +@dynar: +@operator: + +@Returns: + + + + + + + +@dynar: +@src: +@Returns: + +@object: + + + + + + + +@dynar: +@dst: + +@whereto: + + + + + + + +@dynar: +@dst: + +@whereto: +@Returns: + + + + + + + +@dynar: +@src: +@Returns: + +@object: + + + + + + + +@_dynar: +@_cursor: +@_data: + +@_whereto: + + diff --git a/cruft/doc/tmpl/core_err.sgml b/cruft/doc/tmpl/core_err.sgml new file mode 100644 index 0000000000..7fb18f428c --- /dev/null +++ b/cruft/doc/tmpl/core_err.sgml @@ -0,0 +1,30 @@ + +Errors handling + + +Error reporting + + + + + + + + + + + + + + + + +@no_error: no error +@malloc_error: Well known error +@mismatch_error: Not found +@system_error: a syscall did fail +@network_error: error while sending/receiving data +@timeout_error: not quick enough, dude +@thread_error: error while [un]locking +@unknown_error: no idea + diff --git a/cruft/doc/tmpl/core_log.sgml b/cruft/doc/tmpl/core_log.sgml new file mode 100644 index 0000000000..0d6f869148 --- /dev/null +++ b/cruft/doc/tmpl/core_log.sgml @@ -0,0 +1,571 @@ + +Logging facilities + + +An easy-to-use, fast and flexible message logging architecture. + + + + This is an adaptation of the log4c project, which is dead upstream, and which + I was given the permission to fork under the LGPL licence by the authors. log4c + itself was loosely based on the Apache project's Log4J, Log4CC, + etc. project. Because C is not object oriented, a lot had to change. + + + + Overview + + + There is 3 main concepts: category, priority and appender. These three + concepts work together to enable developers to log messages according to + message type and priority, and to control at runtime how these messages are + formatted and where they are reported. + + + + + Category hierarchy + + + The first and foremost advantage of any logging API over plain printf() + resides in its ability to disable certain log statements while allowing + others to print unhindered. This capability assumes that the logging space, + that is, the space of all possible logging statements, is categorized + according to some developer-chosen criteria. + + + + This observation led to choosing category as the central concept of the + system. Every category is declared by providing a name and an optional + parent. If no parent is explicitly named, the root category, LOG_ROOT_CAT + is the category's parent. + + + + A category is created by a macro call at the top level of a file. A + category can be created with any one of the following macros: + + + + + @GRAS_LOG_NEW_CATEGORY(MyCat); + create a new root + + + + @GRAS_LOG_NEW_SUBCATEGORY(MyCat, ParentCat); + Create a new category being child of the category ParentCat + + + + @GRAS_LOG_NEW_DEFAULT_CATEGORY(MyCat); + Like GRAS_LOG_NEW_CATEGORY, but the new category is the default one + in this file + + + + @GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(MyCat, ParentCat); + Like GRAS_LOG_NEW_SUBCATEGORY, but the new category is the default one + in this file + + + + + The parent cat can be defined in the same file or in another file, but each + category may have only one definition. + + + + Typically, there will be a Category for each module and sub-module, so you + can independently control logging for each module. + + + + + Priority + + + A category may be assigned a threshold priorty. The set of priorites are + defined by the @gras_log_priority_t enum. Their values are DEBUG, VERBOSE, + INFO, WARNING, ERROR and CRITICAL. + + + + If a given category is not assigned a threshold priority, then it inherits + one from its closest ancestor with an assigned threshold. + + + + To ensure that all categories can eventually inherit a threshold, the root + category always has an assigned threshold priority. + + + + Logging requests are made by invoking a logging macro on a category. All + of the macros have a printf-style format string followed by arguments. + Because most C compilers do not support vararg macros, there is a version + of the macro for any number of arguments from 0 to 6. The macro name ends + with the total number of arguments. + + + + Here is an example of the most basic type of macro: + + + CLOG5(MyCat, gras_log_priority_warning, "Values are: %d and '%s'", 5, "oops"); + + This is a logging request with priority WARN. + + + A logging request is said to be enabled if its priority is higher than or + equal to the threshold priority of its category. Otherwise, the request is + said to be disabled. A category without an assigned priority will inherit + one from the hierarchy. + + + + It is possible to use any non-negative integer as a priority. If, as in the + example, one of the standard priorites is used, then there is a convenience + macro that is typically used instead. For example, the above example is + equivalent to the shorter: + + + CWARN4(MyCat, "Values are: %d and '%s'", 5, "oops"); + + + + Default category + + + If @GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(MyCat, Parent) or + @GRAS_LOG_NEW_DEFAULT_CATEGORY(MyCat) is used to create the category, then + the even shorter form can be used: + + + WARN3("Values are: %d and '%s'", 5, "oops"); + + + Only one default category can be created per file, though multiple + non-defaults can be created and used. + + + + + Example + + Here is a more complete example: + + + #include "gras.h" + + /* create a category and a default subcategory */ + GRAS_LOG_NEW_CATEGORY(VSS); + GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(SA, VSS); + + main() { + /* Now set the parent's priority. + (the string would typcially be a runtime option) */ + gras_log_control_set("SA.thresh=3"); + + /* This request is enabled, because WARNING >= INFO. */ + CWARN2(VSS, "Low fuel level."); + + /* This request is disabled, because DEBUG < INFO. */ + CDEBUG2(VSS, "Starting search for nearest gas station."); + + /* The default category SA inherits its priority from VSS. Thus, + the following request is enabled because INFO >= INFO. */ + INFO1("Located nearest gas station."); + + /* This request is disabled, because DEBUG < INFO. */ + DEBUG1("Exiting gas station search"); + } + + + + Configuration + + + Configuration is typically done during program initialization by invoking + the gras_log_control_set() method. The control string passed to it + typically comes from the command line. Look at the doucmentation for that + function for the format of the control string. + + + + + Performance + + + Clever design insures efficiency. Except for the first invocation, a + disabled logging request requires an a single comparison of a static + variable to a constant. + + + + There is also compile time constant, @GRAS_LOG_STATIC_THRESHOLD, which + causes all logging requests with a lower priority to be optimized to 0 cost + by the compiler. By setting it to gras_log_priority_infinite, all logging + requests are statically disabled and cost nothing. Released executables + might typically be compiled with + "-DGRAS_LOG_STATIC_THRESHOLD=gras_log_priority_infinite". + + + + + Appenders + + + Each category has an optional appender. An appender is a pointer to a + structure whcih starts with a pointer to a doAppend() function. DoAppend() + prints a message to a log. + + + + WHen a category is passed a message by one of the logging macros, the + category performs the following actions: + + + + + + if the category has an appender, the message is passed to the + appender's doAppend() function, + + + + + + if 'willLogToParent' is true for the category, the message is passed + to the category's parent. + + + + By default, all categories except root have no appender and + 'willLogToParent' is true. This situation causes all messages to be + logged by the root category's appender. + + + + Typically, you would only change the root category's appender when you + wanted, say, a different output format. Copying defaultLogAppender.c + would be a good start. + + + + The default appender function currently prints to stderr, but more + would be needed, like the one able to send the logs to a remote + dedicated server. + + + + + + + Misc and Caveats + + + Do not use any of the macros that start with '_'. + + + + The current set of macros force each file to use categories declared in + that file. This is intentional. Make the category a child of the file's + module category. + + + + Log4J has a 'rolling file appender' which you can select with a run-time + option & specify the max file size. This would be a nice default for + non-kernel applications. + + + + Careful, category names are global variables. + + + + + + + + + + + + + +@gras_log_priority_none: +@gras_log_priority_debug: +@gras_log_priority_verbose: +@gras_log_priority_info: +@gras_log_priority_warning: +@gras_log_priority_error: +@gras_log_priority_critical: +@gras_log_priority_infinite: +@gras_log_priority_uninitialized: + + + + + + +@cs: +@Returns: + + + + + + + +@catName: + + + + + + + +@catName: +@parent: + + + + + + + +@cname: + + + + + + + +@cname: +@parent: + + + + + + + +@cname: + + + + + + + +@cname: + + + + + + + +@catName: +@priority: + + + + + + + + + + + + + + +@cat: +@app: + + + + + + + + + + + + + +@c: +@f: +@a1: +@a2: +@a3: +@a4: +@a5: +@a6: + + + + + + + +@c: +@f: +@a1: +@a2: +@a3: +@a4: +@a5: +@a6: + + + + + + + +@c: +@f: +@a1: +@a2: +@a3: +@a4: +@a5: +@a6: + + + + + + + +@c: +@f: +@a1: +@a2: +@a3: +@a4: +@a5: +@a6: + + + + + + + +@c: +@f: +@a1: +@a2: +@a3: +@a4: +@a5: +@a6: + + + + + + + +@c: +@f: +@a1: +@a2: +@a3: +@a4: +@a5: +@a6: + + + + + + + +@f: +@a1: +@a2: +@a3: +@a4: +@a5: +@a6: + + + + + + + +@f: +@a1: +@a2: +@a3: +@a4: +@a5: +@a6: + + + + + + + +@f: +@a1: +@a2: +@a3: +@a4: +@a5: +@a6: + + + + + + + +@f: +@a1: +@a2: +@a3: +@a4: +@a5: +@a6: + + + + + + + +@f: +@a1: +@a2: +@a3: +@a4: +@a5: +@a6: + + + + + + + +@f: +@a1: +@a2: +@a3: +@a4: +@a5: +@a6: + + diff --git a/cruft/doc/tmpl/cruft.sgml b/cruft/doc/tmpl/cruft.sgml new file mode 100644 index 0000000000..a387d76dfa --- /dev/null +++ b/cruft/doc/tmpl/cruft.sgml @@ -0,0 +1,16 @@ + +Cruft to ignore in the documentation + + + + + + + + + + + + + + diff --git a/cruft/doc/tmpl/gras-overview.sgml b/cruft/doc/tmpl/gras-overview.sgml new file mode 100644 index 0000000000..38741835b7 --- /dev/null +++ b/cruft/doc/tmpl/gras-overview.sgml @@ -0,0 +1,121 @@ + +Overview + + +Overview of the GRAS library + + + This document introduce the GRAS library (Grid Reality + And Simulation, or according to my english dictionary, + Generally Recognized As Safe ;). + + + Overview + The purpose of the GRAS is to allow the developpement of + distributed programs which will work with as few as possible + modification both on the SimGrid simulator (SG), and in the Real Life + (RL). + + Here are the problems when you want to do so: + + + Communication in SG is done by passing tasks, while in + RL, you have to deal with sockets (or any wrapper to it). + + In RL, each process should provide a main() + function, and it's obviously not the case in SG. + + + + + + Application class target + If you want to run your code both in RL and in SG, you won't be + able to use the full set of features offered by any of those two + worlds. GRAS tries to provide a suffisent set of features to develop + your application, and implement them in both worlds. + + GRAS uses the paradigm of event-driven + programming, which is an extension to the message-passing + one. Any process of a typical event-driven application declares + callback to incoming events, which can be messages from other + processes, timers or others. + + All messages have an header, specifying its type, and attached + data, represented as one or several C structures. In order to send + the data over the network in RL, a type-description mecanism is + provided, and the RL version of GRAS implements CDR + functionnalities. That is to say that the data are sent in the native + format of the sender host, and converted on the destination host only + if needed. + + In order to not reimplement the wheel, GRAS use existing code, + and adapt them to make them work together. The SG version naturally + use the SimGrid toolkit, while the RL version is based over the + communication library used in NWS (note that this library was somehow + modified, since the previous version use XDR, ie both the sender and + the receiver convert the data from/to a so called network + format). That's why some basic knowledge about how NWS work is + supposed in this document. But don't worry, you only have to know the + basics about NWS, the internals needed to understand the document + will be presented when needed. + + + + + + + + + + + + +@CHAR_TYPE: +@DOUBLE_TYPE: +@FLOAT_TYPE: +@INT_TYPE: +@LONG_TYPE: +@SHORT_TYPE: +@UNSIGNED_INT_TYPE: +@UNSIGNED_LONG_TYPE: +@UNSIGNED_SHORT_TYPE: +@STRUCT_TYPE: + + + + + + +@type: +@repetitions: + + + + + + + +@type: +@repetitions: +@offset: + + + + + + + +@structType: +@lastMember: +@memberType: +@repetitions: + + + + + + + + + diff --git a/cruft/doc/tmpl/gras-unused.sgml b/cruft/doc/tmpl/gras-unused.sgml new file mode 100644 index 0000000000..8f6458650d --- /dev/null +++ b/cruft/doc/tmpl/gras-unused.sgml @@ -0,0 +1,1311 @@ + + + + + + + + + + + + + + + + + +ErrLog + + + + + + + + + + + + + + + + + + + +config + + + + + + + + + + + + + + + + + + + +dico + + + + +This module provide the quite usual dynamic array facility. + + + + + + + + + + +Dynamic array + + + +dynar + + + + This document introduce the GRAS library (Grid Reality + And Simulation, or according to my english dictionary, + Generally Recognized As Safe ;). + + + Overview + The purpose of the GRAS is to allow the developpement of + distributed programs which will work with as few as possible + modification both on the SimGrid simulator (SG), and in the Real Life + (RL). + + Here are the problems when you want to do so: + + + Communication in SG is done by passing tasks, while in + RL, you have to deal with sockets (or any wrapper to it). + + In RL, each process should provide a main() + function, and it's obviously not the case in SG. + + + + + + Application class target + If you want to run your code both in RL and in SG, you won't be + able to use the full set of features offered by any of those two + worlds. GRAS tries to provide a suffisent set of features to develop + your application, and implement them in both worlds. + + GRAS uses the paradigm of event-driven + programming, which is an extension to the message-passing + one. Any process of a typical event-driven application declares + callback to incoming events, which can be messages from other + processes, timers or others. + + All messages have an header, specifying its type, and attached + data, represented as one or several C structures. In order to send + the data over the network in RL, a type-description mecanism is + provided, and the RL version of GRAS implements CDR + functionnalities. That is to say that the data are sent in the native + format of the sender host, and converted on the destination host only + if needed. + + In order to not reimplement the wheel, GRAS use existing code, + and adapt them to make them work together. The SG version naturally + use the SimGrid toolkit, while the RL version is based over the + communication library used in NWS (note that this library was somehow + modified, since the previous version use XDR, ie both the sender and + the receiver convert the data from/to a so called network + format). That's why some basic knowledge about how NWS work is + supposed in this document. But don't worry, you only have to know the + basics about NWS, the internals needed to understand the document + will be presented when needed. + + + + + + + + + + +Overview of the GRAS library + + + +Overview + + + + + + + + + + + + + + + + + + + +gras + + + + + + + + + + + + + + + + + + + +nws_comm + + + + + + + + + + + + + +@c: +@f: + + + + + + +@c: +@f: +@a1: + + + + + + +@c: +@f: +@a1: +@a2: + + + + + + +@c: +@f: +@a1: +@a2: +@a3: + + + + + + +@c: +@f: +@a1: +@a2: +@a3: +@a4: + + + + + + +@c: +@f: +@a1: +@a2: +@a3: +@a4: +@a5: + + + + + + +@c: +@f: + + + + + + +@c: +@f: +@a1: + + + + + + +@c: +@f: +@a1: +@a2: + + + + + + +@c: +@f: +@a1: +@a2: +@a3: + + + + + + +@c: +@f: +@a1: +@a2: +@a3: +@a4: + + + + + + +@c: +@f: +@a1: +@a2: +@a3: +@a4: +@a5: + + + + + + +@c: +@f: + + + + + + +@c: +@f: +@a1: + + + + + + +@c: +@f: +@a1: +@a2: + + + + + + +@c: +@f: +@a1: +@a2: +@a3: + + + + + + +@c: +@f: +@a1: +@a2: +@a3: +@a4: + + + + + + +@c: +@f: +@a1: +@a2: +@a3: +@a4: +@a5: + + + + + + +@c: +@f: + + + + + + +@c: +@f: +@a1: + + + + + + +@c: +@f: +@a1: +@a2: + + + + + + +@c: +@f: +@a1: +@a2: +@a3: + + + + + + +@c: +@f: +@a1: +@a2: +@a3: +@a4: + + + + + + +@c: +@f: +@a1: +@a2: +@a3: +@a4: +@a5: + + + + + + +@c: +@p: +@f: + + + + + + +@c: +@p: +@f: +@a1: + + + + + + +@c: +@p: +@f: +@a1: +@a2: + + + + + + +@c: +@p: +@f: +@a1: +@a2: +@a3: + + + + + + +@c: +@p: +@f: +@a1: +@a2: +@a3: +@a4: + + + + + + +@c: +@p: +@f: +@a1: +@a2: +@a3: +@a4: +@a5: + + + + + + +@c: +@p: +@f: +@a1: +@a2: +@a3: +@a4: +@a5: +@a6: + + + + + + +@f: + + + + + + +@f: +@a1: + + + + + + +@f: +@a1: +@a2: + + + + + + +@f: +@a1: +@a2: +@a3: + + + + + + +@f: +@a1: +@a2: +@a3: +@a4: + + + + + + +@f: +@a1: +@a2: +@a3: +@a4: +@a5: + + + + + + +@addr: +@Param2: +@sock: +@timeOut: +@Returns: + + + + + + +@pid: +@parentToChild: +@childToParent: +@Returns: + + + + + + +@sock: +@Returns: + + + + + + + + + + + + + + + + + + +@Param1: +@Param2: +@ear: +@earPort: +@Returns: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +@addr: +@Returns: + + + + + + +@addr: +@Returns: + + + + + + +@addr: +@Returns: + + + + + + +@addr: +@Returns: + + + + + + +@machineOrAddress: +@address: + + + + + + +@machineOrAddress: +@addressList: +@atMost: +@Returns: + + + + + + +@timeOut: +@sd: +@ldap: +@Returns: + + + + + + +@sd: +@Returns: + + + + + + +@sd: +@Returns: + + + + + + +@machineOrAddress: + + + + + + +@p: +@f: +@a1: +@a2: +@a3: +@a4: +@a5: +@a6: + + + + + + +@Returns: + + + + + + + + + + + + +@notifyFn: + + + + + + +@addr: +@Param2: +@sock: +@Returns: + + + + + + +@Param1: +@Param2: +@ear: +@earPort: +@Returns: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +@sock: +@child: +@Returns: + + + + + + +@sd: +@Returns: + + + + + + +@sd: +@Returns: + + + + + + +@sd: +@Returns: + + + + + + + + + + + + + + + + + + +@sig: + + + + + + +@Param1: + + + + + + +@sd: +@Returns: + + + + + + +@sd: +@Returns: + + + + + + + + + + + + +@sd: +@msgType: +@vdata: + + + + + + +@sock: +@Returns: + + + + + + +@dd1: +@c1: +@dd2: +@c2: +@Returns: +@description: + + + + + + +@description: +@Returns: + + + + + + +@sd: +@data: +@description: +@description_length: +@repetition: +@Returns: + + + + + + +@sd: +@data: +@description: +@description_length: +@repetition: +@Returns: + + + + + + +@description: +@ft: +@Returns: + + + + + + +@no_error: +@malloc_error: +@mismatch_error: +@sanity_error: +@system_error: +@network_error: +@timeout_error: +@thread_error: +@unknown_error: + + + + + + +@Returns: + + + + + + + + + + + + +@sd: +@size: + + + + + + +@id: +@Returns: + + + + + + + + + + + + +@msg: + + + + + + +@timeOut: + + + + + + +@msgId: +@dataSize: +@seqCount: +@Returns: + + + + + + +@msgId: +@free_data_on_free: +@seqCount: +@Varargs: +@Returns: + + + + + + +@message: +@name: +@sequence_count: +@Varargs: +@Returns: + + + + + + +@sd: +@message: +@sequence_count: +@Varargs: +@Returns: + + + + + + +@sd: +@timeout: +@message: +@sequence_count: +@Varargs: +@Returns: + + + + + + +@Returns: + + + + + + +@host: +@Param2: +@sock: +@Returns: + + + + + + +@Param1: +@Param2: +@sock: +@Returns: + + + + + + + + + + + + +@sd: +@Returns: + + + + + + +@sd: +@Returns: + + + + + + +@sd: +@data: +@description: +@Returns: + + + + + + +@message: +@TTL: +@cb: + + + + + + +@sd: +@data: +@description: +@Returns: + + + + + + +@Returns: + + + + + + + + + + + + +@type: + + + + + + +@ud: + + + + + + +@dynar: +@cursor: +@Returns: + + + + + + +@dynar: +@cursor: +@whereto: +@Returns: + + + + + + +@cat: +@parent: + + + + + + +@cat: +@thresholdPriority: + diff --git a/cruft/doc/tmpl/gras.sgml b/cruft/doc/tmpl/gras.sgml new file mode 100644 index 0000000000..3312fb1f2b --- /dev/null +++ b/cruft/doc/tmpl/gras.sgml @@ -0,0 +1,221 @@ + +gras + + + + + + + + + + + + + + + + + + + +@CHAR_TYPE: +@DOUBLE_TYPE: +@FLOAT_TYPE: +@INT_TYPE: +@LONG_TYPE: +@SHORT_TYPE: +@UNSIGNED_INT_TYPE: +@UNSIGNED_LONG_TYPE: +@UNSIGNED_SHORT_TYPE: +@STRUCT_TYPE: +@LAST_TYPE: + + + + + + +@type: +@repetitions: + + + + + + + +@type: +@repetitions: +@offset: + + + + + + + +@structType: +@lastMember: +@memberType: +@repetitions: + + + + + + + + + + + + + + +@host: +@Param2: +@sock: +@Returns: + + + + + + + +@Param1: +@Param2: +@sock: +@Returns: + + + + + + + +@sock: +@Returns: + + + + + + + +@sd: +@Returns: + + + + + + + +@sd: +@Returns: + + + + + + + +@Returns: + + + + + + + + + + + + + +@message: +@name: +@sequence_count: +@Varargs: +@Returns: + + + + + + + +@sd: +@msgType: +@vdata: + + + + + + + +@message: +@TTL: +@cb: + + + + + + + +@timeOut: + + + + + + + +@sd: +@message: +@sequence_count: +@Varargs: +@Returns: + + + + + + + +@sd: +@timeout: +@message: +@sequence_count: +@Varargs: +@Returns: + + + + + + + + + + + + + + +@ud: + + + + + + + +@type: + + diff --git a/cruft/doc/tmpl/gras_private.sgml b/cruft/doc/tmpl/gras_private.sgml new file mode 100644 index 0000000000..4803e61ef7 --- /dev/null +++ b/cruft/doc/tmpl/gras_private.sgml @@ -0,0 +1,68 @@ + +gras_private + + + + + + + + + + + + + + + + + + + +@Returns: + + + + + + + +@Returns: + + + + + + + +@sd: +@size: + + + + + + + +@HOST_FORMAT: +@NETWORK_FORMAT: + + + + + + +@dd1: +@c1: +@dd2: +@c2: +@Returns: + + + + + + + + + diff --git a/cruft/doc/tmpl/gras_rl.sgml b/cruft/doc/tmpl/gras_rl.sgml new file mode 100644 index 0000000000..b16aa9e989 --- /dev/null +++ b/cruft/doc/tmpl/gras_rl.sgml @@ -0,0 +1,112 @@ + +RL + + +Implementation of GRAS suited for real life. + + + + + + + + + + + + + + + + +@msg: +@timeout: +@Returns: + +@sd: + + + + + + + +@destination: +@source: +@description: +@length: +@sourceFormat: + + + + + + + +@description: +@length: +@format: +@Returns: + + + + + + + +@whatType: +@Returns: + + + + + + + +@Returns: + + + + + + + +@whatType: +@Returns: + + + + + + + +@destination: +@source: +@whatType: +@repetitions: +@sourceFormat: + + + + + + + +@whatType: +@repetitions: +@format: +@Returns: + + + + + + + +@destination: +@source: +@whatType: +@repetitions: +@format: + + diff --git a/cruft/doc/tmpl/gras_sg.sgml b/cruft/doc/tmpl/gras_sg.sgml new file mode 100644 index 0000000000..fe69bc5484 --- /dev/null +++ b/cruft/doc/tmpl/gras_sg.sgml @@ -0,0 +1,85 @@ + +SG + + +Implementation of GRAS on top of the simulator. + + + + SimGrid was designed to ease the comparison of algorithms and + heuristics. That way, a lot of complicated notion from the system layer + were volontary left off. For example, migrating a process from an host to + another is as easy as: MSG_process_change_host(process, new_host). + + + + No need to tell that performing this operation on real platform is really + harder. This simplification is a very good thing when you want to rapidly + prototype code, but makes things somehow more complicated in GRAS since + we want to have a realistic API, since it have to be implemented in + reality also. + + + + The best example of complexity in GRAS_SG induced by simplicity in + SimGrid is the sockets handling. There is no "socket" in SG, but only + m_channel_t. In contrary to sockets from RL, no special treatment is + needed for a process before writing or reading on/from a channel. So, a + given channel can be pooled by more than one process. Likewise, you can + send data to a channel that nobody is actually listening to. + + + + The SG implementation of GRAS repport as an error the fact that nobody is + listening to the socket when trying to open a socket, or send stuff using + a previously openned socket. That way, the SG version can be used to + debug all syncronization issues. For that, we store mainly the PID of + both the sender and the receiver in the socket structure, and then + resolve PID->process at the lastest moment. This search is a bit + expensive, but as long as there is no real garbage collection in SG, with + the information "dead process" within the structure, it's the only + solution to make sure that we won't dereference pointers to an old freed + structure when the process on the other side of the structure did finish + since the creation of the socket. + + + + As said in the overview, the processes can declare to hear on several + sockets, but all incoming messages are handled by the same loop. So, we + can use only one channel per process, and use a table on each host to + determine to which process a message should be delivered depending on the + socket number provided by the sender. + + + + +RL, the implementation suited for real life. + + + + + + + + + +@sock: +@waitForPeer: +@Returns: + + diff --git a/cruft/doc/tmpl/nws_comm.sgml b/cruft/doc/tmpl/nws_comm.sgml new file mode 100644 index 0000000000..88570e2037 --- /dev/null +++ b/cruft/doc/tmpl/nws_comm.sgml @@ -0,0 +1,85 @@ + +nws_comm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +@CHAR_TYPE: +@DOUBLE_TYPE: +@FLOAT_TYPE: +@INT_TYPE: +@LONG_TYPE: +@SHORT_TYPE: +@UNSIGNED_INT_TYPE: +@UNSIGNED_LONG_TYPE: +@UNSIGNED_SHORT_TYPE: +@STRUCT_TYPE: +@LAST_TYPE: + + + + + + +@HOST_FORMAT: +@NETWORK_FORMAT: + + + + + + +@type: +@repetitions: + + + + + + + +@type: +@repetitions: +@offset: + + + + + + + +@structType: +@lastMember: +@memberType: +@repetitions: + + diff --git a/doc/.cvsignore b/doc/.cvsignore new file mode 100644 index 0000000000..ad884ec30e --- /dev/null +++ b/doc/.cvsignore @@ -0,0 +1,4 @@ +Makefile *.stamp html *.new gras-unused.txt gras.args gras.hierarchy gras.interfaces gras.prerequisites gras.signals +gras-decl-list.txt +gras-decl.txt +sgml diff --git a/examples/.cvsignore b/examples/.cvsignore new file mode 100644 index 0000000000..6179e0dbd5 --- /dev/null +++ b/examples/.cvsignore @@ -0,0 +1 @@ +Makefile Makefile.in diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000000..d48fdfa93e --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1 @@ +SUBDIRS=ping bandwidth saturate alnem diff --git a/examples/WAN_3.platform.txt b/examples/WAN_3.platform.txt new file mode 100644 index 0000000000..446076c4c6 --- /dev/null +++ b/examples/WAN_3.platform.txt @@ -0,0 +1,1285 @@ +MSG_PLATFORM_DSC 1.0 +HOSTS +125 137.333 +95 171.667 +109 137.333 +175 114.444 +157 98.094999999999999 +81 34.333 +62 114.444 +165 98.094999999999999 +168 42.917000000000002 +112 76.296000000000006 +69 114.444 +145 114.444 +178 98.094999999999999 +124 137.333 +131 76.296000000000006 +121 85.832999999999998 +98 22.151 +170 34.333 +63 68.667000000000002 +162 114.444 +61 68.667000000000002 +107 42.917000000000002 +87 68.667000000000002 +77 48.492 +70 85.832999999999998 +88 76.296000000000006 +156 22.151 +83 114.444 +177 114.444 +150 42.917000000000002 +85 114.444 +111 137.333 +169 34.333 +LINKS +127 4.133375 9.693542 +32 27.94625 0.278066 +90 34.285625 0.514433 +118 3.275625 0.658142 +71 15.376875 35.083019 +102 1.04925 9.647856 +18 118.6825 0.136931 +125 3.29775 0.595883 +16 41.279125 0.059904 +44 10.314625 6.932556 +55 8.015125 35.076518 +84 8.015125 35.076518 +27 10.099625 0.47978 +190 0.76875 8.76244 +161 2.179125 0.320114 +95 3.71425 3.866813 +57 34.285625 0.514433 +20 132.977875 0.131098 +163 5.7585 4.760145 +109 1.326125 1.402769 +151 6.777 0.53334 +89 41.279125 0.059904 +175 1.892625 0.162735 +148 5.299 0.520693 +31 34.285625 0.514433 +35 11.845375 0.370788 +11 41.279125 0.059904 +78 10.314625 6.932556 +93 0.979625 0.424305 +106 3.37125 0.666676 +157 2.227375 0.90712 +65 34.285625 0.514433 +29 8.015125 35.076518 +138 1.8855 0.950938 +114 3.275625 0.658142 +58 11.618875 0.18998 +153 1.62775 0.278175 +15 118.6825 0.136931 +137 1.4655 0.863872 +81 11.845375 0.370788 +60 10.314625 6.932556 +101 0.117125 53.930106 +73 8.42725 0.156056 +86 8.158 0.270544 +76 10.099625 0.47978 +62 8.42725 0.156056 +67 41.279125 0.059904 +165 1.51525 0.844683 +139 1.126875 0.28784 +129 0.578625 5.473705 +2 41.279125 0.059904 +17 118.6825 0.136931 +186 5.299 0.520693 +110 3.9315 1.913591 +82 8.158 0.270544 +147 0.274375 4.669142 +168 2.368 9.547561 +184 1.931125 0.95183 +135 0.605 87.981858 +14 118.6825 0.136931 +112 3.430125 0.536941 +69 11.618875 0.18998 +191 1.23025 1.502106 +172 1.8855 0.950938 +145 2.227375 0.90712 +49 34.285625 0.514433 +178 0.578625 5.473705 +24 34.285625 0.514433 +187 0.303375 4.062241 +140 1.469125 1.114548 +124 2.227375 0.90712 +104 0.253125 5.652577 +131 0.253125 5.652577 +181 5.816375 0.164758 +121 3.9315 1.913591 +79 8.42725 0.156056 +154 0.251625 4.455826 +0 255.228625 7.413073 +23 8.42725 0.156056 +96 0.926625 0.601375 +126 1.04925 9.647856 +159 0.556 3.101854 +160 0.251625 4.455826 +176 2.3485 0.259761 +47 11.618875 0.18998 +8 34.285625 0.514433 +98 2.227375 0.90712 +37 8.42725 0.156056 +117 1.04925 9.647856 +43 10.314625 6.932556 +5 255.228625 7.413073 +170 7.20975 1.461517 +33 27.94625 0.278066 +21 41.279125 0.059904 +63 10.099625 0.47978 +7 255.228625 7.413073 +26 34.285625 0.514433 +80 8.42725 0.156056 +119 5.18975 0.630529 +180 1.8855 0.950938 +99 1.281875 6.104672 +179 1.467625 0.869727 +162 1.51525 0.844683 +72 21.41475 295.890617 +74 41.279125 0.059904 +182 1.4655 0.863872 +61 8.015125 35.076518 +108 3.37125 0.666676 +115 0.721625 0.006406 +92 2.179125 0.320114 +103 0.9905 1.742977 +10 132.977875 0.131098 +113 6.551 0.522878 +152 0.253125 5.652577 +189 5.228375 0.039417 +142 0.76875 8.76244 +91 41.279125 0.059904 +167 0.578625 5.473705 +48 15.376875 35.083019 +107 2.3485 0.259761 +87 41.279125 0.059904 +174 0.317375 4.583831 +77 10.099625 0.47978 +133 1.931125 0.95183 +149 0.274375 4.669142 +123 4.27025 0.672289 +50 10.314625 6.932556 +39 8.42725 0.156056 +64 11.845375 0.370788 +97 1.23025 1.502106 +12 118.6825 0.136931 +41 15.376875 35.083019 +52 11.845375 0.370788 +173 4.416625 0.019773 +56 10.314625 6.932556 +45 10.314625 6.932556 +66 27.94625 0.278066 +19 132.977875 0.131098 +54 8.158 0.270544 +70 27.94625 0.278066 +188 2.583375 0.410463 +68 27.94625 0.278066 +166 0.605 87.981858 +1 132.977875 0.131098 +136 1.469125 1.114548 +88 34.285625 0.514433 +116 0.578625 5.473705 +144 1.281875 6.104672 +141 2.583375 0.410463 +30 11.845375 0.370788 +100 3.068375 0.0403 +25 27.94625 0.278066 +128 0.9905 1.742977 +28 15.376875 35.083019 +120 0.9905 1.742977 +156 2.23825 1.043314 +134 1.04925 9.647856 +40 11.845375 0.370788 +75 41.279125 0.059904 +83 11.845375 0.370788 +59 21.41475 295.890617 +177 3.9955 0.678645 +150 4.817 0.117352 +155 3.9315 1.913591 +130 1.858 0.820952 +53 8.42725 0.156056 +122 3.068375 0.0403 +143 1.326125 1.402769 +158 3.8775 0.863123 +42 10.314625 6.932556 +22 11.845375 0.370788 +46 10.314625 6.932556 +13 41.279125 0.059904 +105 0.272375 5.922616 +6 255.228625 7.413073 +85 41.279125 0.059904 +185 1.281875 6.104672 +36 8.158 0.270544 +3 118.6825 0.136931 +183 1.281875 6.104672 +94 3.275625 0.658142 +146 5.574625 0.22743 +51 8.158 0.270544 +9 41.279125 0.059904 +111 2.227375 0.90712 +38 11.618875 0.18998 +4 41.279125 0.059904 +34 41.279125 0.059904 +169 4.840375 0.75181 +164 0.605 87.981858 +132 0.472125 5.161451 +171 0.253125 5.652577 +ROUTES +125 95 (59 56 54 17 16 10 6 8 48 38 41) +125 109 (59 56 54 17 16 10 6 8 42 43 131) +125 175 (59 56 54 17 16 10 6 9 79 78 80 82 91) +125 157 (59 56 54 2 3 69 64 65 72 169) +125 81 (59 56 54 17 16 10 6 7 19 28 27 30 32 33 108) +125 62 (59 56 54 17 16 10 6 7 19 28 29 93) +125 165 (59 56 54 17 16 10 6 9 79 78 80 82 87 88 90) +125 168 (59 56 54 17 16 10 6 9 79 78 80 82 87 88 90 178) +125 112 (59 58 62 133) +125 69 (59 56 54 17 16 10 6 7 19 28 27 30 34 99) +125 145 (59 56 54 2 3 70) +125 178 (59 56 54 17 16 10 6 9 79 78 80 82 91 186) +125 124 (59 56 57 143) +125 131 (59 56 54 52 53 148) +125 121 (59 56 57 140) +125 98 (59 56 54 17 16 10 6 8 48 38 41 122) +125 170 (59 56 54 17 16 10 6 9 79 78 81) +125 63 (59 56 54 17 16 10 6 7 19 28 29 94) +125 162 (59 56 54 17 16 10 6 9 79 78 80 82 87 88 89 173) +125 61 (59 56 54 17 16 10 6 7 19 28 29 92) +125 107 (59 56 54 17 16 10 6 8 42 43 129) +125 87 (59 56 54 17 16 10 6 8 48 38 40 113) +125 77 (59 56 54 17 16 10 6 7 19 28 27 31 105) +125 70 (59 56 54 17 16 10 6 7 19 28 27 30 35) +125 88 (59 56 54 17 16 10 6 8 48 38 40 114) +125 156 (59 56 54 2 3 69 64 65 72 168) +125 83 (59 56 54 17 16 10 6 7 19 28 27 30 32 33 110) +125 177 (59 56 54 17 16 10 6 9 79 78 80 82 91 185) +125 150 (59 56 54 2 1 15 76) +125 85 (59 56 54 17 16 10 6 8 48 38 40) +125 111 (59 58 62 132) +125 169 (59 56 54 17 16 10 6 9 79 78 80 82 87 88 90 179) +95 125 (41 38 48 8 6 10 16 17 54 56 59) +95 109 (41 38 48 42 43 131) +95 175 (41 38 48 8 9 79 78 80 82 91) +95 157 (41 38 48 8 6 10 16 0 3 69 64 65 72 169) +95 81 (41 38 48 8 7 19 28 27 30 32 33 108) +95 62 (41 38 48 8 7 19 28 29 93) +95 165 (41 38 48 8 9 79 78 80 82 87 88 90) +95 168 (41 38 48 8 9 79 78 80 82 87 88 90 178) +95 112 (41 38 48 8 6 10 16 17 54 56 58 62 133) +95 69 (41 38 48 8 7 19 28 27 30 34 99) +95 145 (41 38 48 8 6 10 16 0 3 70) +95 178 (41 38 48 8 9 79 78 80 82 91 186) +95 124 (41 38 48 8 6 10 16 17 54 57 143) +95 131 (41 38 48 8 6 10 16 17 52 53 148) +95 121 (41 38 48 8 6 10 16 17 54 57 140) +95 98 (122) +95 170 (41 38 48 8 9 79 78 81) +95 63 (41 38 48 8 7 19 28 29 94) +95 162 (41 38 48 8 9 79 78 80 82 87 88 89 173) +95 61 (41 38 48 8 7 19 28 29 92) +95 107 (41 38 48 42 43 129) +95 87 (41 40 113) +95 77 (41 38 48 8 7 19 28 27 31 105) +95 70 (41 38 48 8 7 19 28 27 30 35) +95 88 (41 40 114) +95 156 (41 38 48 8 6 10 16 0 3 69 64 65 72 168) +95 83 (41 38 48 8 7 19 28 27 30 32 33 110) +95 177 (41 38 48 8 9 79 78 80 82 91 185) +95 150 (41 38 48 8 6 10 16 0 1 15 76) +95 85 (41 40) +95 111 (41 38 48 8 6 10 16 17 54 56 58 62 132) +95 169 (41 38 48 8 9 79 78 80 82 87 88 90 179) +109 125 (131 43 42 8 6 10 16 17 54 56 59) +109 95 (131 43 42 48 38 41) +109 175 (131 43 42 8 9 79 78 80 82 91) +109 157 (131 43 42 8 6 10 16 0 3 69 64 65 72 169) +109 81 (131 43 42 8 7 19 28 27 30 32 33 108) +109 62 (131 43 42 8 7 19 28 29 93) +109 165 (131 43 42 8 9 79 78 80 82 87 88 90) +109 168 (131 43 42 8 9 79 78 80 82 87 88 90 178) +109 112 (131 43 42 8 6 10 16 17 54 56 58 62 133) +109 69 (131 43 42 8 7 19 28 27 30 34 99) +109 145 (131 43 42 8 6 10 16 0 3 70) +109 178 (131 43 42 8 9 79 78 80 82 91 186) +109 124 (131 43 42 8 6 10 16 17 54 57 143) +109 131 (131 43 42 8 6 10 16 17 52 53 148) +109 121 (131 43 42 8 6 10 16 17 54 57 140) +109 98 (131 43 42 48 38 41 122) +109 170 (131 43 42 8 9 79 78 81) +109 63 (131 43 42 8 7 19 28 29 94) +109 162 (131 43 42 8 9 79 78 80 82 87 88 89 173) +109 61 (131 43 42 8 7 19 28 29 92) +109 107 (131 129) +109 87 (131 43 42 48 38 40 113) +109 77 (131 43 42 8 7 19 28 27 31 105) +109 70 (131 43 42 8 7 19 28 27 30 35) +109 88 (131 43 42 48 38 40 114) +109 156 (131 43 42 8 6 10 16 0 3 69 64 65 72 168) +109 83 (131 43 42 8 7 19 28 27 30 32 33 110) +109 177 (131 43 42 8 9 79 78 80 82 91 185) +109 150 (131 43 42 8 6 10 16 0 1 15 76) +109 85 (131 43 42 48 38 40) +109 111 (131 43 42 8 6 10 16 17 54 56 58 62 132) +109 169 (131 43 42 8 9 79 78 80 82 87 88 90 179) +175 125 (91 82 80 78 79 9 6 10 16 17 54 56 59) +175 95 (91 82 80 78 79 9 8 48 38 41) +175 109 (91 82 80 78 79 9 8 42 43 131) +175 157 (91 82 80 78 79 9 6 10 16 0 3 69 64 65 72 169) +175 81 (91 82 80 78 79 20 19 28 27 30 32 33 108) +175 62 (91 82 80 78 79 20 19 28 29 93) +175 165 (91 87 88 90) +175 168 (91 87 88 90 178) +175 112 (91 82 80 78 79 9 6 10 16 17 54 56 58 62 133) +175 69 (91 82 80 78 79 20 19 28 27 30 34 99) +175 145 (91 82 80 78 79 9 6 10 16 0 3 70) +175 178 (186) +175 124 (91 82 80 78 79 9 6 10 16 17 54 57 143) +175 131 (91 82 80 78 79 9 6 10 16 17 52 53 148) +175 121 (91 82 80 78 79 9 6 10 16 17 54 57 140) +175 98 (91 82 80 78 79 9 8 48 38 41 122) +175 170 (91 82 80 81) +175 63 (91 82 80 78 79 20 19 28 29 94) +175 162 (91 87 88 89 173) +175 61 (91 82 80 78 79 20 19 28 29 92) +175 107 (91 82 80 78 79 9 8 42 43 129) +175 87 (91 82 80 78 79 9 8 48 38 40 113) +175 77 (91 82 80 78 79 20 19 28 27 31 105) +175 70 (91 82 80 78 79 20 19 28 27 30 35) +175 88 (91 82 80 78 79 9 8 48 38 40 114) +175 156 (91 82 80 78 79 9 6 10 16 0 3 69 64 65 72 168) +175 83 (91 82 80 78 79 20 19 28 27 30 32 33 110) +175 177 (185) +175 150 (91 82 80 78 79 9 6 10 16 0 1 15 76) +175 85 (91 82 80 78 79 9 8 48 38 40) +175 111 (91 82 80 78 79 9 6 10 16 17 54 56 58 62 132) +175 169 (91 87 88 90 179) +157 125 (169 72 65 64 69 3 2 54 56 59) +157 95 (169 72 65 64 69 3 0 16 10 6 8 48 38 41) +157 109 (169 72 65 64 69 3 0 16 10 6 8 42 43 131) +157 175 (169 72 65 64 69 3 0 16 10 6 9 79 78 80 82 91) +157 81 (169 72 65 64 69 3 0 16 10 6 7 19 28 27 30 32 33 108) +157 62 (169 72 65 64 69 3 0 16 10 6 7 19 28 29 93) +157 165 (169 72 65 64 69 3 0 16 10 6 9 79 78 80 82 87 88 90) +157 168 (169 72 65 64 69 3 0 16 10 6 9 79 78 80 82 87 88 90 178) +157 112 (169 72 65 64 69 3 2 54 56 58 62 133) +157 69 (169 72 65 64 69 3 0 16 10 6 7 19 28 27 30 34 99) +157 145 (169 72 65 64 69 70) +157 178 (169 72 65 64 69 3 0 16 10 6 9 79 78 80 82 91 186) +157 124 (169 72 65 64 69 3 2 54 57 143) +157 131 (169 72 65 64 69 3 2 52 53 148) +157 121 (169 72 65 64 69 3 2 54 57 140) +157 98 (169 72 65 64 69 3 0 16 10 6 8 48 38 41 122) +157 170 (169 72 65 64 69 3 0 16 10 6 9 79 78 81) +157 63 (169 72 65 64 69 3 0 16 10 6 7 19 28 29 94) +157 162 (169 72 65 64 69 3 0 16 10 6 9 79 78 80 82 87 88 89 173) +157 61 (169 72 65 64 69 3 0 16 10 6 7 19 28 29 92) +157 107 (169 72 65 64 69 3 0 16 10 6 8 42 43 129) +157 87 (169 72 65 64 69 3 0 16 10 6 8 48 38 40 113) +157 77 (169 72 65 64 69 3 0 16 10 6 7 19 28 27 31 105) +157 70 (169 72 65 64 69 3 0 16 10 6 7 19 28 27 30 35) +157 88 (169 72 65 64 69 3 0 16 10 6 8 48 38 40 114) +157 156 (169 168) +157 83 (169 72 65 64 69 3 0 16 10 6 7 19 28 27 30 32 33 110) +157 177 (169 72 65 64 69 3 0 16 10 6 9 79 78 80 82 91 185) +157 150 (169 72 65 64 73 74 76) +157 85 (169 72 65 64 69 3 0 16 10 6 8 48 38 40) +157 111 (169 72 65 64 69 3 2 54 56 58 62 132) +157 169 (169 72 65 64 69 3 0 16 10 6 9 79 78 80 82 87 88 90 179) +81 125 (108 33 32 30 27 28 19 7 6 10 16 17 54 56 59) +81 95 (108 33 32 30 27 28 19 7 8 48 38 41) +81 109 (108 33 32 30 27 28 19 7 8 42 43 131) +81 175 (108 33 32 30 27 28 19 20 79 78 80 82 91) +81 157 (108 33 32 30 27 28 19 7 6 10 16 0 3 69 64 65 72 169) +81 62 (108 33 32 30 27 29 93) +81 165 (108 33 32 30 27 28 19 20 79 78 80 82 87 88 90) +81 168 (108 33 32 30 27 28 19 20 79 78 80 82 87 88 90 178) +81 112 (108 33 32 30 27 28 19 7 6 10 16 17 54 56 58 62 133) +81 69 (108 33 32 34 99) +81 145 (108 33 32 30 27 28 19 7 6 10 16 0 3 70) +81 178 (108 33 32 30 27 28 19 20 79 78 80 82 91 186) +81 124 (108 33 32 30 27 28 19 7 6 10 16 17 54 57 143) +81 131 (108 33 32 30 27 28 19 7 6 10 16 17 52 53 148) +81 121 (108 33 32 30 27 28 19 7 6 10 16 17 54 57 140) +81 98 (108 33 32 30 27 28 19 7 8 48 38 41 122) +81 170 (108 33 32 30 27 28 19 20 79 78 81) +81 63 (108 33 32 30 27 29 94) +81 162 (108 33 32 30 27 28 19 20 79 78 80 82 87 88 89 173) +81 61 (108 33 32 30 27 29 92) +81 107 (108 33 32 30 27 28 19 7 8 42 43 129) +81 87 (108 33 32 30 27 28 19 7 8 48 38 40 113) +81 77 (108 33 32 30 31 105) +81 70 (108 33 32 35) +81 88 (108 33 32 30 27 28 19 7 8 48 38 40 114) +81 156 (108 33 32 30 27 28 19 7 6 10 16 0 3 69 64 65 72 168) +81 83 (108 110) +81 177 (108 33 32 30 27 28 19 20 79 78 80 82 91 185) +81 150 (108 33 32 30 27 28 19 7 6 10 16 0 1 15 76) +81 85 (108 33 32 30 27 28 19 7 8 48 38 40) +81 111 (108 33 32 30 27 28 19 7 6 10 16 17 54 56 58 62 132) +81 169 (108 33 32 30 27 28 19 20 79 78 80 82 87 88 90 179) +62 125 (93 29 28 19 7 6 10 16 17 54 56 59) +62 95 (93 29 28 19 7 8 48 38 41) +62 109 (93 29 28 19 7 8 42 43 131) +62 175 (93 29 28 19 20 79 78 80 82 91) +62 157 (93 29 28 19 7 6 10 16 0 3 69 64 65 72 169) +62 81 (93 29 27 30 32 33 108) +62 165 (93 29 28 19 20 79 78 80 82 87 88 90) +62 168 (93 29 28 19 20 79 78 80 82 87 88 90 178) +62 112 (93 29 28 19 7 6 10 16 17 54 56 58 62 133) +62 69 (93 29 27 30 34 99) +62 145 (93 29 28 19 7 6 10 16 0 3 70) +62 178 (93 29 28 19 20 79 78 80 82 91 186) +62 124 (93 29 28 19 7 6 10 16 17 54 57 143) +62 131 (93 29 28 19 7 6 10 16 17 52 53 148) +62 121 (93 29 28 19 7 6 10 16 17 54 57 140) +62 98 (93 29 28 19 7 8 48 38 41 122) +62 170 (93 29 28 19 20 79 78 81) +62 63 (93 94) +62 162 (93 29 28 19 20 79 78 80 82 87 88 89 173) +62 61 (93 92) +62 107 (93 29 28 19 7 8 42 43 129) +62 87 (93 29 28 19 7 8 48 38 40 113) +62 77 (93 29 27 31 105) +62 70 (93 29 27 30 35) +62 88 (93 29 28 19 7 8 48 38 40 114) +62 156 (93 29 28 19 7 6 10 16 0 3 69 64 65 72 168) +62 83 (93 29 27 30 32 33 110) +62 177 (93 29 28 19 20 79 78 80 82 91 185) +62 150 (93 29 28 19 7 6 10 16 0 1 15 76) +62 85 (93 29 28 19 7 8 48 38 40) +62 111 (93 29 28 19 7 6 10 16 17 54 56 58 62 132) +62 169 (93 29 28 19 20 79 78 80 82 87 88 90 179) +165 125 (90 88 87 82 80 78 79 9 6 10 16 17 54 56 59) +165 95 (90 88 87 82 80 78 79 9 8 48 38 41) +165 109 (90 88 87 82 80 78 79 9 8 42 43 131) +165 175 (90 88 87 91) +165 157 (90 88 87 82 80 78 79 9 6 10 16 0 3 69 64 65 72 169) +165 81 (90 88 87 82 80 78 79 20 19 28 27 30 32 33 108) +165 62 (90 88 87 82 80 78 79 20 19 28 29 93) +165 168 (178) +165 112 (90 88 87 82 80 78 79 9 6 10 16 17 54 56 58 62 133) +165 69 (90 88 87 82 80 78 79 20 19 28 27 30 34 99) +165 145 (90 88 87 82 80 78 79 9 6 10 16 0 3 70) +165 178 (90 88 87 91 186) +165 124 (90 88 87 82 80 78 79 9 6 10 16 17 54 57 143) +165 131 (90 88 87 82 80 78 79 9 6 10 16 17 52 53 148) +165 121 (90 88 87 82 80 78 79 9 6 10 16 17 54 57 140) +165 98 (90 88 87 82 80 78 79 9 8 48 38 41 122) +165 170 (90 88 87 82 80 81) +165 63 (90 88 87 82 80 78 79 20 19 28 29 94) +165 162 (90 89 173) +165 61 (90 88 87 82 80 78 79 20 19 28 29 92) +165 107 (90 88 87 82 80 78 79 9 8 42 43 129) +165 87 (90 88 87 82 80 78 79 9 8 48 38 40 113) +165 77 (90 88 87 82 80 78 79 20 19 28 27 31 105) +165 70 (90 88 87 82 80 78 79 20 19 28 27 30 35) +165 88 (90 88 87 82 80 78 79 9 8 48 38 40 114) +165 156 (90 88 87 82 80 78 79 9 6 10 16 0 3 69 64 65 72 168) +165 83 (90 88 87 82 80 78 79 20 19 28 27 30 32 33 110) +165 177 (90 88 87 91 185) +165 150 (90 88 87 82 80 78 79 9 6 10 16 0 1 15 76) +165 85 (90 88 87 82 80 78 79 9 8 48 38 40) +165 111 (90 88 87 82 80 78 79 9 6 10 16 17 54 56 58 62 132) +165 169 (179) +168 125 (178 90 88 87 82 80 78 79 9 6 10 16 17 54 56 59) +168 95 (178 90 88 87 82 80 78 79 9 8 48 38 41) +168 109 (178 90 88 87 82 80 78 79 9 8 42 43 131) +168 175 (178 90 88 87 91) +168 157 (178 90 88 87 82 80 78 79 9 6 10 16 0 3 69 64 65 72 169) +168 81 (178 90 88 87 82 80 78 79 20 19 28 27 30 32 33 108) +168 62 (178 90 88 87 82 80 78 79 20 19 28 29 93) +168 165 (178) +168 112 (178 90 88 87 82 80 78 79 9 6 10 16 17 54 56 58 62 133) +168 69 (178 90 88 87 82 80 78 79 20 19 28 27 30 34 99) +168 145 (178 90 88 87 82 80 78 79 9 6 10 16 0 3 70) +168 178 (178 90 88 87 91 186) +168 124 (178 90 88 87 82 80 78 79 9 6 10 16 17 54 57 143) +168 131 (178 90 88 87 82 80 78 79 9 6 10 16 17 52 53 148) +168 121 (178 90 88 87 82 80 78 79 9 6 10 16 17 54 57 140) +168 98 (178 90 88 87 82 80 78 79 9 8 48 38 41 122) +168 170 (178 90 88 87 82 80 81) +168 63 (178 90 88 87 82 80 78 79 20 19 28 29 94) +168 162 (178 90 89 173) +168 61 (178 90 88 87 82 80 78 79 20 19 28 29 92) +168 107 (178 90 88 87 82 80 78 79 9 8 42 43 129) +168 87 (178 90 88 87 82 80 78 79 9 8 48 38 40 113) +168 77 (178 90 88 87 82 80 78 79 20 19 28 27 31 105) +168 70 (178 90 88 87 82 80 78 79 20 19 28 27 30 35) +168 88 (178 90 88 87 82 80 78 79 9 8 48 38 40 114) +168 156 (178 90 88 87 82 80 78 79 9 6 10 16 0 3 69 64 65 72 168) +168 83 (178 90 88 87 82 80 78 79 20 19 28 27 30 32 33 110) +168 177 (178 90 88 87 91 185) +168 150 (178 90 88 87 82 80 78 79 9 6 10 16 0 1 15 76) +168 85 (178 90 88 87 82 80 78 79 9 8 48 38 40) +168 111 (178 90 88 87 82 80 78 79 9 6 10 16 17 54 56 58 62 132) +168 169 (178 179) +112 125 (133 62 58 59) +112 95 (133 62 58 56 54 17 16 10 6 8 48 38 41) +112 109 (133 62 58 56 54 17 16 10 6 8 42 43 131) +112 175 (133 62 58 56 54 17 16 10 6 9 79 78 80 82 91) +112 157 (133 62 58 56 54 2 3 69 64 65 72 169) +112 81 (133 62 58 56 54 17 16 10 6 7 19 28 27 30 32 33 108) +112 62 (133 62 58 56 54 17 16 10 6 7 19 28 29 93) +112 165 (133 62 58 56 54 17 16 10 6 9 79 78 80 82 87 88 90) +112 168 (133 62 58 56 54 17 16 10 6 9 79 78 80 82 87 88 90 178) +112 69 (133 62 58 56 54 17 16 10 6 7 19 28 27 30 34 99) +112 145 (133 62 58 56 54 2 3 70) +112 178 (133 62 58 56 54 17 16 10 6 9 79 78 80 82 91 186) +112 124 (133 62 58 56 57 143) +112 131 (133 62 58 56 54 52 53 148) +112 121 (133 62 58 56 57 140) +112 98 (133 62 58 56 54 17 16 10 6 8 48 38 41 122) +112 170 (133 62 58 56 54 17 16 10 6 9 79 78 81) +112 63 (133 62 58 56 54 17 16 10 6 7 19 28 29 94) +112 162 (133 62 58 56 54 17 16 10 6 9 79 78 80 82 87 88 89 173) +112 61 (133 62 58 56 54 17 16 10 6 7 19 28 29 92) +112 107 (133 62 58 56 54 17 16 10 6 8 42 43 129) +112 87 (133 62 58 56 54 17 16 10 6 8 48 38 40 113) +112 77 (133 62 58 56 54 17 16 10 6 7 19 28 27 31 105) +112 70 (133 62 58 56 54 17 16 10 6 7 19 28 27 30 35) +112 88 (133 62 58 56 54 17 16 10 6 8 48 38 40 114) +112 156 (133 62 58 56 54 2 3 69 64 65 72 168) +112 83 (133 62 58 56 54 17 16 10 6 7 19 28 27 30 32 33 110) +112 177 (133 62 58 56 54 17 16 10 6 9 79 78 80 82 91 185) +112 150 (133 62 58 56 54 2 1 15 76) +112 85 (133 62 58 56 54 17 16 10 6 8 48 38 40) +112 111 (133 132) +112 169 (133 62 58 56 54 17 16 10 6 9 79 78 80 82 87 88 90 179) +69 125 (99 34 30 27 28 19 7 6 10 16 17 54 56 59) +69 95 (99 34 30 27 28 19 7 8 48 38 41) +69 109 (99 34 30 27 28 19 7 8 42 43 131) +69 175 (99 34 30 27 28 19 20 79 78 80 82 91) +69 157 (99 34 30 27 28 19 7 6 10 16 0 3 69 64 65 72 169) +69 81 (99 34 32 33 108) +69 62 (99 34 30 27 29 93) +69 165 (99 34 30 27 28 19 20 79 78 80 82 87 88 90) +69 168 (99 34 30 27 28 19 20 79 78 80 82 87 88 90 178) +69 112 (99 34 30 27 28 19 7 6 10 16 17 54 56 58 62 133) +69 145 (99 34 30 27 28 19 7 6 10 16 0 3 70) +69 178 (99 34 30 27 28 19 20 79 78 80 82 91 186) +69 124 (99 34 30 27 28 19 7 6 10 16 17 54 57 143) +69 131 (99 34 30 27 28 19 7 6 10 16 17 52 53 148) +69 121 (99 34 30 27 28 19 7 6 10 16 17 54 57 140) +69 98 (99 34 30 27 28 19 7 8 48 38 41 122) +69 170 (99 34 30 27 28 19 20 79 78 81) +69 63 (99 34 30 27 29 94) +69 162 (99 34 30 27 28 19 20 79 78 80 82 87 88 89 173) +69 61 (99 34 30 27 29 92) +69 107 (99 34 30 27 28 19 7 8 42 43 129) +69 87 (99 34 30 27 28 19 7 8 48 38 40 113) +69 77 (99 34 30 31 105) +69 70 (99 34 35) +69 88 (99 34 30 27 28 19 7 8 48 38 40 114) +69 156 (99 34 30 27 28 19 7 6 10 16 0 3 69 64 65 72 168) +69 83 (99 34 32 33 110) +69 177 (99 34 30 27 28 19 20 79 78 80 82 91 185) +69 150 (99 34 30 27 28 19 7 6 10 16 0 1 15 76) +69 85 (99 34 30 27 28 19 7 8 48 38 40) +69 111 (99 34 30 27 28 19 7 6 10 16 17 54 56 58 62 132) +69 169 (99 34 30 27 28 19 20 79 78 80 82 87 88 90 179) +145 125 (70 3 2 54 56 59) +145 95 (70 3 0 16 10 6 8 48 38 41) +145 109 (70 3 0 16 10 6 8 42 43 131) +145 175 (70 3 0 16 10 6 9 79 78 80 82 91) +145 157 (70 69 64 65 72 169) +145 81 (70 3 0 16 10 6 7 19 28 27 30 32 33 108) +145 62 (70 3 0 16 10 6 7 19 28 29 93) +145 165 (70 3 0 16 10 6 9 79 78 80 82 87 88 90) +145 168 (70 3 0 16 10 6 9 79 78 80 82 87 88 90 178) +145 112 (70 3 2 54 56 58 62 133) +145 69 (70 3 0 16 10 6 7 19 28 27 30 34 99) +145 178 (70 3 0 16 10 6 9 79 78 80 82 91 186) +145 124 (70 3 2 54 57 143) +145 131 (70 3 2 52 53 148) +145 121 (70 3 2 54 57 140) +145 98 (70 3 0 16 10 6 8 48 38 41 122) +145 170 (70 3 0 16 10 6 9 79 78 81) +145 63 (70 3 0 16 10 6 7 19 28 29 94) +145 162 (70 3 0 16 10 6 9 79 78 80 82 87 88 89 173) +145 61 (70 3 0 16 10 6 7 19 28 29 92) +145 107 (70 3 0 16 10 6 8 42 43 129) +145 87 (70 3 0 16 10 6 8 48 38 40 113) +145 77 (70 3 0 16 10 6 7 19 28 27 31 105) +145 70 (70 3 0 16 10 6 7 19 28 27 30 35) +145 88 (70 3 0 16 10 6 8 48 38 40 114) +145 156 (70 69 64 65 72 168) +145 83 (70 3 0 16 10 6 7 19 28 27 30 32 33 110) +145 177 (70 3 0 16 10 6 9 79 78 80 82 91 185) +145 150 (70 3 1 15 76) +145 85 (70 3 0 16 10 6 8 48 38 40) +145 111 (70 3 2 54 56 58 62 132) +145 169 (70 3 0 16 10 6 9 79 78 80 82 87 88 90 179) +178 125 (186 91 82 80 78 79 9 6 10 16 17 54 56 59) +178 95 (186 91 82 80 78 79 9 8 48 38 41) +178 109 (186 91 82 80 78 79 9 8 42 43 131) +178 175 (186) +178 157 (186 91 82 80 78 79 9 6 10 16 0 3 69 64 65 72 169) +178 81 (186 91 82 80 78 79 20 19 28 27 30 32 33 108) +178 62 (186 91 82 80 78 79 20 19 28 29 93) +178 165 (186 91 87 88 90) +178 168 (186 91 87 88 90 178) +178 112 (186 91 82 80 78 79 9 6 10 16 17 54 56 58 62 133) +178 69 (186 91 82 80 78 79 20 19 28 27 30 34 99) +178 145 (186 91 82 80 78 79 9 6 10 16 0 3 70) +178 124 (186 91 82 80 78 79 9 6 10 16 17 54 57 143) +178 131 (186 91 82 80 78 79 9 6 10 16 17 52 53 148) +178 121 (186 91 82 80 78 79 9 6 10 16 17 54 57 140) +178 98 (186 91 82 80 78 79 9 8 48 38 41 122) +178 170 (186 91 82 80 81) +178 63 (186 91 82 80 78 79 20 19 28 29 94) +178 162 (186 91 87 88 89 173) +178 61 (186 91 82 80 78 79 20 19 28 29 92) +178 107 (186 91 82 80 78 79 9 8 42 43 129) +178 87 (186 91 82 80 78 79 9 8 48 38 40 113) +178 77 (186 91 82 80 78 79 20 19 28 27 31 105) +178 70 (186 91 82 80 78 79 20 19 28 27 30 35) +178 88 (186 91 82 80 78 79 9 8 48 38 40 114) +178 156 (186 91 82 80 78 79 9 6 10 16 0 3 69 64 65 72 168) +178 83 (186 91 82 80 78 79 20 19 28 27 30 32 33 110) +178 177 (186 185) +178 150 (186 91 82 80 78 79 9 6 10 16 0 1 15 76) +178 85 (186 91 82 80 78 79 9 8 48 38 40) +178 111 (186 91 82 80 78 79 9 6 10 16 17 54 56 58 62 132) +178 169 (186 91 87 88 90 179) +124 125 (143 57 56 59) +124 95 (143 57 54 17 16 10 6 8 48 38 41) +124 109 (143 57 54 17 16 10 6 8 42 43 131) +124 175 (143 57 54 17 16 10 6 9 79 78 80 82 91) +124 157 (143 57 54 2 3 69 64 65 72 169) +124 81 (143 57 54 17 16 10 6 7 19 28 27 30 32 33 108) +124 62 (143 57 54 17 16 10 6 7 19 28 29 93) +124 165 (143 57 54 17 16 10 6 9 79 78 80 82 87 88 90) +124 168 (143 57 54 17 16 10 6 9 79 78 80 82 87 88 90 178) +124 112 (143 57 56 58 62 133) +124 69 (143 57 54 17 16 10 6 7 19 28 27 30 34 99) +124 145 (143 57 54 2 3 70) +124 178 (143 57 54 17 16 10 6 9 79 78 80 82 91 186) +124 131 (143 57 54 52 53 148) +124 121 (143 140) +124 98 (143 57 54 17 16 10 6 8 48 38 41 122) +124 170 (143 57 54 17 16 10 6 9 79 78 81) +124 63 (143 57 54 17 16 10 6 7 19 28 29 94) +124 162 (143 57 54 17 16 10 6 9 79 78 80 82 87 88 89 173) +124 61 (143 57 54 17 16 10 6 7 19 28 29 92) +124 107 (143 57 54 17 16 10 6 8 42 43 129) +124 87 (143 57 54 17 16 10 6 8 48 38 40 113) +124 77 (143 57 54 17 16 10 6 7 19 28 27 31 105) +124 70 (143 57 54 17 16 10 6 7 19 28 27 30 35) +124 88 (143 57 54 17 16 10 6 8 48 38 40 114) +124 156 (143 57 54 2 3 69 64 65 72 168) +124 83 (143 57 54 17 16 10 6 7 19 28 27 30 32 33 110) +124 177 (143 57 54 17 16 10 6 9 79 78 80 82 91 185) +124 150 (143 57 54 2 1 15 76) +124 85 (143 57 54 17 16 10 6 8 48 38 40) +124 111 (143 57 56 58 62 132) +124 169 (143 57 54 17 16 10 6 9 79 78 80 82 87 88 90 179) +131 125 (148 53 52 54 56 59) +131 95 (148 53 52 17 16 10 6 8 48 38 41) +131 109 (148 53 52 17 16 10 6 8 42 43 131) +131 175 (148 53 52 17 16 10 6 9 79 78 80 82 91) +131 157 (148 53 52 2 3 69 64 65 72 169) +131 81 (148 53 52 17 16 10 6 7 19 28 27 30 32 33 108) +131 62 (148 53 52 17 16 10 6 7 19 28 29 93) +131 165 (148 53 52 17 16 10 6 9 79 78 80 82 87 88 90) +131 168 (148 53 52 17 16 10 6 9 79 78 80 82 87 88 90 178) +131 112 (148 53 52 54 56 58 62 133) +131 69 (148 53 52 17 16 10 6 7 19 28 27 30 34 99) +131 145 (148 53 52 2 3 70) +131 178 (148 53 52 17 16 10 6 9 79 78 80 82 91 186) +131 124 (148 53 52 54 57 143) +131 121 (148 53 52 54 57 140) +131 98 (148 53 52 17 16 10 6 8 48 38 41 122) +131 170 (148 53 52 17 16 10 6 9 79 78 81) +131 63 (148 53 52 17 16 10 6 7 19 28 29 94) +131 162 (148 53 52 17 16 10 6 9 79 78 80 82 87 88 89 173) +131 61 (148 53 52 17 16 10 6 7 19 28 29 92) +131 107 (148 53 52 17 16 10 6 8 42 43 129) +131 87 (148 53 52 17 16 10 6 8 48 38 40 113) +131 77 (148 53 52 17 16 10 6 7 19 28 27 31 105) +131 70 (148 53 52 17 16 10 6 7 19 28 27 30 35) +131 88 (148 53 52 17 16 10 6 8 48 38 40 114) +131 156 (148 53 52 2 3 69 64 65 72 168) +131 83 (148 53 52 17 16 10 6 7 19 28 27 30 32 33 110) +131 177 (148 53 52 17 16 10 6 9 79 78 80 82 91 185) +131 150 (148 53 52 2 1 15 76) +131 85 (148 53 52 17 16 10 6 8 48 38 40) +131 111 (148 53 52 54 56 58 62 132) +131 169 (148 53 52 17 16 10 6 9 79 78 80 82 87 88 90 179) +121 125 (140 57 56 59) +121 95 (140 57 54 17 16 10 6 8 48 38 41) +121 109 (140 57 54 17 16 10 6 8 42 43 131) +121 175 (140 57 54 17 16 10 6 9 79 78 80 82 91) +121 157 (140 57 54 2 3 69 64 65 72 169) +121 81 (140 57 54 17 16 10 6 7 19 28 27 30 32 33 108) +121 62 (140 57 54 17 16 10 6 7 19 28 29 93) +121 165 (140 57 54 17 16 10 6 9 79 78 80 82 87 88 90) +121 168 (140 57 54 17 16 10 6 9 79 78 80 82 87 88 90 178) +121 112 (140 57 56 58 62 133) +121 69 (140 57 54 17 16 10 6 7 19 28 27 30 34 99) +121 145 (140 57 54 2 3 70) +121 178 (140 57 54 17 16 10 6 9 79 78 80 82 91 186) +121 124 (140 143) +121 131 (140 57 54 52 53 148) +121 98 (140 57 54 17 16 10 6 8 48 38 41 122) +121 170 (140 57 54 17 16 10 6 9 79 78 81) +121 63 (140 57 54 17 16 10 6 7 19 28 29 94) +121 162 (140 57 54 17 16 10 6 9 79 78 80 82 87 88 89 173) +121 61 (140 57 54 17 16 10 6 7 19 28 29 92) +121 107 (140 57 54 17 16 10 6 8 42 43 129) +121 87 (140 57 54 17 16 10 6 8 48 38 40 113) +121 77 (140 57 54 17 16 10 6 7 19 28 27 31 105) +121 70 (140 57 54 17 16 10 6 7 19 28 27 30 35) +121 88 (140 57 54 17 16 10 6 8 48 38 40 114) +121 156 (140 57 54 2 3 69 64 65 72 168) +121 83 (140 57 54 17 16 10 6 7 19 28 27 30 32 33 110) +121 177 (140 57 54 17 16 10 6 9 79 78 80 82 91 185) +121 150 (140 57 54 2 1 15 76) +121 85 (140 57 54 17 16 10 6 8 48 38 40) +121 111 (140 57 56 58 62 132) +121 169 (140 57 54 17 16 10 6 9 79 78 80 82 87 88 90 179) +98 125 (122 41 38 48 8 6 10 16 17 54 56 59) +98 95 (122) +98 109 (122 41 38 48 42 43 131) +98 175 (122 41 38 48 8 9 79 78 80 82 91) +98 157 (122 41 38 48 8 6 10 16 0 3 69 64 65 72 169) +98 81 (122 41 38 48 8 7 19 28 27 30 32 33 108) +98 62 (122 41 38 48 8 7 19 28 29 93) +98 165 (122 41 38 48 8 9 79 78 80 82 87 88 90) +98 168 (122 41 38 48 8 9 79 78 80 82 87 88 90 178) +98 112 (122 41 38 48 8 6 10 16 17 54 56 58 62 133) +98 69 (122 41 38 48 8 7 19 28 27 30 34 99) +98 145 (122 41 38 48 8 6 10 16 0 3 70) +98 178 (122 41 38 48 8 9 79 78 80 82 91 186) +98 124 (122 41 38 48 8 6 10 16 17 54 57 143) +98 131 (122 41 38 48 8 6 10 16 17 52 53 148) +98 121 (122 41 38 48 8 6 10 16 17 54 57 140) +98 170 (122 41 38 48 8 9 79 78 81) +98 63 (122 41 38 48 8 7 19 28 29 94) +98 162 (122 41 38 48 8 9 79 78 80 82 87 88 89 173) +98 61 (122 41 38 48 8 7 19 28 29 92) +98 107 (122 41 38 48 42 43 129) +98 87 (122 41 40 113) +98 77 (122 41 38 48 8 7 19 28 27 31 105) +98 70 (122 41 38 48 8 7 19 28 27 30 35) +98 88 (122 41 40 114) +98 156 (122 41 38 48 8 6 10 16 0 3 69 64 65 72 168) +98 83 (122 41 38 48 8 7 19 28 27 30 32 33 110) +98 177 (122 41 38 48 8 9 79 78 80 82 91 185) +98 150 (122 41 38 48 8 6 10 16 0 1 15 76) +98 85 (122 41 40) +98 111 (122 41 38 48 8 6 10 16 17 54 56 58 62 132) +98 169 (122 41 38 48 8 9 79 78 80 82 87 88 90 179) +170 125 (81 78 79 9 6 10 16 17 54 56 59) +170 95 (81 78 79 9 8 48 38 41) +170 109 (81 78 79 9 8 42 43 131) +170 175 (81 80 82 91) +170 157 (81 78 79 9 6 10 16 0 3 69 64 65 72 169) +170 81 (81 78 79 20 19 28 27 30 32 33 108) +170 62 (81 78 79 20 19 28 29 93) +170 165 (81 80 82 87 88 90) +170 168 (81 80 82 87 88 90 178) +170 112 (81 78 79 9 6 10 16 17 54 56 58 62 133) +170 69 (81 78 79 20 19 28 27 30 34 99) +170 145 (81 78 79 9 6 10 16 0 3 70) +170 178 (81 80 82 91 186) +170 124 (81 78 79 9 6 10 16 17 54 57 143) +170 131 (81 78 79 9 6 10 16 17 52 53 148) +170 121 (81 78 79 9 6 10 16 17 54 57 140) +170 98 (81 78 79 9 8 48 38 41 122) +170 63 (81 78 79 20 19 28 29 94) +170 162 (81 80 82 87 88 89 173) +170 61 (81 78 79 20 19 28 29 92) +170 107 (81 78 79 9 8 42 43 129) +170 87 (81 78 79 9 8 48 38 40 113) +170 77 (81 78 79 20 19 28 27 31 105) +170 70 (81 78 79 20 19 28 27 30 35) +170 88 (81 78 79 9 8 48 38 40 114) +170 156 (81 78 79 9 6 10 16 0 3 69 64 65 72 168) +170 83 (81 78 79 20 19 28 27 30 32 33 110) +170 177 (81 80 82 91 185) +170 150 (81 78 79 9 6 10 16 0 1 15 76) +170 85 (81 78 79 9 8 48 38 40) +170 111 (81 78 79 9 6 10 16 17 54 56 58 62 132) +170 169 (81 80 82 87 88 90 179) +63 125 (94 29 28 19 7 6 10 16 17 54 56 59) +63 95 (94 29 28 19 7 8 48 38 41) +63 109 (94 29 28 19 7 8 42 43 131) +63 175 (94 29 28 19 20 79 78 80 82 91) +63 157 (94 29 28 19 7 6 10 16 0 3 69 64 65 72 169) +63 81 (94 29 27 30 32 33 108) +63 62 (94 93) +63 165 (94 29 28 19 20 79 78 80 82 87 88 90) +63 168 (94 29 28 19 20 79 78 80 82 87 88 90 178) +63 112 (94 29 28 19 7 6 10 16 17 54 56 58 62 133) +63 69 (94 29 27 30 34 99) +63 145 (94 29 28 19 7 6 10 16 0 3 70) +63 178 (94 29 28 19 20 79 78 80 82 91 186) +63 124 (94 29 28 19 7 6 10 16 17 54 57 143) +63 131 (94 29 28 19 7 6 10 16 17 52 53 148) +63 121 (94 29 28 19 7 6 10 16 17 54 57 140) +63 98 (94 29 28 19 7 8 48 38 41 122) +63 170 (94 29 28 19 20 79 78 81) +63 162 (94 29 28 19 20 79 78 80 82 87 88 89 173) +63 61 (94 92) +63 107 (94 29 28 19 7 8 42 43 129) +63 87 (94 29 28 19 7 8 48 38 40 113) +63 77 (94 29 27 31 105) +63 70 (94 29 27 30 35) +63 88 (94 29 28 19 7 8 48 38 40 114) +63 156 (94 29 28 19 7 6 10 16 0 3 69 64 65 72 168) +63 83 (94 29 27 30 32 33 110) +63 177 (94 29 28 19 20 79 78 80 82 91 185) +63 150 (94 29 28 19 7 6 10 16 0 1 15 76) +63 85 (94 29 28 19 7 8 48 38 40) +63 111 (94 29 28 19 7 6 10 16 17 54 56 58 62 132) +63 169 (94 29 28 19 20 79 78 80 82 87 88 90 179) +162 125 (173 89 88 87 82 80 78 79 9 6 10 16 17 54 56 59) +162 95 (173 89 88 87 82 80 78 79 9 8 48 38 41) +162 109 (173 89 88 87 82 80 78 79 9 8 42 43 131) +162 175 (173 89 88 87 91) +162 157 (173 89 88 87 82 80 78 79 9 6 10 16 0 3 69 64 65 72 169) +162 81 (173 89 88 87 82 80 78 79 20 19 28 27 30 32 33 108) +162 62 (173 89 88 87 82 80 78 79 20 19 28 29 93) +162 165 (173 89 90) +162 168 (173 89 90 178) +162 112 (173 89 88 87 82 80 78 79 9 6 10 16 17 54 56 58 62 133) +162 69 (173 89 88 87 82 80 78 79 20 19 28 27 30 34 99) +162 145 (173 89 88 87 82 80 78 79 9 6 10 16 0 3 70) +162 178 (173 89 88 87 91 186) +162 124 (173 89 88 87 82 80 78 79 9 6 10 16 17 54 57 143) +162 131 (173 89 88 87 82 80 78 79 9 6 10 16 17 52 53 148) +162 121 (173 89 88 87 82 80 78 79 9 6 10 16 17 54 57 140) +162 98 (173 89 88 87 82 80 78 79 9 8 48 38 41 122) +162 170 (173 89 88 87 82 80 81) +162 63 (173 89 88 87 82 80 78 79 20 19 28 29 94) +162 61 (173 89 88 87 82 80 78 79 20 19 28 29 92) +162 107 (173 89 88 87 82 80 78 79 9 8 42 43 129) +162 87 (173 89 88 87 82 80 78 79 9 8 48 38 40 113) +162 77 (173 89 88 87 82 80 78 79 20 19 28 27 31 105) +162 70 (173 89 88 87 82 80 78 79 20 19 28 27 30 35) +162 88 (173 89 88 87 82 80 78 79 9 8 48 38 40 114) +162 156 (173 89 88 87 82 80 78 79 9 6 10 16 0 3 69 64 65 72 168) +162 83 (173 89 88 87 82 80 78 79 20 19 28 27 30 32 33 110) +162 177 (173 89 88 87 91 185) +162 150 (173 89 88 87 82 80 78 79 9 6 10 16 0 1 15 76) +162 85 (173 89 88 87 82 80 78 79 9 8 48 38 40) +162 111 (173 89 88 87 82 80 78 79 9 6 10 16 17 54 56 58 62 132) +162 169 (173 89 90 179) +61 125 (92 29 28 19 7 6 10 16 17 54 56 59) +61 95 (92 29 28 19 7 8 48 38 41) +61 109 (92 29 28 19 7 8 42 43 131) +61 175 (92 29 28 19 20 79 78 80 82 91) +61 157 (92 29 28 19 7 6 10 16 0 3 69 64 65 72 169) +61 81 (92 29 27 30 32 33 108) +61 62 (92 93) +61 165 (92 29 28 19 20 79 78 80 82 87 88 90) +61 168 (92 29 28 19 20 79 78 80 82 87 88 90 178) +61 112 (92 29 28 19 7 6 10 16 17 54 56 58 62 133) +61 69 (92 29 27 30 34 99) +61 145 (92 29 28 19 7 6 10 16 0 3 70) +61 178 (92 29 28 19 20 79 78 80 82 91 186) +61 124 (92 29 28 19 7 6 10 16 17 54 57 143) +61 131 (92 29 28 19 7 6 10 16 17 52 53 148) +61 121 (92 29 28 19 7 6 10 16 17 54 57 140) +61 98 (92 29 28 19 7 8 48 38 41 122) +61 170 (92 29 28 19 20 79 78 81) +61 63 (92 94) +61 162 (92 29 28 19 20 79 78 80 82 87 88 89 173) +61 107 (92 29 28 19 7 8 42 43 129) +61 87 (92 29 28 19 7 8 48 38 40 113) +61 77 (92 29 27 31 105) +61 70 (92 29 27 30 35) +61 88 (92 29 28 19 7 8 48 38 40 114) +61 156 (92 29 28 19 7 6 10 16 0 3 69 64 65 72 168) +61 83 (92 29 27 30 32 33 110) +61 177 (92 29 28 19 20 79 78 80 82 91 185) +61 150 (92 29 28 19 7 6 10 16 0 1 15 76) +61 85 (92 29 28 19 7 8 48 38 40) +61 111 (92 29 28 19 7 6 10 16 17 54 56 58 62 132) +61 169 (92 29 28 19 20 79 78 80 82 87 88 90 179) +107 125 (129 43 42 8 6 10 16 17 54 56 59) +107 95 (129 43 42 48 38 41) +107 109 (129 131) +107 175 (129 43 42 8 9 79 78 80 82 91) +107 157 (129 43 42 8 6 10 16 0 3 69 64 65 72 169) +107 81 (129 43 42 8 7 19 28 27 30 32 33 108) +107 62 (129 43 42 8 7 19 28 29 93) +107 165 (129 43 42 8 9 79 78 80 82 87 88 90) +107 168 (129 43 42 8 9 79 78 80 82 87 88 90 178) +107 112 (129 43 42 8 6 10 16 17 54 56 58 62 133) +107 69 (129 43 42 8 7 19 28 27 30 34 99) +107 145 (129 43 42 8 6 10 16 0 3 70) +107 178 (129 43 42 8 9 79 78 80 82 91 186) +107 124 (129 43 42 8 6 10 16 17 54 57 143) +107 131 (129 43 42 8 6 10 16 17 52 53 148) +107 121 (129 43 42 8 6 10 16 17 54 57 140) +107 98 (129 43 42 48 38 41 122) +107 170 (129 43 42 8 9 79 78 81) +107 63 (129 43 42 8 7 19 28 29 94) +107 162 (129 43 42 8 9 79 78 80 82 87 88 89 173) +107 61 (129 43 42 8 7 19 28 29 92) +107 87 (129 43 42 48 38 40 113) +107 77 (129 43 42 8 7 19 28 27 31 105) +107 70 (129 43 42 8 7 19 28 27 30 35) +107 88 (129 43 42 48 38 40 114) +107 156 (129 43 42 8 6 10 16 0 3 69 64 65 72 168) +107 83 (129 43 42 8 7 19 28 27 30 32 33 110) +107 177 (129 43 42 8 9 79 78 80 82 91 185) +107 150 (129 43 42 8 6 10 16 0 1 15 76) +107 85 (129 43 42 48 38 40) +107 111 (129 43 42 8 6 10 16 17 54 56 58 62 132) +107 169 (129 43 42 8 9 79 78 80 82 87 88 90 179) +87 125 (113 40 38 48 8 6 10 16 17 54 56 59) +87 95 (113 40 41) +87 109 (113 40 38 48 42 43 131) +87 175 (113 40 38 48 8 9 79 78 80 82 91) +87 157 (113 40 38 48 8 6 10 16 0 3 69 64 65 72 169) +87 81 (113 40 38 48 8 7 19 28 27 30 32 33 108) +87 62 (113 40 38 48 8 7 19 28 29 93) +87 165 (113 40 38 48 8 9 79 78 80 82 87 88 90) +87 168 (113 40 38 48 8 9 79 78 80 82 87 88 90 178) +87 112 (113 40 38 48 8 6 10 16 17 54 56 58 62 133) +87 69 (113 40 38 48 8 7 19 28 27 30 34 99) +87 145 (113 40 38 48 8 6 10 16 0 3 70) +87 178 (113 40 38 48 8 9 79 78 80 82 91 186) +87 124 (113 40 38 48 8 6 10 16 17 54 57 143) +87 131 (113 40 38 48 8 6 10 16 17 52 53 148) +87 121 (113 40 38 48 8 6 10 16 17 54 57 140) +87 98 (113 40 41 122) +87 170 (113 40 38 48 8 9 79 78 81) +87 63 (113 40 38 48 8 7 19 28 29 94) +87 162 (113 40 38 48 8 9 79 78 80 82 87 88 89 173) +87 61 (113 40 38 48 8 7 19 28 29 92) +87 107 (113 40 38 48 42 43 129) +87 77 (113 40 38 48 8 7 19 28 27 31 105) +87 70 (113 40 38 48 8 7 19 28 27 30 35) +87 88 (113 114) +87 156 (113 40 38 48 8 6 10 16 0 3 69 64 65 72 168) +87 83 (113 40 38 48 8 7 19 28 27 30 32 33 110) +87 177 (113 40 38 48 8 9 79 78 80 82 91 185) +87 150 (113 40 38 48 8 6 10 16 0 1 15 76) +87 85 (113) +87 111 (113 40 38 48 8 6 10 16 17 54 56 58 62 132) +87 169 (113 40 38 48 8 9 79 78 80 82 87 88 90 179) +77 125 (105 31 27 28 19 7 6 10 16 17 54 56 59) +77 95 (105 31 27 28 19 7 8 48 38 41) +77 109 (105 31 27 28 19 7 8 42 43 131) +77 175 (105 31 27 28 19 20 79 78 80 82 91) +77 157 (105 31 27 28 19 7 6 10 16 0 3 69 64 65 72 169) +77 81 (105 31 30 32 33 108) +77 62 (105 31 27 29 93) +77 165 (105 31 27 28 19 20 79 78 80 82 87 88 90) +77 168 (105 31 27 28 19 20 79 78 80 82 87 88 90 178) +77 112 (105 31 27 28 19 7 6 10 16 17 54 56 58 62 133) +77 69 (105 31 30 34 99) +77 145 (105 31 27 28 19 7 6 10 16 0 3 70) +77 178 (105 31 27 28 19 20 79 78 80 82 91 186) +77 124 (105 31 27 28 19 7 6 10 16 17 54 57 143) +77 131 (105 31 27 28 19 7 6 10 16 17 52 53 148) +77 121 (105 31 27 28 19 7 6 10 16 17 54 57 140) +77 98 (105 31 27 28 19 7 8 48 38 41 122) +77 170 (105 31 27 28 19 20 79 78 81) +77 63 (105 31 27 29 94) +77 162 (105 31 27 28 19 20 79 78 80 82 87 88 89 173) +77 61 (105 31 27 29 92) +77 107 (105 31 27 28 19 7 8 42 43 129) +77 87 (105 31 27 28 19 7 8 48 38 40 113) +77 70 (105 31 30 35) +77 88 (105 31 27 28 19 7 8 48 38 40 114) +77 156 (105 31 27 28 19 7 6 10 16 0 3 69 64 65 72 168) +77 83 (105 31 30 32 33 110) +77 177 (105 31 27 28 19 20 79 78 80 82 91 185) +77 150 (105 31 27 28 19 7 6 10 16 0 1 15 76) +77 85 (105 31 27 28 19 7 8 48 38 40) +77 111 (105 31 27 28 19 7 6 10 16 17 54 56 58 62 132) +77 169 (105 31 27 28 19 20 79 78 80 82 87 88 90 179) +70 125 (35 30 27 28 19 7 6 10 16 17 54 56 59) +70 95 (35 30 27 28 19 7 8 48 38 41) +70 109 (35 30 27 28 19 7 8 42 43 131) +70 175 (35 30 27 28 19 20 79 78 80 82 91) +70 157 (35 30 27 28 19 7 6 10 16 0 3 69 64 65 72 169) +70 81 (35 32 33 108) +70 62 (35 30 27 29 93) +70 165 (35 30 27 28 19 20 79 78 80 82 87 88 90) +70 168 (35 30 27 28 19 20 79 78 80 82 87 88 90 178) +70 112 (35 30 27 28 19 7 6 10 16 17 54 56 58 62 133) +70 69 (35 34 99) +70 145 (35 30 27 28 19 7 6 10 16 0 3 70) +70 178 (35 30 27 28 19 20 79 78 80 82 91 186) +70 124 (35 30 27 28 19 7 6 10 16 17 54 57 143) +70 131 (35 30 27 28 19 7 6 10 16 17 52 53 148) +70 121 (35 30 27 28 19 7 6 10 16 17 54 57 140) +70 98 (35 30 27 28 19 7 8 48 38 41 122) +70 170 (35 30 27 28 19 20 79 78 81) +70 63 (35 30 27 29 94) +70 162 (35 30 27 28 19 20 79 78 80 82 87 88 89 173) +70 61 (35 30 27 29 92) +70 107 (35 30 27 28 19 7 8 42 43 129) +70 87 (35 30 27 28 19 7 8 48 38 40 113) +70 77 (35 30 31 105) +70 88 (35 30 27 28 19 7 8 48 38 40 114) +70 156 (35 30 27 28 19 7 6 10 16 0 3 69 64 65 72 168) +70 83 (35 32 33 110) +70 177 (35 30 27 28 19 20 79 78 80 82 91 185) +70 150 (35 30 27 28 19 7 6 10 16 0 1 15 76) +70 85 (35 30 27 28 19 7 8 48 38 40) +70 111 (35 30 27 28 19 7 6 10 16 17 54 56 58 62 132) +70 169 (35 30 27 28 19 20 79 78 80 82 87 88 90 179) +88 125 (114 40 38 48 8 6 10 16 17 54 56 59) +88 95 (114 40 41) +88 109 (114 40 38 48 42 43 131) +88 175 (114 40 38 48 8 9 79 78 80 82 91) +88 157 (114 40 38 48 8 6 10 16 0 3 69 64 65 72 169) +88 81 (114 40 38 48 8 7 19 28 27 30 32 33 108) +88 62 (114 40 38 48 8 7 19 28 29 93) +88 165 (114 40 38 48 8 9 79 78 80 82 87 88 90) +88 168 (114 40 38 48 8 9 79 78 80 82 87 88 90 178) +88 112 (114 40 38 48 8 6 10 16 17 54 56 58 62 133) +88 69 (114 40 38 48 8 7 19 28 27 30 34 99) +88 145 (114 40 38 48 8 6 10 16 0 3 70) +88 178 (114 40 38 48 8 9 79 78 80 82 91 186) +88 124 (114 40 38 48 8 6 10 16 17 54 57 143) +88 131 (114 40 38 48 8 6 10 16 17 52 53 148) +88 121 (114 40 38 48 8 6 10 16 17 54 57 140) +88 98 (114 40 41 122) +88 170 (114 40 38 48 8 9 79 78 81) +88 63 (114 40 38 48 8 7 19 28 29 94) +88 162 (114 40 38 48 8 9 79 78 80 82 87 88 89 173) +88 61 (114 40 38 48 8 7 19 28 29 92) +88 107 (114 40 38 48 42 43 129) +88 87 (114 113) +88 77 (114 40 38 48 8 7 19 28 27 31 105) +88 70 (114 40 38 48 8 7 19 28 27 30 35) +88 156 (114 40 38 48 8 6 10 16 0 3 69 64 65 72 168) +88 83 (114 40 38 48 8 7 19 28 27 30 32 33 110) +88 177 (114 40 38 48 8 9 79 78 80 82 91 185) +88 150 (114 40 38 48 8 6 10 16 0 1 15 76) +88 85 (114) +88 111 (114 40 38 48 8 6 10 16 17 54 56 58 62 132) +88 169 (114 40 38 48 8 9 79 78 80 82 87 88 90 179) +156 125 (168 72 65 64 69 3 2 54 56 59) +156 95 (168 72 65 64 69 3 0 16 10 6 8 48 38 41) +156 109 (168 72 65 64 69 3 0 16 10 6 8 42 43 131) +156 175 (168 72 65 64 69 3 0 16 10 6 9 79 78 80 82 91) +156 157 (168 169) +156 81 (168 72 65 64 69 3 0 16 10 6 7 19 28 27 30 32 33 108) +156 62 (168 72 65 64 69 3 0 16 10 6 7 19 28 29 93) +156 165 (168 72 65 64 69 3 0 16 10 6 9 79 78 80 82 87 88 90) +156 168 (168 72 65 64 69 3 0 16 10 6 9 79 78 80 82 87 88 90 178) +156 112 (168 72 65 64 69 3 2 54 56 58 62 133) +156 69 (168 72 65 64 69 3 0 16 10 6 7 19 28 27 30 34 99) +156 145 (168 72 65 64 69 70) +156 178 (168 72 65 64 69 3 0 16 10 6 9 79 78 80 82 91 186) +156 124 (168 72 65 64 69 3 2 54 57 143) +156 131 (168 72 65 64 69 3 2 52 53 148) +156 121 (168 72 65 64 69 3 2 54 57 140) +156 98 (168 72 65 64 69 3 0 16 10 6 8 48 38 41 122) +156 170 (168 72 65 64 69 3 0 16 10 6 9 79 78 81) +156 63 (168 72 65 64 69 3 0 16 10 6 7 19 28 29 94) +156 162 (168 72 65 64 69 3 0 16 10 6 9 79 78 80 82 87 88 89 173) +156 61 (168 72 65 64 69 3 0 16 10 6 7 19 28 29 92) +156 107 (168 72 65 64 69 3 0 16 10 6 8 42 43 129) +156 87 (168 72 65 64 69 3 0 16 10 6 8 48 38 40 113) +156 77 (168 72 65 64 69 3 0 16 10 6 7 19 28 27 31 105) +156 70 (168 72 65 64 69 3 0 16 10 6 7 19 28 27 30 35) +156 88 (168 72 65 64 69 3 0 16 10 6 8 48 38 40 114) +156 83 (168 72 65 64 69 3 0 16 10 6 7 19 28 27 30 32 33 110) +156 177 (168 72 65 64 69 3 0 16 10 6 9 79 78 80 82 91 185) +156 150 (168 72 65 64 73 74 76) +156 85 (168 72 65 64 69 3 0 16 10 6 8 48 38 40) +156 111 (168 72 65 64 69 3 2 54 56 58 62 132) +156 169 (168 72 65 64 69 3 0 16 10 6 9 79 78 80 82 87 88 90 179) +83 125 (110 33 32 30 27 28 19 7 6 10 16 17 54 56 59) +83 95 (110 33 32 30 27 28 19 7 8 48 38 41) +83 109 (110 33 32 30 27 28 19 7 8 42 43 131) +83 175 (110 33 32 30 27 28 19 20 79 78 80 82 91) +83 157 (110 33 32 30 27 28 19 7 6 10 16 0 3 69 64 65 72 169) +83 81 (110 108) +83 62 (110 33 32 30 27 29 93) +83 165 (110 33 32 30 27 28 19 20 79 78 80 82 87 88 90) +83 168 (110 33 32 30 27 28 19 20 79 78 80 82 87 88 90 178) +83 112 (110 33 32 30 27 28 19 7 6 10 16 17 54 56 58 62 133) +83 69 (110 33 32 34 99) +83 145 (110 33 32 30 27 28 19 7 6 10 16 0 3 70) +83 178 (110 33 32 30 27 28 19 20 79 78 80 82 91 186) +83 124 (110 33 32 30 27 28 19 7 6 10 16 17 54 57 143) +83 131 (110 33 32 30 27 28 19 7 6 10 16 17 52 53 148) +83 121 (110 33 32 30 27 28 19 7 6 10 16 17 54 57 140) +83 98 (110 33 32 30 27 28 19 7 8 48 38 41 122) +83 170 (110 33 32 30 27 28 19 20 79 78 81) +83 63 (110 33 32 30 27 29 94) +83 162 (110 33 32 30 27 28 19 20 79 78 80 82 87 88 89 173) +83 61 (110 33 32 30 27 29 92) +83 107 (110 33 32 30 27 28 19 7 8 42 43 129) +83 87 (110 33 32 30 27 28 19 7 8 48 38 40 113) +83 77 (110 33 32 30 31 105) +83 70 (110 33 32 35) +83 88 (110 33 32 30 27 28 19 7 8 48 38 40 114) +83 156 (110 33 32 30 27 28 19 7 6 10 16 0 3 69 64 65 72 168) +83 177 (110 33 32 30 27 28 19 20 79 78 80 82 91 185) +83 150 (110 33 32 30 27 28 19 7 6 10 16 0 1 15 76) +83 85 (110 33 32 30 27 28 19 7 8 48 38 40) +83 111 (110 33 32 30 27 28 19 7 6 10 16 17 54 56 58 62 132) +83 169 (110 33 32 30 27 28 19 20 79 78 80 82 87 88 90 179) +177 125 (185 91 82 80 78 79 9 6 10 16 17 54 56 59) +177 95 (185 91 82 80 78 79 9 8 48 38 41) +177 109 (185 91 82 80 78 79 9 8 42 43 131) +177 175 (185) +177 157 (185 91 82 80 78 79 9 6 10 16 0 3 69 64 65 72 169) +177 81 (185 91 82 80 78 79 20 19 28 27 30 32 33 108) +177 62 (185 91 82 80 78 79 20 19 28 29 93) +177 165 (185 91 87 88 90) +177 168 (185 91 87 88 90 178) +177 112 (185 91 82 80 78 79 9 6 10 16 17 54 56 58 62 133) +177 69 (185 91 82 80 78 79 20 19 28 27 30 34 99) +177 145 (185 91 82 80 78 79 9 6 10 16 0 3 70) +177 178 (185 186) +177 124 (185 91 82 80 78 79 9 6 10 16 17 54 57 143) +177 131 (185 91 82 80 78 79 9 6 10 16 17 52 53 148) +177 121 (185 91 82 80 78 79 9 6 10 16 17 54 57 140) +177 98 (185 91 82 80 78 79 9 8 48 38 41 122) +177 170 (185 91 82 80 81) +177 63 (185 91 82 80 78 79 20 19 28 29 94) +177 162 (185 91 87 88 89 173) +177 61 (185 91 82 80 78 79 20 19 28 29 92) +177 107 (185 91 82 80 78 79 9 8 42 43 129) +177 87 (185 91 82 80 78 79 9 8 48 38 40 113) +177 77 (185 91 82 80 78 79 20 19 28 27 31 105) +177 70 (185 91 82 80 78 79 20 19 28 27 30 35) +177 88 (185 91 82 80 78 79 9 8 48 38 40 114) +177 156 (185 91 82 80 78 79 9 6 10 16 0 3 69 64 65 72 168) +177 83 (185 91 82 80 78 79 20 19 28 27 30 32 33 110) +177 150 (185 91 82 80 78 79 9 6 10 16 0 1 15 76) +177 85 (185 91 82 80 78 79 9 8 48 38 40) +177 111 (185 91 82 80 78 79 9 6 10 16 17 54 56 58 62 132) +177 169 (185 91 87 88 90 179) +150 125 (76 15 1 2 54 56 59) +150 95 (76 15 1 0 16 10 6 8 48 38 41) +150 109 (76 15 1 0 16 10 6 8 42 43 131) +150 175 (76 15 1 0 16 10 6 9 79 78 80 82 91) +150 157 (76 74 73 64 65 72 169) +150 81 (76 15 1 0 16 10 6 7 19 28 27 30 32 33 108) +150 62 (76 15 1 0 16 10 6 7 19 28 29 93) +150 165 (76 15 1 0 16 10 6 9 79 78 80 82 87 88 90) +150 168 (76 15 1 0 16 10 6 9 79 78 80 82 87 88 90 178) +150 112 (76 15 1 2 54 56 58 62 133) +150 69 (76 15 1 0 16 10 6 7 19 28 27 30 34 99) +150 145 (76 74 73 69 70) +150 178 (76 15 1 0 16 10 6 9 79 78 80 82 91 186) +150 124 (76 15 1 2 54 57 143) +150 131 (76 15 1 2 52 53 148) +150 121 (76 15 1 2 54 57 140) +150 98 (76 15 1 0 16 10 6 8 48 38 41 122) +150 170 (76 15 1 0 16 10 6 9 79 78 81) +150 63 (76 15 1 0 16 10 6 7 19 28 29 94) +150 162 (76 15 1 0 16 10 6 9 79 78 80 82 87 88 89 173) +150 61 (76 15 1 0 16 10 6 7 19 28 29 92) +150 107 (76 15 1 0 16 10 6 8 42 43 129) +150 87 (76 15 1 0 16 10 6 8 48 38 40 113) +150 77 (76 15 1 0 16 10 6 7 19 28 27 31 105) +150 70 (76 15 1 0 16 10 6 7 19 28 27 30 35) +150 88 (76 15 1 0 16 10 6 8 48 38 40 114) +150 156 (76 74 73 64 65 72 168) +150 83 (76 15 1 0 16 10 6 7 19 28 27 30 32 33 110) +150 177 (76 15 1 0 16 10 6 9 79 78 80 82 91 185) +150 85 (76 15 1 0 16 10 6 8 48 38 40) +150 111 (76 15 1 2 54 56 58 62 132) +150 169 (76 15 1 0 16 10 6 9 79 78 80 82 87 88 90 179) +85 125 (40 38 48 8 6 10 16 17 54 56 59) +85 95 (40 41) +85 109 (40 38 48 42 43 131) +85 175 (40 38 48 8 9 79 78 80 82 91) +85 157 (40 38 48 8 6 10 16 0 3 69 64 65 72 169) +85 81 (40 38 48 8 7 19 28 27 30 32 33 108) +85 62 (40 38 48 8 7 19 28 29 93) +85 165 (40 38 48 8 9 79 78 80 82 87 88 90) +85 168 (40 38 48 8 9 79 78 80 82 87 88 90 178) +85 112 (40 38 48 8 6 10 16 17 54 56 58 62 133) +85 69 (40 38 48 8 7 19 28 27 30 34 99) +85 145 (40 38 48 8 6 10 16 0 3 70) +85 178 (40 38 48 8 9 79 78 80 82 91 186) +85 124 (40 38 48 8 6 10 16 17 54 57 143) +85 131 (40 38 48 8 6 10 16 17 52 53 148) +85 121 (40 38 48 8 6 10 16 17 54 57 140) +85 98 (40 41 122) +85 170 (40 38 48 8 9 79 78 81) +85 63 (40 38 48 8 7 19 28 29 94) +85 162 (40 38 48 8 9 79 78 80 82 87 88 89 173) +85 61 (40 38 48 8 7 19 28 29 92) +85 107 (40 38 48 42 43 129) +85 87 (113) +85 77 (40 38 48 8 7 19 28 27 31 105) +85 70 (40 38 48 8 7 19 28 27 30 35) +85 88 (114) +85 156 (40 38 48 8 6 10 16 0 3 69 64 65 72 168) +85 83 (40 38 48 8 7 19 28 27 30 32 33 110) +85 177 (40 38 48 8 9 79 78 80 82 91 185) +85 150 (40 38 48 8 6 10 16 0 1 15 76) +85 111 (40 38 48 8 6 10 16 17 54 56 58 62 132) +85 169 (40 38 48 8 9 79 78 80 82 87 88 90 179) +111 125 (132 62 58 59) +111 95 (132 62 58 56 54 17 16 10 6 8 48 38 41) +111 109 (132 62 58 56 54 17 16 10 6 8 42 43 131) +111 175 (132 62 58 56 54 17 16 10 6 9 79 78 80 82 91) +111 157 (132 62 58 56 54 2 3 69 64 65 72 169) +111 81 (132 62 58 56 54 17 16 10 6 7 19 28 27 30 32 33 108) +111 62 (132 62 58 56 54 17 16 10 6 7 19 28 29 93) +111 165 (132 62 58 56 54 17 16 10 6 9 79 78 80 82 87 88 90) +111 168 (132 62 58 56 54 17 16 10 6 9 79 78 80 82 87 88 90 178) +111 112 (132 133) +111 69 (132 62 58 56 54 17 16 10 6 7 19 28 27 30 34 99) +111 145 (132 62 58 56 54 2 3 70) +111 178 (132 62 58 56 54 17 16 10 6 9 79 78 80 82 91 186) +111 124 (132 62 58 56 57 143) +111 131 (132 62 58 56 54 52 53 148) +111 121 (132 62 58 56 57 140) +111 98 (132 62 58 56 54 17 16 10 6 8 48 38 41 122) +111 170 (132 62 58 56 54 17 16 10 6 9 79 78 81) +111 63 (132 62 58 56 54 17 16 10 6 7 19 28 29 94) +111 162 (132 62 58 56 54 17 16 10 6 9 79 78 80 82 87 88 89 173) +111 61 (132 62 58 56 54 17 16 10 6 7 19 28 29 92) +111 107 (132 62 58 56 54 17 16 10 6 8 42 43 129) +111 87 (132 62 58 56 54 17 16 10 6 8 48 38 40 113) +111 77 (132 62 58 56 54 17 16 10 6 7 19 28 27 31 105) +111 70 (132 62 58 56 54 17 16 10 6 7 19 28 27 30 35) +111 88 (132 62 58 56 54 17 16 10 6 8 48 38 40 114) +111 156 (132 62 58 56 54 2 3 69 64 65 72 168) +111 83 (132 62 58 56 54 17 16 10 6 7 19 28 27 30 32 33 110) +111 177 (132 62 58 56 54 17 16 10 6 9 79 78 80 82 91 185) +111 150 (132 62 58 56 54 2 1 15 76) +111 85 (132 62 58 56 54 17 16 10 6 8 48 38 40) +111 169 (132 62 58 56 54 17 16 10 6 9 79 78 80 82 87 88 90 179) +169 125 (179 90 88 87 82 80 78 79 9 6 10 16 17 54 56 59) +169 95 (179 90 88 87 82 80 78 79 9 8 48 38 41) +169 109 (179 90 88 87 82 80 78 79 9 8 42 43 131) +169 175 (179 90 88 87 91) +169 157 (179 90 88 87 82 80 78 79 9 6 10 16 0 3 69 64 65 72 169) +169 81 (179 90 88 87 82 80 78 79 20 19 28 27 30 32 33 108) +169 62 (179 90 88 87 82 80 78 79 20 19 28 29 93) +169 165 (179) +169 168 (179 178) +169 112 (179 90 88 87 82 80 78 79 9 6 10 16 17 54 56 58 62 133) +169 69 (179 90 88 87 82 80 78 79 20 19 28 27 30 34 99) +169 145 (179 90 88 87 82 80 78 79 9 6 10 16 0 3 70) +169 178 (179 90 88 87 91 186) +169 124 (179 90 88 87 82 80 78 79 9 6 10 16 17 54 57 143) +169 131 (179 90 88 87 82 80 78 79 9 6 10 16 17 52 53 148) +169 121 (179 90 88 87 82 80 78 79 9 6 10 16 17 54 57 140) +169 98 (179 90 88 87 82 80 78 79 9 8 48 38 41 122) +169 170 (179 90 88 87 82 80 81) +169 63 (179 90 88 87 82 80 78 79 20 19 28 29 94) +169 162 (179 90 89 173) +169 61 (179 90 88 87 82 80 78 79 20 19 28 29 92) +169 107 (179 90 88 87 82 80 78 79 9 8 42 43 129) +169 87 (179 90 88 87 82 80 78 79 9 8 48 38 40 113) +169 77 (179 90 88 87 82 80 78 79 20 19 28 27 31 105) +169 70 (179 90 88 87 82 80 78 79 20 19 28 27 30 35) +169 88 (179 90 88 87 82 80 78 79 9 8 48 38 40 114) +169 156 (179 90 88 87 82 80 78 79 9 6 10 16 0 3 69 64 65 72 168) +169 83 (179 90 88 87 82 80 78 79 20 19 28 27 30 32 33 110) +169 177 (179 90 88 87 91 185) +169 150 (179 90 88 87 82 80 78 79 9 6 10 16 0 1 15 76) +169 85 (179 90 88 87 82 80 78 79 9 8 48 38 40) +169 111 (179 90 88 87 82 80 78 79 9 6 10 16 17 54 56 58 62 132) diff --git a/examples/WAN_3.platform_2.txt b/examples/WAN_3.platform_2.txt new file mode 100644 index 0000000000..8308790555 --- /dev/null +++ b/examples/WAN_3.platform_2.txt @@ -0,0 +1,1285 @@ +MSG_PLATFORM_DSC 1.0 +HOSTS +125 137.333 +95 171.667 +109 137.333 +175 114.444 +157 98.094999999999999 +81 34.333 +62 114.444 +165 98.094999999999999 +168 42.917000000000002 +112 76.296000000000006 +69 114.444 +145 114.444 +178 98.094999999999999 +124 137.333 +131 76.296000000000006 +121 85.832999999999998 +98 22.151 +170 34.333 +63 68.667000000000002 +162 114.444 +61 68.667000000000002 +107 42.917000000000002 +87 68.667000000000002 +77 48.492 +70 85.832999999999998 +88 76.296000000000006 +156 22.151 +83 114.444 +177 114.444 +150 42.917000000000002 +85 114.444 +111 137.333 +169 34.333 +LINKS +127 4.133375 0.0 +32 27.94625 0.0 +90 34.285625 0.0 +118 3.275625 0.0 +71 15.376875 0.0 +102 1.04925 0.0 +18 118.6825 0.0 +125 3.29775 0.0 +16 41.279125 0.0 +44 10.314625 0.0 +55 8.015125 0.0 +84 8.015125 0.0 +27 10.099625 0.0 +190 0.76875 0.0 +161 2.179125 0.0 +95 3.71425 0.0 +57 34.285625 0.0 +20 132.977875 0.0 +163 5.7585 0.0 +109 1.326125 0.0 +151 6.777 0.0 +89 41.279125 0.0 +175 1.892625 0.0 +148 5.299 0.0 +31 34.285625 0.0 +35 11.845375 0.0 +11 41.279125 0.0 +78 10.314625 0.0 +93 0.979625 0.0 +106 3.37125 0.0 +157 2.227375 0.0 +65 34.285625 0.0 +29 8.015125 0.0 +138 1.8855 0.0 +114 3.275625 0.0 +58 11.618875 0.0 +153 1.62775 0.0 +15 118.6825 0.0 +137 1.4655 0.0 +81 11.845375 0.0 +60 10.314625 0.0 +101 0.117125 0.0 +73 8.42725 0.0 +86 8.158 0.0 +76 10.099625 0.0 +62 8.42725 0.0 +67 41.279125 0.0 +165 1.51525 0.0 +139 1.126875 0.0 +129 0.578625 0.0 +2 41.279125 0.0 +17 118.6825 0.0 +186 5.299 0.0 +110 3.9315 0.0 +82 8.158 0.0 +147 0.274375 0.0 +168 2.368 0.0 +184 1.931125 0.0 +135 0.605 0.0 +14 118.6825 0.0 +112 3.430125 0.0 +69 11.618875 0.0 +191 1.23025 0.0 +172 1.8855 0.0 +145 2.227375 0.0 +49 34.285625 0.0 +178 0.578625 0.0 +24 34.285625 0.0 +187 0.303375 0.0 +140 1.469125 0.0 +124 2.227375 0.0 +104 0.253125 0.0 +131 0.253125 0.0 +181 5.816375 0.0 +121 3.9315 0.0 +79 8.42725 0.0 +154 0.251625 0.0 +0 255.228625 0.0 +23 8.42725 0.0 +96 0.926625 0.0 +126 1.04925 0.0 +159 0.556 0.0 +160 0.251625 0.0 +176 2.3485 0.0 +47 11.618875 0.0 +8 34.285625 0.0 +98 2.227375 0.0 +37 8.42725 0.0 +117 1.04925 0.0 +43 10.314625 0.0 +5 255.228625 0.0 +170 7.20975 0.0 +33 27.94625 0.0 +21 41.279125 0.0 +63 10.099625 0.0 +7 255.228625 0.0 +26 34.285625 0.0 +80 8.42725 0.0 +119 5.18975 0.0 +180 1.8855 0.0 +99 1.281875 0.0 +179 1.467625 0.0 +162 1.51525 0.0 +72 21.41475 0.0 +74 41.279125 0.0 +182 1.4655 0.0 +61 8.015125 0.0 +108 3.37125 0.0 +115 0.721625 0.0 +92 2.179125 0.0 +103 0.9905 0.0 +10 132.977875 0.0 +113 6.551 0.0 +152 0.253125 0.0 +189 5.228375 0.0 +142 0.76875 0.0 +91 41.279125 0.0 +167 0.578625 0.0 +48 15.376875 0.0 +107 2.3485 0.0 +87 41.279125 0.0 +174 0.317375 0.0 +77 10.099625 0.0 +133 1.931125 0.0 +149 0.274375 0.0 +123 4.27025 0.0 +50 10.314625 0.0 +39 8.42725 0.0 +64 11.845375 0.0 +97 1.23025 0.0 +12 118.6825 0.0 +41 15.376875 0.0 +52 11.845375 0.0 +173 4.416625 0.0 +56 10.314625 0.0 +45 10.314625 0.0 +66 27.94625 0.0 +19 132.977875 0.0 +54 8.158 0.0 +70 27.94625 0.0 +188 2.583375 0.0 +68 27.94625 0.0 +166 0.605 0.0 +1 132.977875 0.0 +136 1.469125 0.0 +88 34.285625 0.0 +116 0.578625 0.0 +144 1.281875 0.0 +141 2.583375 0.0 +30 11.845375 0.0 +100 3.068375 0.0 +25 27.94625 0.0 +128 0.9905 0.0 +28 15.376875 0.0 +120 0.9905 0.0 +156 2.23825 0.0 +134 1.04925 0.0 +40 11.845375 0.0 +75 41.279125 0.0 +83 11.845375 0.0 +59 21.41475 0.0 +177 3.9955 0.0 +150 4.817 0.0 +155 3.9315 0.0 +130 1.858 0.0 +53 8.42725 0.0 +122 3.068375 0.0 +143 1.326125 0.0 +158 3.8775 0.0 +42 10.314625 0.0 +22 11.845375 0.0 +46 10.314625 0.0 +13 41.279125 0.0 +105 0.272375 0.0 +6 255.228625 0.0 +85 41.279125 0.0 +185 1.281875 0.0 +36 8.158 0.0 +3 118.6825 0.0 +183 1.281875 0.0 +94 3.275625 0.0 +146 5.574625 0.0 +51 8.158 0.0 +9 41.279125 0.0 +111 2.227375 0.0 +38 11.618875 0.0 +4 41.279125 0.0 +34 41.279125 0.0 +169 4.840375 0.0 +164 0.605 0.0 +132 0.472125 0.0 +171 0.253125 0.0 +ROUTES +125 95 (59 56 54 17 16 10 6 8 48 38 41) +125 109 (59 56 54 17 16 10 6 8 42 43 131) +125 175 (59 56 54 17 16 10 6 9 79 78 80 82 91) +125 157 (59 56 54 2 3 69 64 65 72 169) +125 81 (59 56 54 17 16 10 6 7 19 28 27 30 32 33 108) +125 62 (59 56 54 17 16 10 6 7 19 28 29 93) +125 165 (59 56 54 17 16 10 6 9 79 78 80 82 87 88 90) +125 168 (59 56 54 17 16 10 6 9 79 78 80 82 87 88 90 178) +125 112 (59 58 62 133) +125 69 (59 56 54 17 16 10 6 7 19 28 27 30 34 99) +125 145 (59 56 54 2 3 70) +125 178 (59 56 54 17 16 10 6 9 79 78 80 82 91 186) +125 124 (59 56 57 143) +125 131 (59 56 54 52 53 148) +125 121 (59 56 57 140) +125 98 (59 56 54 17 16 10 6 8 48 38 41 122) +125 170 (59 56 54 17 16 10 6 9 79 78 81) +125 63 (59 56 54 17 16 10 6 7 19 28 29 94) +125 162 (59 56 54 17 16 10 6 9 79 78 80 82 87 88 89 173) +125 61 (59 56 54 17 16 10 6 7 19 28 29 92) +125 107 (59 56 54 17 16 10 6 8 42 43 129) +125 87 (59 56 54 17 16 10 6 8 48 38 40 113) +125 77 (59 56 54 17 16 10 6 7 19 28 27 31 105) +125 70 (59 56 54 17 16 10 6 7 19 28 27 30 35) +125 88 (59 56 54 17 16 10 6 8 48 38 40 114) +125 156 (59 56 54 2 3 69 64 65 72 168) +125 83 (59 56 54 17 16 10 6 7 19 28 27 30 32 33 110) +125 177 (59 56 54 17 16 10 6 9 79 78 80 82 91 185) +125 150 (59 56 54 2 1 15 76) +125 85 (59 56 54 17 16 10 6 8 48 38 40) +125 111 (59 58 62 132) +125 169 (59 56 54 17 16 10 6 9 79 78 80 82 87 88 90 179) +95 125 (41 38 48 8 6 10 16 17 54 56 59) +95 109 (41 38 48 42 43 131) +95 175 (41 38 48 8 9 79 78 80 82 91) +95 157 (41 38 48 8 6 10 16 0 3 69 64 65 72 169) +95 81 (41 38 48 8 7 19 28 27 30 32 33 108) +95 62 (41 38 48 8 7 19 28 29 93) +95 165 (41 38 48 8 9 79 78 80 82 87 88 90) +95 168 (41 38 48 8 9 79 78 80 82 87 88 90 178) +95 112 (41 38 48 8 6 10 16 17 54 56 58 62 133) +95 69 (41 38 48 8 7 19 28 27 30 34 99) +95 145 (41 38 48 8 6 10 16 0 3 70) +95 178 (41 38 48 8 9 79 78 80 82 91 186) +95 124 (41 38 48 8 6 10 16 17 54 57 143) +95 131 (41 38 48 8 6 10 16 17 52 53 148) +95 121 (41 38 48 8 6 10 16 17 54 57 140) +95 98 (122) +95 170 (41 38 48 8 9 79 78 81) +95 63 (41 38 48 8 7 19 28 29 94) +95 162 (41 38 48 8 9 79 78 80 82 87 88 89 173) +95 61 (41 38 48 8 7 19 28 29 92) +95 107 (41 38 48 42 43 129) +95 87 (41 40 113) +95 77 (41 38 48 8 7 19 28 27 31 105) +95 70 (41 38 48 8 7 19 28 27 30 35) +95 88 (41 40 114) +95 156 (41 38 48 8 6 10 16 0 3 69 64 65 72 168) +95 83 (41 38 48 8 7 19 28 27 30 32 33 110) +95 177 (41 38 48 8 9 79 78 80 82 91 185) +95 150 (41 38 48 8 6 10 16 0 1 15 76) +95 85 (41 40) +95 111 (41 38 48 8 6 10 16 17 54 56 58 62 132) +95 169 (41 38 48 8 9 79 78 80 82 87 88 90 179) +109 125 (131 43 42 8 6 10 16 17 54 56 59) +109 95 (131 43 42 48 38 41) +109 175 (131 43 42 8 9 79 78 80 82 91) +109 157 (131 43 42 8 6 10 16 0 3 69 64 65 72 169) +109 81 (131 43 42 8 7 19 28 27 30 32 33 108) +109 62 (131 43 42 8 7 19 28 29 93) +109 165 (131 43 42 8 9 79 78 80 82 87 88 90) +109 168 (131 43 42 8 9 79 78 80 82 87 88 90 178) +109 112 (131 43 42 8 6 10 16 17 54 56 58 62 133) +109 69 (131 43 42 8 7 19 28 27 30 34 99) +109 145 (131 43 42 8 6 10 16 0 3 70) +109 178 (131 43 42 8 9 79 78 80 82 91 186) +109 124 (131 43 42 8 6 10 16 17 54 57 143) +109 131 (131 43 42 8 6 10 16 17 52 53 148) +109 121 (131 43 42 8 6 10 16 17 54 57 140) +109 98 (131 43 42 48 38 41 122) +109 170 (131 43 42 8 9 79 78 81) +109 63 (131 43 42 8 7 19 28 29 94) +109 162 (131 43 42 8 9 79 78 80 82 87 88 89 173) +109 61 (131 43 42 8 7 19 28 29 92) +109 107 (131 129) +109 87 (131 43 42 48 38 40 113) +109 77 (131 43 42 8 7 19 28 27 31 105) +109 70 (131 43 42 8 7 19 28 27 30 35) +109 88 (131 43 42 48 38 40 114) +109 156 (131 43 42 8 6 10 16 0 3 69 64 65 72 168) +109 83 (131 43 42 8 7 19 28 27 30 32 33 110) +109 177 (131 43 42 8 9 79 78 80 82 91 185) +109 150 (131 43 42 8 6 10 16 0 1 15 76) +109 85 (131 43 42 48 38 40) +109 111 (131 43 42 8 6 10 16 17 54 56 58 62 132) +109 169 (131 43 42 8 9 79 78 80 82 87 88 90 179) +175 125 (91 82 80 78 79 9 6 10 16 17 54 56 59) +175 95 (91 82 80 78 79 9 8 48 38 41) +175 109 (91 82 80 78 79 9 8 42 43 131) +175 157 (91 82 80 78 79 9 6 10 16 0 3 69 64 65 72 169) +175 81 (91 82 80 78 79 20 19 28 27 30 32 33 108) +175 62 (91 82 80 78 79 20 19 28 29 93) +175 165 (91 87 88 90) +175 168 (91 87 88 90 178) +175 112 (91 82 80 78 79 9 6 10 16 17 54 56 58 62 133) +175 69 (91 82 80 78 79 20 19 28 27 30 34 99) +175 145 (91 82 80 78 79 9 6 10 16 0 3 70) +175 178 (186) +175 124 (91 82 80 78 79 9 6 10 16 17 54 57 143) +175 131 (91 82 80 78 79 9 6 10 16 17 52 53 148) +175 121 (91 82 80 78 79 9 6 10 16 17 54 57 140) +175 98 (91 82 80 78 79 9 8 48 38 41 122) +175 170 (91 82 80 81) +175 63 (91 82 80 78 79 20 19 28 29 94) +175 162 (91 87 88 89 173) +175 61 (91 82 80 78 79 20 19 28 29 92) +175 107 (91 82 80 78 79 9 8 42 43 129) +175 87 (91 82 80 78 79 9 8 48 38 40 113) +175 77 (91 82 80 78 79 20 19 28 27 31 105) +175 70 (91 82 80 78 79 20 19 28 27 30 35) +175 88 (91 82 80 78 79 9 8 48 38 40 114) +175 156 (91 82 80 78 79 9 6 10 16 0 3 69 64 65 72 168) +175 83 (91 82 80 78 79 20 19 28 27 30 32 33 110) +175 177 (185) +175 150 (91 82 80 78 79 9 6 10 16 0 1 15 76) +175 85 (91 82 80 78 79 9 8 48 38 40) +175 111 (91 82 80 78 79 9 6 10 16 17 54 56 58 62 132) +175 169 (91 87 88 90 179) +157 125 (169 72 65 64 69 3 2 54 56 59) +157 95 (169 72 65 64 69 3 0 16 10 6 8 48 38 41) +157 109 (169 72 65 64 69 3 0 16 10 6 8 42 43 131) +157 175 (169 72 65 64 69 3 0 16 10 6 9 79 78 80 82 91) +157 81 (169 72 65 64 69 3 0 16 10 6 7 19 28 27 30 32 33 108) +157 62 (169 72 65 64 69 3 0 16 10 6 7 19 28 29 93) +157 165 (169 72 65 64 69 3 0 16 10 6 9 79 78 80 82 87 88 90) +157 168 (169 72 65 64 69 3 0 16 10 6 9 79 78 80 82 87 88 90 178) +157 112 (169 72 65 64 69 3 2 54 56 58 62 133) +157 69 (169 72 65 64 69 3 0 16 10 6 7 19 28 27 30 34 99) +157 145 (169 72 65 64 69 70) +157 178 (169 72 65 64 69 3 0 16 10 6 9 79 78 80 82 91 186) +157 124 (169 72 65 64 69 3 2 54 57 143) +157 131 (169 72 65 64 69 3 2 52 53 148) +157 121 (169 72 65 64 69 3 2 54 57 140) +157 98 (169 72 65 64 69 3 0 16 10 6 8 48 38 41 122) +157 170 (169 72 65 64 69 3 0 16 10 6 9 79 78 81) +157 63 (169 72 65 64 69 3 0 16 10 6 7 19 28 29 94) +157 162 (169 72 65 64 69 3 0 16 10 6 9 79 78 80 82 87 88 89 173) +157 61 (169 72 65 64 69 3 0 16 10 6 7 19 28 29 92) +157 107 (169 72 65 64 69 3 0 16 10 6 8 42 43 129) +157 87 (169 72 65 64 69 3 0 16 10 6 8 48 38 40 113) +157 77 (169 72 65 64 69 3 0 16 10 6 7 19 28 27 31 105) +157 70 (169 72 65 64 69 3 0 16 10 6 7 19 28 27 30 35) +157 88 (169 72 65 64 69 3 0 16 10 6 8 48 38 40 114) +157 156 (169 168) +157 83 (169 72 65 64 69 3 0 16 10 6 7 19 28 27 30 32 33 110) +157 177 (169 72 65 64 69 3 0 16 10 6 9 79 78 80 82 91 185) +157 150 (169 72 65 64 73 74 76) +157 85 (169 72 65 64 69 3 0 16 10 6 8 48 38 40) +157 111 (169 72 65 64 69 3 2 54 56 58 62 132) +157 169 (169 72 65 64 69 3 0 16 10 6 9 79 78 80 82 87 88 90 179) +81 125 (108 33 32 30 27 28 19 7 6 10 16 17 54 56 59) +81 95 (108 33 32 30 27 28 19 7 8 48 38 41) +81 109 (108 33 32 30 27 28 19 7 8 42 43 131) +81 175 (108 33 32 30 27 28 19 20 79 78 80 82 91) +81 157 (108 33 32 30 27 28 19 7 6 10 16 0 3 69 64 65 72 169) +81 62 (108 33 32 30 27 29 93) +81 165 (108 33 32 30 27 28 19 20 79 78 80 82 87 88 90) +81 168 (108 33 32 30 27 28 19 20 79 78 80 82 87 88 90 178) +81 112 (108 33 32 30 27 28 19 7 6 10 16 17 54 56 58 62 133) +81 69 (108 33 32 34 99) +81 145 (108 33 32 30 27 28 19 7 6 10 16 0 3 70) +81 178 (108 33 32 30 27 28 19 20 79 78 80 82 91 186) +81 124 (108 33 32 30 27 28 19 7 6 10 16 17 54 57 143) +81 131 (108 33 32 30 27 28 19 7 6 10 16 17 52 53 148) +81 121 (108 33 32 30 27 28 19 7 6 10 16 17 54 57 140) +81 98 (108 33 32 30 27 28 19 7 8 48 38 41 122) +81 170 (108 33 32 30 27 28 19 20 79 78 81) +81 63 (108 33 32 30 27 29 94) +81 162 (108 33 32 30 27 28 19 20 79 78 80 82 87 88 89 173) +81 61 (108 33 32 30 27 29 92) +81 107 (108 33 32 30 27 28 19 7 8 42 43 129) +81 87 (108 33 32 30 27 28 19 7 8 48 38 40 113) +81 77 (108 33 32 30 31 105) +81 70 (108 33 32 35) +81 88 (108 33 32 30 27 28 19 7 8 48 38 40 114) +81 156 (108 33 32 30 27 28 19 7 6 10 16 0 3 69 64 65 72 168) +81 83 (108 110) +81 177 (108 33 32 30 27 28 19 20 79 78 80 82 91 185) +81 150 (108 33 32 30 27 28 19 7 6 10 16 0 1 15 76) +81 85 (108 33 32 30 27 28 19 7 8 48 38 40) +81 111 (108 33 32 30 27 28 19 7 6 10 16 17 54 56 58 62 132) +81 169 (108 33 32 30 27 28 19 20 79 78 80 82 87 88 90 179) +62 125 (93 29 28 19 7 6 10 16 17 54 56 59) +62 95 (93 29 28 19 7 8 48 38 41) +62 109 (93 29 28 19 7 8 42 43 131) +62 175 (93 29 28 19 20 79 78 80 82 91) +62 157 (93 29 28 19 7 6 10 16 0 3 69 64 65 72 169) +62 81 (93 29 27 30 32 33 108) +62 165 (93 29 28 19 20 79 78 80 82 87 88 90) +62 168 (93 29 28 19 20 79 78 80 82 87 88 90 178) +62 112 (93 29 28 19 7 6 10 16 17 54 56 58 62 133) +62 69 (93 29 27 30 34 99) +62 145 (93 29 28 19 7 6 10 16 0 3 70) +62 178 (93 29 28 19 20 79 78 80 82 91 186) +62 124 (93 29 28 19 7 6 10 16 17 54 57 143) +62 131 (93 29 28 19 7 6 10 16 17 52 53 148) +62 121 (93 29 28 19 7 6 10 16 17 54 57 140) +62 98 (93 29 28 19 7 8 48 38 41 122) +62 170 (93 29 28 19 20 79 78 81) +62 63 (93 94) +62 162 (93 29 28 19 20 79 78 80 82 87 88 89 173) +62 61 (93 92) +62 107 (93 29 28 19 7 8 42 43 129) +62 87 (93 29 28 19 7 8 48 38 40 113) +62 77 (93 29 27 31 105) +62 70 (93 29 27 30 35) +62 88 (93 29 28 19 7 8 48 38 40 114) +62 156 (93 29 28 19 7 6 10 16 0 3 69 64 65 72 168) +62 83 (93 29 27 30 32 33 110) +62 177 (93 29 28 19 20 79 78 80 82 91 185) +62 150 (93 29 28 19 7 6 10 16 0 1 15 76) +62 85 (93 29 28 19 7 8 48 38 40) +62 111 (93 29 28 19 7 6 10 16 17 54 56 58 62 132) +62 169 (93 29 28 19 20 79 78 80 82 87 88 90 179) +165 125 (90 88 87 82 80 78 79 9 6 10 16 17 54 56 59) +165 95 (90 88 87 82 80 78 79 9 8 48 38 41) +165 109 (90 88 87 82 80 78 79 9 8 42 43 131) +165 175 (90 88 87 91) +165 157 (90 88 87 82 80 78 79 9 6 10 16 0 3 69 64 65 72 169) +165 81 (90 88 87 82 80 78 79 20 19 28 27 30 32 33 108) +165 62 (90 88 87 82 80 78 79 20 19 28 29 93) +165 168 (178) +165 112 (90 88 87 82 80 78 79 9 6 10 16 17 54 56 58 62 133) +165 69 (90 88 87 82 80 78 79 20 19 28 27 30 34 99) +165 145 (90 88 87 82 80 78 79 9 6 10 16 0 3 70) +165 178 (90 88 87 91 186) +165 124 (90 88 87 82 80 78 79 9 6 10 16 17 54 57 143) +165 131 (90 88 87 82 80 78 79 9 6 10 16 17 52 53 148) +165 121 (90 88 87 82 80 78 79 9 6 10 16 17 54 57 140) +165 98 (90 88 87 82 80 78 79 9 8 48 38 41 122) +165 170 (90 88 87 82 80 81) +165 63 (90 88 87 82 80 78 79 20 19 28 29 94) +165 162 (90 89 173) +165 61 (90 88 87 82 80 78 79 20 19 28 29 92) +165 107 (90 88 87 82 80 78 79 9 8 42 43 129) +165 87 (90 88 87 82 80 78 79 9 8 48 38 40 113) +165 77 (90 88 87 82 80 78 79 20 19 28 27 31 105) +165 70 (90 88 87 82 80 78 79 20 19 28 27 30 35) +165 88 (90 88 87 82 80 78 79 9 8 48 38 40 114) +165 156 (90 88 87 82 80 78 79 9 6 10 16 0 3 69 64 65 72 168) +165 83 (90 88 87 82 80 78 79 20 19 28 27 30 32 33 110) +165 177 (90 88 87 91 185) +165 150 (90 88 87 82 80 78 79 9 6 10 16 0 1 15 76) +165 85 (90 88 87 82 80 78 79 9 8 48 38 40) +165 111 (90 88 87 82 80 78 79 9 6 10 16 17 54 56 58 62 132) +165 169 (179) +168 125 (178 90 88 87 82 80 78 79 9 6 10 16 17 54 56 59) +168 95 (178 90 88 87 82 80 78 79 9 8 48 38 41) +168 109 (178 90 88 87 82 80 78 79 9 8 42 43 131) +168 175 (178 90 88 87 91) +168 157 (178 90 88 87 82 80 78 79 9 6 10 16 0 3 69 64 65 72 169) +168 81 (178 90 88 87 82 80 78 79 20 19 28 27 30 32 33 108) +168 62 (178 90 88 87 82 80 78 79 20 19 28 29 93) +168 165 (178) +168 112 (178 90 88 87 82 80 78 79 9 6 10 16 17 54 56 58 62 133) +168 69 (178 90 88 87 82 80 78 79 20 19 28 27 30 34 99) +168 145 (178 90 88 87 82 80 78 79 9 6 10 16 0 3 70) +168 178 (178 90 88 87 91 186) +168 124 (178 90 88 87 82 80 78 79 9 6 10 16 17 54 57 143) +168 131 (178 90 88 87 82 80 78 79 9 6 10 16 17 52 53 148) +168 121 (178 90 88 87 82 80 78 79 9 6 10 16 17 54 57 140) +168 98 (178 90 88 87 82 80 78 79 9 8 48 38 41 122) +168 170 (178 90 88 87 82 80 81) +168 63 (178 90 88 87 82 80 78 79 20 19 28 29 94) +168 162 (178 90 89 173) +168 61 (178 90 88 87 82 80 78 79 20 19 28 29 92) +168 107 (178 90 88 87 82 80 78 79 9 8 42 43 129) +168 87 (178 90 88 87 82 80 78 79 9 8 48 38 40 113) +168 77 (178 90 88 87 82 80 78 79 20 19 28 27 31 105) +168 70 (178 90 88 87 82 80 78 79 20 19 28 27 30 35) +168 88 (178 90 88 87 82 80 78 79 9 8 48 38 40 114) +168 156 (178 90 88 87 82 80 78 79 9 6 10 16 0 3 69 64 65 72 168) +168 83 (178 90 88 87 82 80 78 79 20 19 28 27 30 32 33 110) +168 177 (178 90 88 87 91 185) +168 150 (178 90 88 87 82 80 78 79 9 6 10 16 0 1 15 76) +168 85 (178 90 88 87 82 80 78 79 9 8 48 38 40) +168 111 (178 90 88 87 82 80 78 79 9 6 10 16 17 54 56 58 62 132) +168 169 (178 179) +112 125 (133 62 58 59) +112 95 (133 62 58 56 54 17 16 10 6 8 48 38 41) +112 109 (133 62 58 56 54 17 16 10 6 8 42 43 131) +112 175 (133 62 58 56 54 17 16 10 6 9 79 78 80 82 91) +112 157 (133 62 58 56 54 2 3 69 64 65 72 169) +112 81 (133 62 58 56 54 17 16 10 6 7 19 28 27 30 32 33 108) +112 62 (133 62 58 56 54 17 16 10 6 7 19 28 29 93) +112 165 (133 62 58 56 54 17 16 10 6 9 79 78 80 82 87 88 90) +112 168 (133 62 58 56 54 17 16 10 6 9 79 78 80 82 87 88 90 178) +112 69 (133 62 58 56 54 17 16 10 6 7 19 28 27 30 34 99) +112 145 (133 62 58 56 54 2 3 70) +112 178 (133 62 58 56 54 17 16 10 6 9 79 78 80 82 91 186) +112 124 (133 62 58 56 57 143) +112 131 (133 62 58 56 54 52 53 148) +112 121 (133 62 58 56 57 140) +112 98 (133 62 58 56 54 17 16 10 6 8 48 38 41 122) +112 170 (133 62 58 56 54 17 16 10 6 9 79 78 81) +112 63 (133 62 58 56 54 17 16 10 6 7 19 28 29 94) +112 162 (133 62 58 56 54 17 16 10 6 9 79 78 80 82 87 88 89 173) +112 61 (133 62 58 56 54 17 16 10 6 7 19 28 29 92) +112 107 (133 62 58 56 54 17 16 10 6 8 42 43 129) +112 87 (133 62 58 56 54 17 16 10 6 8 48 38 40 113) +112 77 (133 62 58 56 54 17 16 10 6 7 19 28 27 31 105) +112 70 (133 62 58 56 54 17 16 10 6 7 19 28 27 30 35) +112 88 (133 62 58 56 54 17 16 10 6 8 48 38 40 114) +112 156 (133 62 58 56 54 2 3 69 64 65 72 168) +112 83 (133 62 58 56 54 17 16 10 6 7 19 28 27 30 32 33 110) +112 177 (133 62 58 56 54 17 16 10 6 9 79 78 80 82 91 185) +112 150 (133 62 58 56 54 2 1 15 76) +112 85 (133 62 58 56 54 17 16 10 6 8 48 38 40) +112 111 (133 132) +112 169 (133 62 58 56 54 17 16 10 6 9 79 78 80 82 87 88 90 179) +69 125 (99 34 30 27 28 19 7 6 10 16 17 54 56 59) +69 95 (99 34 30 27 28 19 7 8 48 38 41) +69 109 (99 34 30 27 28 19 7 8 42 43 131) +69 175 (99 34 30 27 28 19 20 79 78 80 82 91) +69 157 (99 34 30 27 28 19 7 6 10 16 0 3 69 64 65 72 169) +69 81 (99 34 32 33 108) +69 62 (99 34 30 27 29 93) +69 165 (99 34 30 27 28 19 20 79 78 80 82 87 88 90) +69 168 (99 34 30 27 28 19 20 79 78 80 82 87 88 90 178) +69 112 (99 34 30 27 28 19 7 6 10 16 17 54 56 58 62 133) +69 145 (99 34 30 27 28 19 7 6 10 16 0 3 70) +69 178 (99 34 30 27 28 19 20 79 78 80 82 91 186) +69 124 (99 34 30 27 28 19 7 6 10 16 17 54 57 143) +69 131 (99 34 30 27 28 19 7 6 10 16 17 52 53 148) +69 121 (99 34 30 27 28 19 7 6 10 16 17 54 57 140) +69 98 (99 34 30 27 28 19 7 8 48 38 41 122) +69 170 (99 34 30 27 28 19 20 79 78 81) +69 63 (99 34 30 27 29 94) +69 162 (99 34 30 27 28 19 20 79 78 80 82 87 88 89 173) +69 61 (99 34 30 27 29 92) +69 107 (99 34 30 27 28 19 7 8 42 43 129) +69 87 (99 34 30 27 28 19 7 8 48 38 40 113) +69 77 (99 34 30 31 105) +69 70 (99 34 35) +69 88 (99 34 30 27 28 19 7 8 48 38 40 114) +69 156 (99 34 30 27 28 19 7 6 10 16 0 3 69 64 65 72 168) +69 83 (99 34 32 33 110) +69 177 (99 34 30 27 28 19 20 79 78 80 82 91 185) +69 150 (99 34 30 27 28 19 7 6 10 16 0 1 15 76) +69 85 (99 34 30 27 28 19 7 8 48 38 40) +69 111 (99 34 30 27 28 19 7 6 10 16 17 54 56 58 62 132) +69 169 (99 34 30 27 28 19 20 79 78 80 82 87 88 90 179) +145 125 (70 3 2 54 56 59) +145 95 (70 3 0 16 10 6 8 48 38 41) +145 109 (70 3 0 16 10 6 8 42 43 131) +145 175 (70 3 0 16 10 6 9 79 78 80 82 91) +145 157 (70 69 64 65 72 169) +145 81 (70 3 0 16 10 6 7 19 28 27 30 32 33 108) +145 62 (70 3 0 16 10 6 7 19 28 29 93) +145 165 (70 3 0 16 10 6 9 79 78 80 82 87 88 90) +145 168 (70 3 0 16 10 6 9 79 78 80 82 87 88 90 178) +145 112 (70 3 2 54 56 58 62 133) +145 69 (70 3 0 16 10 6 7 19 28 27 30 34 99) +145 178 (70 3 0 16 10 6 9 79 78 80 82 91 186) +145 124 (70 3 2 54 57 143) +145 131 (70 3 2 52 53 148) +145 121 (70 3 2 54 57 140) +145 98 (70 3 0 16 10 6 8 48 38 41 122) +145 170 (70 3 0 16 10 6 9 79 78 81) +145 63 (70 3 0 16 10 6 7 19 28 29 94) +145 162 (70 3 0 16 10 6 9 79 78 80 82 87 88 89 173) +145 61 (70 3 0 16 10 6 7 19 28 29 92) +145 107 (70 3 0 16 10 6 8 42 43 129) +145 87 (70 3 0 16 10 6 8 48 38 40 113) +145 77 (70 3 0 16 10 6 7 19 28 27 31 105) +145 70 (70 3 0 16 10 6 7 19 28 27 30 35) +145 88 (70 3 0 16 10 6 8 48 38 40 114) +145 156 (70 69 64 65 72 168) +145 83 (70 3 0 16 10 6 7 19 28 27 30 32 33 110) +145 177 (70 3 0 16 10 6 9 79 78 80 82 91 185) +145 150 (70 3 1 15 76) +145 85 (70 3 0 16 10 6 8 48 38 40) +145 111 (70 3 2 54 56 58 62 132) +145 169 (70 3 0 16 10 6 9 79 78 80 82 87 88 90 179) +178 125 (186 91 82 80 78 79 9 6 10 16 17 54 56 59) +178 95 (186 91 82 80 78 79 9 8 48 38 41) +178 109 (186 91 82 80 78 79 9 8 42 43 131) +178 175 (186) +178 157 (186 91 82 80 78 79 9 6 10 16 0 3 69 64 65 72 169) +178 81 (186 91 82 80 78 79 20 19 28 27 30 32 33 108) +178 62 (186 91 82 80 78 79 20 19 28 29 93) +178 165 (186 91 87 88 90) +178 168 (186 91 87 88 90 178) +178 112 (186 91 82 80 78 79 9 6 10 16 17 54 56 58 62 133) +178 69 (186 91 82 80 78 79 20 19 28 27 30 34 99) +178 145 (186 91 82 80 78 79 9 6 10 16 0 3 70) +178 124 (186 91 82 80 78 79 9 6 10 16 17 54 57 143) +178 131 (186 91 82 80 78 79 9 6 10 16 17 52 53 148) +178 121 (186 91 82 80 78 79 9 6 10 16 17 54 57 140) +178 98 (186 91 82 80 78 79 9 8 48 38 41 122) +178 170 (186 91 82 80 81) +178 63 (186 91 82 80 78 79 20 19 28 29 94) +178 162 (186 91 87 88 89 173) +178 61 (186 91 82 80 78 79 20 19 28 29 92) +178 107 (186 91 82 80 78 79 9 8 42 43 129) +178 87 (186 91 82 80 78 79 9 8 48 38 40 113) +178 77 (186 91 82 80 78 79 20 19 28 27 31 105) +178 70 (186 91 82 80 78 79 20 19 28 27 30 35) +178 88 (186 91 82 80 78 79 9 8 48 38 40 114) +178 156 (186 91 82 80 78 79 9 6 10 16 0 3 69 64 65 72 168) +178 83 (186 91 82 80 78 79 20 19 28 27 30 32 33 110) +178 177 (186 185) +178 150 (186 91 82 80 78 79 9 6 10 16 0 1 15 76) +178 85 (186 91 82 80 78 79 9 8 48 38 40) +178 111 (186 91 82 80 78 79 9 6 10 16 17 54 56 58 62 132) +178 169 (186 91 87 88 90 179) +124 125 (143 57 56 59) +124 95 (143 57 54 17 16 10 6 8 48 38 41) +124 109 (143 57 54 17 16 10 6 8 42 43 131) +124 175 (143 57 54 17 16 10 6 9 79 78 80 82 91) +124 157 (143 57 54 2 3 69 64 65 72 169) +124 81 (143 57 54 17 16 10 6 7 19 28 27 30 32 33 108) +124 62 (143 57 54 17 16 10 6 7 19 28 29 93) +124 165 (143 57 54 17 16 10 6 9 79 78 80 82 87 88 90) +124 168 (143 57 54 17 16 10 6 9 79 78 80 82 87 88 90 178) +124 112 (143 57 56 58 62 133) +124 69 (143 57 54 17 16 10 6 7 19 28 27 30 34 99) +124 145 (143 57 54 2 3 70) +124 178 (143 57 54 17 16 10 6 9 79 78 80 82 91 186) +124 131 (143 57 54 52 53 148) +124 121 (143 140) +124 98 (143 57 54 17 16 10 6 8 48 38 41 122) +124 170 (143 57 54 17 16 10 6 9 79 78 81) +124 63 (143 57 54 17 16 10 6 7 19 28 29 94) +124 162 (143 57 54 17 16 10 6 9 79 78 80 82 87 88 89 173) +124 61 (143 57 54 17 16 10 6 7 19 28 29 92) +124 107 (143 57 54 17 16 10 6 8 42 43 129) +124 87 (143 57 54 17 16 10 6 8 48 38 40 113) +124 77 (143 57 54 17 16 10 6 7 19 28 27 31 105) +124 70 (143 57 54 17 16 10 6 7 19 28 27 30 35) +124 88 (143 57 54 17 16 10 6 8 48 38 40 114) +124 156 (143 57 54 2 3 69 64 65 72 168) +124 83 (143 57 54 17 16 10 6 7 19 28 27 30 32 33 110) +124 177 (143 57 54 17 16 10 6 9 79 78 80 82 91 185) +124 150 (143 57 54 2 1 15 76) +124 85 (143 57 54 17 16 10 6 8 48 38 40) +124 111 (143 57 56 58 62 132) +124 169 (143 57 54 17 16 10 6 9 79 78 80 82 87 88 90 179) +131 125 (148 53 52 54 56 59) +131 95 (148 53 52 17 16 10 6 8 48 38 41) +131 109 (148 53 52 17 16 10 6 8 42 43 131) +131 175 (148 53 52 17 16 10 6 9 79 78 80 82 91) +131 157 (148 53 52 2 3 69 64 65 72 169) +131 81 (148 53 52 17 16 10 6 7 19 28 27 30 32 33 108) +131 62 (148 53 52 17 16 10 6 7 19 28 29 93) +131 165 (148 53 52 17 16 10 6 9 79 78 80 82 87 88 90) +131 168 (148 53 52 17 16 10 6 9 79 78 80 82 87 88 90 178) +131 112 (148 53 52 54 56 58 62 133) +131 69 (148 53 52 17 16 10 6 7 19 28 27 30 34 99) +131 145 (148 53 52 2 3 70) +131 178 (148 53 52 17 16 10 6 9 79 78 80 82 91 186) +131 124 (148 53 52 54 57 143) +131 121 (148 53 52 54 57 140) +131 98 (148 53 52 17 16 10 6 8 48 38 41 122) +131 170 (148 53 52 17 16 10 6 9 79 78 81) +131 63 (148 53 52 17 16 10 6 7 19 28 29 94) +131 162 (148 53 52 17 16 10 6 9 79 78 80 82 87 88 89 173) +131 61 (148 53 52 17 16 10 6 7 19 28 29 92) +131 107 (148 53 52 17 16 10 6 8 42 43 129) +131 87 (148 53 52 17 16 10 6 8 48 38 40 113) +131 77 (148 53 52 17 16 10 6 7 19 28 27 31 105) +131 70 (148 53 52 17 16 10 6 7 19 28 27 30 35) +131 88 (148 53 52 17 16 10 6 8 48 38 40 114) +131 156 (148 53 52 2 3 69 64 65 72 168) +131 83 (148 53 52 17 16 10 6 7 19 28 27 30 32 33 110) +131 177 (148 53 52 17 16 10 6 9 79 78 80 82 91 185) +131 150 (148 53 52 2 1 15 76) +131 85 (148 53 52 17 16 10 6 8 48 38 40) +131 111 (148 53 52 54 56 58 62 132) +131 169 (148 53 52 17 16 10 6 9 79 78 80 82 87 88 90 179) +121 125 (140 57 56 59) +121 95 (140 57 54 17 16 10 6 8 48 38 41) +121 109 (140 57 54 17 16 10 6 8 42 43 131) +121 175 (140 57 54 17 16 10 6 9 79 78 80 82 91) +121 157 (140 57 54 2 3 69 64 65 72 169) +121 81 (140 57 54 17 16 10 6 7 19 28 27 30 32 33 108) +121 62 (140 57 54 17 16 10 6 7 19 28 29 93) +121 165 (140 57 54 17 16 10 6 9 79 78 80 82 87 88 90) +121 168 (140 57 54 17 16 10 6 9 79 78 80 82 87 88 90 178) +121 112 (140 57 56 58 62 133) +121 69 (140 57 54 17 16 10 6 7 19 28 27 30 34 99) +121 145 (140 57 54 2 3 70) +121 178 (140 57 54 17 16 10 6 9 79 78 80 82 91 186) +121 124 (140 143) +121 131 (140 57 54 52 53 148) +121 98 (140 57 54 17 16 10 6 8 48 38 41 122) +121 170 (140 57 54 17 16 10 6 9 79 78 81) +121 63 (140 57 54 17 16 10 6 7 19 28 29 94) +121 162 (140 57 54 17 16 10 6 9 79 78 80 82 87 88 89 173) +121 61 (140 57 54 17 16 10 6 7 19 28 29 92) +121 107 (140 57 54 17 16 10 6 8 42 43 129) +121 87 (140 57 54 17 16 10 6 8 48 38 40 113) +121 77 (140 57 54 17 16 10 6 7 19 28 27 31 105) +121 70 (140 57 54 17 16 10 6 7 19 28 27 30 35) +121 88 (140 57 54 17 16 10 6 8 48 38 40 114) +121 156 (140 57 54 2 3 69 64 65 72 168) +121 83 (140 57 54 17 16 10 6 7 19 28 27 30 32 33 110) +121 177 (140 57 54 17 16 10 6 9 79 78 80 82 91 185) +121 150 (140 57 54 2 1 15 76) +121 85 (140 57 54 17 16 10 6 8 48 38 40) +121 111 (140 57 56 58 62 132) +121 169 (140 57 54 17 16 10 6 9 79 78 80 82 87 88 90 179) +98 125 (122 41 38 48 8 6 10 16 17 54 56 59) +98 95 (122) +98 109 (122 41 38 48 42 43 131) +98 175 (122 41 38 48 8 9 79 78 80 82 91) +98 157 (122 41 38 48 8 6 10 16 0 3 69 64 65 72 169) +98 81 (122 41 38 48 8 7 19 28 27 30 32 33 108) +98 62 (122 41 38 48 8 7 19 28 29 93) +98 165 (122 41 38 48 8 9 79 78 80 82 87 88 90) +98 168 (122 41 38 48 8 9 79 78 80 82 87 88 90 178) +98 112 (122 41 38 48 8 6 10 16 17 54 56 58 62 133) +98 69 (122 41 38 48 8 7 19 28 27 30 34 99) +98 145 (122 41 38 48 8 6 10 16 0 3 70) +98 178 (122 41 38 48 8 9 79 78 80 82 91 186) +98 124 (122 41 38 48 8 6 10 16 17 54 57 143) +98 131 (122 41 38 48 8 6 10 16 17 52 53 148) +98 121 (122 41 38 48 8 6 10 16 17 54 57 140) +98 170 (122 41 38 48 8 9 79 78 81) +98 63 (122 41 38 48 8 7 19 28 29 94) +98 162 (122 41 38 48 8 9 79 78 80 82 87 88 89 173) +98 61 (122 41 38 48 8 7 19 28 29 92) +98 107 (122 41 38 48 42 43 129) +98 87 (122 41 40 113) +98 77 (122 41 38 48 8 7 19 28 27 31 105) +98 70 (122 41 38 48 8 7 19 28 27 30 35) +98 88 (122 41 40 114) +98 156 (122 41 38 48 8 6 10 16 0 3 69 64 65 72 168) +98 83 (122 41 38 48 8 7 19 28 27 30 32 33 110) +98 177 (122 41 38 48 8 9 79 78 80 82 91 185) +98 150 (122 41 38 48 8 6 10 16 0 1 15 76) +98 85 (122 41 40) +98 111 (122 41 38 48 8 6 10 16 17 54 56 58 62 132) +98 169 (122 41 38 48 8 9 79 78 80 82 87 88 90 179) +170 125 (81 78 79 9 6 10 16 17 54 56 59) +170 95 (81 78 79 9 8 48 38 41) +170 109 (81 78 79 9 8 42 43 131) +170 175 (81 80 82 91) +170 157 (81 78 79 9 6 10 16 0 3 69 64 65 72 169) +170 81 (81 78 79 20 19 28 27 30 32 33 108) +170 62 (81 78 79 20 19 28 29 93) +170 165 (81 80 82 87 88 90) +170 168 (81 80 82 87 88 90 178) +170 112 (81 78 79 9 6 10 16 17 54 56 58 62 133) +170 69 (81 78 79 20 19 28 27 30 34 99) +170 145 (81 78 79 9 6 10 16 0 3 70) +170 178 (81 80 82 91 186) +170 124 (81 78 79 9 6 10 16 17 54 57 143) +170 131 (81 78 79 9 6 10 16 17 52 53 148) +170 121 (81 78 79 9 6 10 16 17 54 57 140) +170 98 (81 78 79 9 8 48 38 41 122) +170 63 (81 78 79 20 19 28 29 94) +170 162 (81 80 82 87 88 89 173) +170 61 (81 78 79 20 19 28 29 92) +170 107 (81 78 79 9 8 42 43 129) +170 87 (81 78 79 9 8 48 38 40 113) +170 77 (81 78 79 20 19 28 27 31 105) +170 70 (81 78 79 20 19 28 27 30 35) +170 88 (81 78 79 9 8 48 38 40 114) +170 156 (81 78 79 9 6 10 16 0 3 69 64 65 72 168) +170 83 (81 78 79 20 19 28 27 30 32 33 110) +170 177 (81 80 82 91 185) +170 150 (81 78 79 9 6 10 16 0 1 15 76) +170 85 (81 78 79 9 8 48 38 40) +170 111 (81 78 79 9 6 10 16 17 54 56 58 62 132) +170 169 (81 80 82 87 88 90 179) +63 125 (94 29 28 19 7 6 10 16 17 54 56 59) +63 95 (94 29 28 19 7 8 48 38 41) +63 109 (94 29 28 19 7 8 42 43 131) +63 175 (94 29 28 19 20 79 78 80 82 91) +63 157 (94 29 28 19 7 6 10 16 0 3 69 64 65 72 169) +63 81 (94 29 27 30 32 33 108) +63 62 (94 93) +63 165 (94 29 28 19 20 79 78 80 82 87 88 90) +63 168 (94 29 28 19 20 79 78 80 82 87 88 90 178) +63 112 (94 29 28 19 7 6 10 16 17 54 56 58 62 133) +63 69 (94 29 27 30 34 99) +63 145 (94 29 28 19 7 6 10 16 0 3 70) +63 178 (94 29 28 19 20 79 78 80 82 91 186) +63 124 (94 29 28 19 7 6 10 16 17 54 57 143) +63 131 (94 29 28 19 7 6 10 16 17 52 53 148) +63 121 (94 29 28 19 7 6 10 16 17 54 57 140) +63 98 (94 29 28 19 7 8 48 38 41 122) +63 170 (94 29 28 19 20 79 78 81) +63 162 (94 29 28 19 20 79 78 80 82 87 88 89 173) +63 61 (94 92) +63 107 (94 29 28 19 7 8 42 43 129) +63 87 (94 29 28 19 7 8 48 38 40 113) +63 77 (94 29 27 31 105) +63 70 (94 29 27 30 35) +63 88 (94 29 28 19 7 8 48 38 40 114) +63 156 (94 29 28 19 7 6 10 16 0 3 69 64 65 72 168) +63 83 (94 29 27 30 32 33 110) +63 177 (94 29 28 19 20 79 78 80 82 91 185) +63 150 (94 29 28 19 7 6 10 16 0 1 15 76) +63 85 (94 29 28 19 7 8 48 38 40) +63 111 (94 29 28 19 7 6 10 16 17 54 56 58 62 132) +63 169 (94 29 28 19 20 79 78 80 82 87 88 90 179) +162 125 (173 89 88 87 82 80 78 79 9 6 10 16 17 54 56 59) +162 95 (173 89 88 87 82 80 78 79 9 8 48 38 41) +162 109 (173 89 88 87 82 80 78 79 9 8 42 43 131) +162 175 (173 89 88 87 91) +162 157 (173 89 88 87 82 80 78 79 9 6 10 16 0 3 69 64 65 72 169) +162 81 (173 89 88 87 82 80 78 79 20 19 28 27 30 32 33 108) +162 62 (173 89 88 87 82 80 78 79 20 19 28 29 93) +162 165 (173 89 90) +162 168 (173 89 90 178) +162 112 (173 89 88 87 82 80 78 79 9 6 10 16 17 54 56 58 62 133) +162 69 (173 89 88 87 82 80 78 79 20 19 28 27 30 34 99) +162 145 (173 89 88 87 82 80 78 79 9 6 10 16 0 3 70) +162 178 (173 89 88 87 91 186) +162 124 (173 89 88 87 82 80 78 79 9 6 10 16 17 54 57 143) +162 131 (173 89 88 87 82 80 78 79 9 6 10 16 17 52 53 148) +162 121 (173 89 88 87 82 80 78 79 9 6 10 16 17 54 57 140) +162 98 (173 89 88 87 82 80 78 79 9 8 48 38 41 122) +162 170 (173 89 88 87 82 80 81) +162 63 (173 89 88 87 82 80 78 79 20 19 28 29 94) +162 61 (173 89 88 87 82 80 78 79 20 19 28 29 92) +162 107 (173 89 88 87 82 80 78 79 9 8 42 43 129) +162 87 (173 89 88 87 82 80 78 79 9 8 48 38 40 113) +162 77 (173 89 88 87 82 80 78 79 20 19 28 27 31 105) +162 70 (173 89 88 87 82 80 78 79 20 19 28 27 30 35) +162 88 (173 89 88 87 82 80 78 79 9 8 48 38 40 114) +162 156 (173 89 88 87 82 80 78 79 9 6 10 16 0 3 69 64 65 72 168) +162 83 (173 89 88 87 82 80 78 79 20 19 28 27 30 32 33 110) +162 177 (173 89 88 87 91 185) +162 150 (173 89 88 87 82 80 78 79 9 6 10 16 0 1 15 76) +162 85 (173 89 88 87 82 80 78 79 9 8 48 38 40) +162 111 (173 89 88 87 82 80 78 79 9 6 10 16 17 54 56 58 62 132) +162 169 (173 89 90 179) +61 125 (92 29 28 19 7 6 10 16 17 54 56 59) +61 95 (92 29 28 19 7 8 48 38 41) +61 109 (92 29 28 19 7 8 42 43 131) +61 175 (92 29 28 19 20 79 78 80 82 91) +61 157 (92 29 28 19 7 6 10 16 0 3 69 64 65 72 169) +61 81 (92 29 27 30 32 33 108) +61 62 (92 93) +61 165 (92 29 28 19 20 79 78 80 82 87 88 90) +61 168 (92 29 28 19 20 79 78 80 82 87 88 90 178) +61 112 (92 29 28 19 7 6 10 16 17 54 56 58 62 133) +61 69 (92 29 27 30 34 99) +61 145 (92 29 28 19 7 6 10 16 0 3 70) +61 178 (92 29 28 19 20 79 78 80 82 91 186) +61 124 (92 29 28 19 7 6 10 16 17 54 57 143) +61 131 (92 29 28 19 7 6 10 16 17 52 53 148) +61 121 (92 29 28 19 7 6 10 16 17 54 57 140) +61 98 (92 29 28 19 7 8 48 38 41 122) +61 170 (92 29 28 19 20 79 78 81) +61 63 (92 94) +61 162 (92 29 28 19 20 79 78 80 82 87 88 89 173) +61 107 (92 29 28 19 7 8 42 43 129) +61 87 (92 29 28 19 7 8 48 38 40 113) +61 77 (92 29 27 31 105) +61 70 (92 29 27 30 35) +61 88 (92 29 28 19 7 8 48 38 40 114) +61 156 (92 29 28 19 7 6 10 16 0 3 69 64 65 72 168) +61 83 (92 29 27 30 32 33 110) +61 177 (92 29 28 19 20 79 78 80 82 91 185) +61 150 (92 29 28 19 7 6 10 16 0 1 15 76) +61 85 (92 29 28 19 7 8 48 38 40) +61 111 (92 29 28 19 7 6 10 16 17 54 56 58 62 132) +61 169 (92 29 28 19 20 79 78 80 82 87 88 90 179) +107 125 (129 43 42 8 6 10 16 17 54 56 59) +107 95 (129 43 42 48 38 41) +107 109 (129 131) +107 175 (129 43 42 8 9 79 78 80 82 91) +107 157 (129 43 42 8 6 10 16 0 3 69 64 65 72 169) +107 81 (129 43 42 8 7 19 28 27 30 32 33 108) +107 62 (129 43 42 8 7 19 28 29 93) +107 165 (129 43 42 8 9 79 78 80 82 87 88 90) +107 168 (129 43 42 8 9 79 78 80 82 87 88 90 178) +107 112 (129 43 42 8 6 10 16 17 54 56 58 62 133) +107 69 (129 43 42 8 7 19 28 27 30 34 99) +107 145 (129 43 42 8 6 10 16 0 3 70) +107 178 (129 43 42 8 9 79 78 80 82 91 186) +107 124 (129 43 42 8 6 10 16 17 54 57 143) +107 131 (129 43 42 8 6 10 16 17 52 53 148) +107 121 (129 43 42 8 6 10 16 17 54 57 140) +107 98 (129 43 42 48 38 41 122) +107 170 (129 43 42 8 9 79 78 81) +107 63 (129 43 42 8 7 19 28 29 94) +107 162 (129 43 42 8 9 79 78 80 82 87 88 89 173) +107 61 (129 43 42 8 7 19 28 29 92) +107 87 (129 43 42 48 38 40 113) +107 77 (129 43 42 8 7 19 28 27 31 105) +107 70 (129 43 42 8 7 19 28 27 30 35) +107 88 (129 43 42 48 38 40 114) +107 156 (129 43 42 8 6 10 16 0 3 69 64 65 72 168) +107 83 (129 43 42 8 7 19 28 27 30 32 33 110) +107 177 (129 43 42 8 9 79 78 80 82 91 185) +107 150 (129 43 42 8 6 10 16 0 1 15 76) +107 85 (129 43 42 48 38 40) +107 111 (129 43 42 8 6 10 16 17 54 56 58 62 132) +107 169 (129 43 42 8 9 79 78 80 82 87 88 90 179) +87 125 (113 40 38 48 8 6 10 16 17 54 56 59) +87 95 (113 40 41) +87 109 (113 40 38 48 42 43 131) +87 175 (113 40 38 48 8 9 79 78 80 82 91) +87 157 (113 40 38 48 8 6 10 16 0 3 69 64 65 72 169) +87 81 (113 40 38 48 8 7 19 28 27 30 32 33 108) +87 62 (113 40 38 48 8 7 19 28 29 93) +87 165 (113 40 38 48 8 9 79 78 80 82 87 88 90) +87 168 (113 40 38 48 8 9 79 78 80 82 87 88 90 178) +87 112 (113 40 38 48 8 6 10 16 17 54 56 58 62 133) +87 69 (113 40 38 48 8 7 19 28 27 30 34 99) +87 145 (113 40 38 48 8 6 10 16 0 3 70) +87 178 (113 40 38 48 8 9 79 78 80 82 91 186) +87 124 (113 40 38 48 8 6 10 16 17 54 57 143) +87 131 (113 40 38 48 8 6 10 16 17 52 53 148) +87 121 (113 40 38 48 8 6 10 16 17 54 57 140) +87 98 (113 40 41 122) +87 170 (113 40 38 48 8 9 79 78 81) +87 63 (113 40 38 48 8 7 19 28 29 94) +87 162 (113 40 38 48 8 9 79 78 80 82 87 88 89 173) +87 61 (113 40 38 48 8 7 19 28 29 92) +87 107 (113 40 38 48 42 43 129) +87 77 (113 40 38 48 8 7 19 28 27 31 105) +87 70 (113 40 38 48 8 7 19 28 27 30 35) +87 88 (113 114) +87 156 (113 40 38 48 8 6 10 16 0 3 69 64 65 72 168) +87 83 (113 40 38 48 8 7 19 28 27 30 32 33 110) +87 177 (113 40 38 48 8 9 79 78 80 82 91 185) +87 150 (113 40 38 48 8 6 10 16 0 1 15 76) +87 85 (113) +87 111 (113 40 38 48 8 6 10 16 17 54 56 58 62 132) +87 169 (113 40 38 48 8 9 79 78 80 82 87 88 90 179) +77 125 (105 31 27 28 19 7 6 10 16 17 54 56 59) +77 95 (105 31 27 28 19 7 8 48 38 41) +77 109 (105 31 27 28 19 7 8 42 43 131) +77 175 (105 31 27 28 19 20 79 78 80 82 91) +77 157 (105 31 27 28 19 7 6 10 16 0 3 69 64 65 72 169) +77 81 (105 31 30 32 33 108) +77 62 (105 31 27 29 93) +77 165 (105 31 27 28 19 20 79 78 80 82 87 88 90) +77 168 (105 31 27 28 19 20 79 78 80 82 87 88 90 178) +77 112 (105 31 27 28 19 7 6 10 16 17 54 56 58 62 133) +77 69 (105 31 30 34 99) +77 145 (105 31 27 28 19 7 6 10 16 0 3 70) +77 178 (105 31 27 28 19 20 79 78 80 82 91 186) +77 124 (105 31 27 28 19 7 6 10 16 17 54 57 143) +77 131 (105 31 27 28 19 7 6 10 16 17 52 53 148) +77 121 (105 31 27 28 19 7 6 10 16 17 54 57 140) +77 98 (105 31 27 28 19 7 8 48 38 41 122) +77 170 (105 31 27 28 19 20 79 78 81) +77 63 (105 31 27 29 94) +77 162 (105 31 27 28 19 20 79 78 80 82 87 88 89 173) +77 61 (105 31 27 29 92) +77 107 (105 31 27 28 19 7 8 42 43 129) +77 87 (105 31 27 28 19 7 8 48 38 40 113) +77 70 (105 31 30 35) +77 88 (105 31 27 28 19 7 8 48 38 40 114) +77 156 (105 31 27 28 19 7 6 10 16 0 3 69 64 65 72 168) +77 83 (105 31 30 32 33 110) +77 177 (105 31 27 28 19 20 79 78 80 82 91 185) +77 150 (105 31 27 28 19 7 6 10 16 0 1 15 76) +77 85 (105 31 27 28 19 7 8 48 38 40) +77 111 (105 31 27 28 19 7 6 10 16 17 54 56 58 62 132) +77 169 (105 31 27 28 19 20 79 78 80 82 87 88 90 179) +70 125 (35 30 27 28 19 7 6 10 16 17 54 56 59) +70 95 (35 30 27 28 19 7 8 48 38 41) +70 109 (35 30 27 28 19 7 8 42 43 131) +70 175 (35 30 27 28 19 20 79 78 80 82 91) +70 157 (35 30 27 28 19 7 6 10 16 0 3 69 64 65 72 169) +70 81 (35 32 33 108) +70 62 (35 30 27 29 93) +70 165 (35 30 27 28 19 20 79 78 80 82 87 88 90) +70 168 (35 30 27 28 19 20 79 78 80 82 87 88 90 178) +70 112 (35 30 27 28 19 7 6 10 16 17 54 56 58 62 133) +70 69 (35 34 99) +70 145 (35 30 27 28 19 7 6 10 16 0 3 70) +70 178 (35 30 27 28 19 20 79 78 80 82 91 186) +70 124 (35 30 27 28 19 7 6 10 16 17 54 57 143) +70 131 (35 30 27 28 19 7 6 10 16 17 52 53 148) +70 121 (35 30 27 28 19 7 6 10 16 17 54 57 140) +70 98 (35 30 27 28 19 7 8 48 38 41 122) +70 170 (35 30 27 28 19 20 79 78 81) +70 63 (35 30 27 29 94) +70 162 (35 30 27 28 19 20 79 78 80 82 87 88 89 173) +70 61 (35 30 27 29 92) +70 107 (35 30 27 28 19 7 8 42 43 129) +70 87 (35 30 27 28 19 7 8 48 38 40 113) +70 77 (35 30 31 105) +70 88 (35 30 27 28 19 7 8 48 38 40 114) +70 156 (35 30 27 28 19 7 6 10 16 0 3 69 64 65 72 168) +70 83 (35 32 33 110) +70 177 (35 30 27 28 19 20 79 78 80 82 91 185) +70 150 (35 30 27 28 19 7 6 10 16 0 1 15 76) +70 85 (35 30 27 28 19 7 8 48 38 40) +70 111 (35 30 27 28 19 7 6 10 16 17 54 56 58 62 132) +70 169 (35 30 27 28 19 20 79 78 80 82 87 88 90 179) +88 125 (114 40 38 48 8 6 10 16 17 54 56 59) +88 95 (114 40 41) +88 109 (114 40 38 48 42 43 131) +88 175 (114 40 38 48 8 9 79 78 80 82 91) +88 157 (114 40 38 48 8 6 10 16 0 3 69 64 65 72 169) +88 81 (114 40 38 48 8 7 19 28 27 30 32 33 108) +88 62 (114 40 38 48 8 7 19 28 29 93) +88 165 (114 40 38 48 8 9 79 78 80 82 87 88 90) +88 168 (114 40 38 48 8 9 79 78 80 82 87 88 90 178) +88 112 (114 40 38 48 8 6 10 16 17 54 56 58 62 133) +88 69 (114 40 38 48 8 7 19 28 27 30 34 99) +88 145 (114 40 38 48 8 6 10 16 0 3 70) +88 178 (114 40 38 48 8 9 79 78 80 82 91 186) +88 124 (114 40 38 48 8 6 10 16 17 54 57 143) +88 131 (114 40 38 48 8 6 10 16 17 52 53 148) +88 121 (114 40 38 48 8 6 10 16 17 54 57 140) +88 98 (114 40 41 122) +88 170 (114 40 38 48 8 9 79 78 81) +88 63 (114 40 38 48 8 7 19 28 29 94) +88 162 (114 40 38 48 8 9 79 78 80 82 87 88 89 173) +88 61 (114 40 38 48 8 7 19 28 29 92) +88 107 (114 40 38 48 42 43 129) +88 87 (114 113) +88 77 (114 40 38 48 8 7 19 28 27 31 105) +88 70 (114 40 38 48 8 7 19 28 27 30 35) +88 156 (114 40 38 48 8 6 10 16 0 3 69 64 65 72 168) +88 83 (114 40 38 48 8 7 19 28 27 30 32 33 110) +88 177 (114 40 38 48 8 9 79 78 80 82 91 185) +88 150 (114 40 38 48 8 6 10 16 0 1 15 76) +88 85 (114) +88 111 (114 40 38 48 8 6 10 16 17 54 56 58 62 132) +88 169 (114 40 38 48 8 9 79 78 80 82 87 88 90 179) +156 125 (168 72 65 64 69 3 2 54 56 59) +156 95 (168 72 65 64 69 3 0 16 10 6 8 48 38 41) +156 109 (168 72 65 64 69 3 0 16 10 6 8 42 43 131) +156 175 (168 72 65 64 69 3 0 16 10 6 9 79 78 80 82 91) +156 157 (168 169) +156 81 (168 72 65 64 69 3 0 16 10 6 7 19 28 27 30 32 33 108) +156 62 (168 72 65 64 69 3 0 16 10 6 7 19 28 29 93) +156 165 (168 72 65 64 69 3 0 16 10 6 9 79 78 80 82 87 88 90) +156 168 (168 72 65 64 69 3 0 16 10 6 9 79 78 80 82 87 88 90 178) +156 112 (168 72 65 64 69 3 2 54 56 58 62 133) +156 69 (168 72 65 64 69 3 0 16 10 6 7 19 28 27 30 34 99) +156 145 (168 72 65 64 69 70) +156 178 (168 72 65 64 69 3 0 16 10 6 9 79 78 80 82 91 186) +156 124 (168 72 65 64 69 3 2 54 57 143) +156 131 (168 72 65 64 69 3 2 52 53 148) +156 121 (168 72 65 64 69 3 2 54 57 140) +156 98 (168 72 65 64 69 3 0 16 10 6 8 48 38 41 122) +156 170 (168 72 65 64 69 3 0 16 10 6 9 79 78 81) +156 63 (168 72 65 64 69 3 0 16 10 6 7 19 28 29 94) +156 162 (168 72 65 64 69 3 0 16 10 6 9 79 78 80 82 87 88 89 173) +156 61 (168 72 65 64 69 3 0 16 10 6 7 19 28 29 92) +156 107 (168 72 65 64 69 3 0 16 10 6 8 42 43 129) +156 87 (168 72 65 64 69 3 0 16 10 6 8 48 38 40 113) +156 77 (168 72 65 64 69 3 0 16 10 6 7 19 28 27 31 105) +156 70 (168 72 65 64 69 3 0 16 10 6 7 19 28 27 30 35) +156 88 (168 72 65 64 69 3 0 16 10 6 8 48 38 40 114) +156 83 (168 72 65 64 69 3 0 16 10 6 7 19 28 27 30 32 33 110) +156 177 (168 72 65 64 69 3 0 16 10 6 9 79 78 80 82 91 185) +156 150 (168 72 65 64 73 74 76) +156 85 (168 72 65 64 69 3 0 16 10 6 8 48 38 40) +156 111 (168 72 65 64 69 3 2 54 56 58 62 132) +156 169 (168 72 65 64 69 3 0 16 10 6 9 79 78 80 82 87 88 90 179) +83 125 (110 33 32 30 27 28 19 7 6 10 16 17 54 56 59) +83 95 (110 33 32 30 27 28 19 7 8 48 38 41) +83 109 (110 33 32 30 27 28 19 7 8 42 43 131) +83 175 (110 33 32 30 27 28 19 20 79 78 80 82 91) +83 157 (110 33 32 30 27 28 19 7 6 10 16 0 3 69 64 65 72 169) +83 81 (110 108) +83 62 (110 33 32 30 27 29 93) +83 165 (110 33 32 30 27 28 19 20 79 78 80 82 87 88 90) +83 168 (110 33 32 30 27 28 19 20 79 78 80 82 87 88 90 178) +83 112 (110 33 32 30 27 28 19 7 6 10 16 17 54 56 58 62 133) +83 69 (110 33 32 34 99) +83 145 (110 33 32 30 27 28 19 7 6 10 16 0 3 70) +83 178 (110 33 32 30 27 28 19 20 79 78 80 82 91 186) +83 124 (110 33 32 30 27 28 19 7 6 10 16 17 54 57 143) +83 131 (110 33 32 30 27 28 19 7 6 10 16 17 52 53 148) +83 121 (110 33 32 30 27 28 19 7 6 10 16 17 54 57 140) +83 98 (110 33 32 30 27 28 19 7 8 48 38 41 122) +83 170 (110 33 32 30 27 28 19 20 79 78 81) +83 63 (110 33 32 30 27 29 94) +83 162 (110 33 32 30 27 28 19 20 79 78 80 82 87 88 89 173) +83 61 (110 33 32 30 27 29 92) +83 107 (110 33 32 30 27 28 19 7 8 42 43 129) +83 87 (110 33 32 30 27 28 19 7 8 48 38 40 113) +83 77 (110 33 32 30 31 105) +83 70 (110 33 32 35) +83 88 (110 33 32 30 27 28 19 7 8 48 38 40 114) +83 156 (110 33 32 30 27 28 19 7 6 10 16 0 3 69 64 65 72 168) +83 177 (110 33 32 30 27 28 19 20 79 78 80 82 91 185) +83 150 (110 33 32 30 27 28 19 7 6 10 16 0 1 15 76) +83 85 (110 33 32 30 27 28 19 7 8 48 38 40) +83 111 (110 33 32 30 27 28 19 7 6 10 16 17 54 56 58 62 132) +83 169 (110 33 32 30 27 28 19 20 79 78 80 82 87 88 90 179) +177 125 (185 91 82 80 78 79 9 6 10 16 17 54 56 59) +177 95 (185 91 82 80 78 79 9 8 48 38 41) +177 109 (185 91 82 80 78 79 9 8 42 43 131) +177 175 (185) +177 157 (185 91 82 80 78 79 9 6 10 16 0 3 69 64 65 72 169) +177 81 (185 91 82 80 78 79 20 19 28 27 30 32 33 108) +177 62 (185 91 82 80 78 79 20 19 28 29 93) +177 165 (185 91 87 88 90) +177 168 (185 91 87 88 90 178) +177 112 (185 91 82 80 78 79 9 6 10 16 17 54 56 58 62 133) +177 69 (185 91 82 80 78 79 20 19 28 27 30 34 99) +177 145 (185 91 82 80 78 79 9 6 10 16 0 3 70) +177 178 (185 186) +177 124 (185 91 82 80 78 79 9 6 10 16 17 54 57 143) +177 131 (185 91 82 80 78 79 9 6 10 16 17 52 53 148) +177 121 (185 91 82 80 78 79 9 6 10 16 17 54 57 140) +177 98 (185 91 82 80 78 79 9 8 48 38 41 122) +177 170 (185 91 82 80 81) +177 63 (185 91 82 80 78 79 20 19 28 29 94) +177 162 (185 91 87 88 89 173) +177 61 (185 91 82 80 78 79 20 19 28 29 92) +177 107 (185 91 82 80 78 79 9 8 42 43 129) +177 87 (185 91 82 80 78 79 9 8 48 38 40 113) +177 77 (185 91 82 80 78 79 20 19 28 27 31 105) +177 70 (185 91 82 80 78 79 20 19 28 27 30 35) +177 88 (185 91 82 80 78 79 9 8 48 38 40 114) +177 156 (185 91 82 80 78 79 9 6 10 16 0 3 69 64 65 72 168) +177 83 (185 91 82 80 78 79 20 19 28 27 30 32 33 110) +177 150 (185 91 82 80 78 79 9 6 10 16 0 1 15 76) +177 85 (185 91 82 80 78 79 9 8 48 38 40) +177 111 (185 91 82 80 78 79 9 6 10 16 17 54 56 58 62 132) +177 169 (185 91 87 88 90 179) +150 125 (76 15 1 2 54 56 59) +150 95 (76 15 1 0 16 10 6 8 48 38 41) +150 109 (76 15 1 0 16 10 6 8 42 43 131) +150 175 (76 15 1 0 16 10 6 9 79 78 80 82 91) +150 157 (76 74 73 64 65 72 169) +150 81 (76 15 1 0 16 10 6 7 19 28 27 30 32 33 108) +150 62 (76 15 1 0 16 10 6 7 19 28 29 93) +150 165 (76 15 1 0 16 10 6 9 79 78 80 82 87 88 90) +150 168 (76 15 1 0 16 10 6 9 79 78 80 82 87 88 90 178) +150 112 (76 15 1 2 54 56 58 62 133) +150 69 (76 15 1 0 16 10 6 7 19 28 27 30 34 99) +150 145 (76 74 73 69 70) +150 178 (76 15 1 0 16 10 6 9 79 78 80 82 91 186) +150 124 (76 15 1 2 54 57 143) +150 131 (76 15 1 2 52 53 148) +150 121 (76 15 1 2 54 57 140) +150 98 (76 15 1 0 16 10 6 8 48 38 41 122) +150 170 (76 15 1 0 16 10 6 9 79 78 81) +150 63 (76 15 1 0 16 10 6 7 19 28 29 94) +150 162 (76 15 1 0 16 10 6 9 79 78 80 82 87 88 89 173) +150 61 (76 15 1 0 16 10 6 7 19 28 29 92) +150 107 (76 15 1 0 16 10 6 8 42 43 129) +150 87 (76 15 1 0 16 10 6 8 48 38 40 113) +150 77 (76 15 1 0 16 10 6 7 19 28 27 31 105) +150 70 (76 15 1 0 16 10 6 7 19 28 27 30 35) +150 88 (76 15 1 0 16 10 6 8 48 38 40 114) +150 156 (76 74 73 64 65 72 168) +150 83 (76 15 1 0 16 10 6 7 19 28 27 30 32 33 110) +150 177 (76 15 1 0 16 10 6 9 79 78 80 82 91 185) +150 85 (76 15 1 0 16 10 6 8 48 38 40) +150 111 (76 15 1 2 54 56 58 62 132) +150 169 (76 15 1 0 16 10 6 9 79 78 80 82 87 88 90 179) +85 125 (40 38 48 8 6 10 16 17 54 56 59) +85 95 (40 41) +85 109 (40 38 48 42 43 131) +85 175 (40 38 48 8 9 79 78 80 82 91) +85 157 (40 38 48 8 6 10 16 0 3 69 64 65 72 169) +85 81 (40 38 48 8 7 19 28 27 30 32 33 108) +85 62 (40 38 48 8 7 19 28 29 93) +85 165 (40 38 48 8 9 79 78 80 82 87 88 90) +85 168 (40 38 48 8 9 79 78 80 82 87 88 90 178) +85 112 (40 38 48 8 6 10 16 17 54 56 58 62 133) +85 69 (40 38 48 8 7 19 28 27 30 34 99) +85 145 (40 38 48 8 6 10 16 0 3 70) +85 178 (40 38 48 8 9 79 78 80 82 91 186) +85 124 (40 38 48 8 6 10 16 17 54 57 143) +85 131 (40 38 48 8 6 10 16 17 52 53 148) +85 121 (40 38 48 8 6 10 16 17 54 57 140) +85 98 (40 41 122) +85 170 (40 38 48 8 9 79 78 81) +85 63 (40 38 48 8 7 19 28 29 94) +85 162 (40 38 48 8 9 79 78 80 82 87 88 89 173) +85 61 (40 38 48 8 7 19 28 29 92) +85 107 (40 38 48 42 43 129) +85 87 (113) +85 77 (40 38 48 8 7 19 28 27 31 105) +85 70 (40 38 48 8 7 19 28 27 30 35) +85 88 (114) +85 156 (40 38 48 8 6 10 16 0 3 69 64 65 72 168) +85 83 (40 38 48 8 7 19 28 27 30 32 33 110) +85 177 (40 38 48 8 9 79 78 80 82 91 185) +85 150 (40 38 48 8 6 10 16 0 1 15 76) +85 111 (40 38 48 8 6 10 16 17 54 56 58 62 132) +85 169 (40 38 48 8 9 79 78 80 82 87 88 90 179) +111 125 (132 62 58 59) +111 95 (132 62 58 56 54 17 16 10 6 8 48 38 41) +111 109 (132 62 58 56 54 17 16 10 6 8 42 43 131) +111 175 (132 62 58 56 54 17 16 10 6 9 79 78 80 82 91) +111 157 (132 62 58 56 54 2 3 69 64 65 72 169) +111 81 (132 62 58 56 54 17 16 10 6 7 19 28 27 30 32 33 108) +111 62 (132 62 58 56 54 17 16 10 6 7 19 28 29 93) +111 165 (132 62 58 56 54 17 16 10 6 9 79 78 80 82 87 88 90) +111 168 (132 62 58 56 54 17 16 10 6 9 79 78 80 82 87 88 90 178) +111 112 (132 133) +111 69 (132 62 58 56 54 17 16 10 6 7 19 28 27 30 34 99) +111 145 (132 62 58 56 54 2 3 70) +111 178 (132 62 58 56 54 17 16 10 6 9 79 78 80 82 91 186) +111 124 (132 62 58 56 57 143) +111 131 (132 62 58 56 54 52 53 148) +111 121 (132 62 58 56 57 140) +111 98 (132 62 58 56 54 17 16 10 6 8 48 38 41 122) +111 170 (132 62 58 56 54 17 16 10 6 9 79 78 81) +111 63 (132 62 58 56 54 17 16 10 6 7 19 28 29 94) +111 162 (132 62 58 56 54 17 16 10 6 9 79 78 80 82 87 88 89 173) +111 61 (132 62 58 56 54 17 16 10 6 7 19 28 29 92) +111 107 (132 62 58 56 54 17 16 10 6 8 42 43 129) +111 87 (132 62 58 56 54 17 16 10 6 8 48 38 40 113) +111 77 (132 62 58 56 54 17 16 10 6 7 19 28 27 31 105) +111 70 (132 62 58 56 54 17 16 10 6 7 19 28 27 30 35) +111 88 (132 62 58 56 54 17 16 10 6 8 48 38 40 114) +111 156 (132 62 58 56 54 2 3 69 64 65 72 168) +111 83 (132 62 58 56 54 17 16 10 6 7 19 28 27 30 32 33 110) +111 177 (132 62 58 56 54 17 16 10 6 9 79 78 80 82 91 185) +111 150 (132 62 58 56 54 2 1 15 76) +111 85 (132 62 58 56 54 17 16 10 6 8 48 38 40) +111 169 (132 62 58 56 54 17 16 10 6 9 79 78 80 82 87 88 90 179) +169 125 (179 90 88 87 82 80 78 79 9 6 10 16 17 54 56 59) +169 95 (179 90 88 87 82 80 78 79 9 8 48 38 41) +169 109 (179 90 88 87 82 80 78 79 9 8 42 43 131) +169 175 (179 90 88 87 91) +169 157 (179 90 88 87 82 80 78 79 9 6 10 16 0 3 69 64 65 72 169) +169 81 (179 90 88 87 82 80 78 79 20 19 28 27 30 32 33 108) +169 62 (179 90 88 87 82 80 78 79 20 19 28 29 93) +169 165 (179) +169 168 (179 178) +169 112 (179 90 88 87 82 80 78 79 9 6 10 16 17 54 56 58 62 133) +169 69 (179 90 88 87 82 80 78 79 20 19 28 27 30 34 99) +169 145 (179 90 88 87 82 80 78 79 9 6 10 16 0 3 70) +169 178 (179 90 88 87 91 186) +169 124 (179 90 88 87 82 80 78 79 9 6 10 16 17 54 57 143) +169 131 (179 90 88 87 82 80 78 79 9 6 10 16 17 52 53 148) +169 121 (179 90 88 87 82 80 78 79 9 6 10 16 17 54 57 140) +169 98 (179 90 88 87 82 80 78 79 9 8 48 38 41 122) +169 170 (179 90 88 87 82 80 81) +169 63 (179 90 88 87 82 80 78 79 20 19 28 29 94) +169 162 (179 90 89 173) +169 61 (179 90 88 87 82 80 78 79 20 19 28 29 92) +169 107 (179 90 88 87 82 80 78 79 9 8 42 43 129) +169 87 (179 90 88 87 82 80 78 79 9 8 48 38 40 113) +169 77 (179 90 88 87 82 80 78 79 20 19 28 27 31 105) +169 70 (179 90 88 87 82 80 78 79 20 19 28 27 30 35) +169 88 (179 90 88 87 82 80 78 79 9 8 48 38 40 114) +169 156 (179 90 88 87 82 80 78 79 9 6 10 16 0 3 69 64 65 72 168) +169 83 (179 90 88 87 82 80 78 79 20 19 28 27 30 32 33 110) +169 177 (179 90 88 87 91 185) +169 150 (179 90 88 87 82 80 78 79 9 6 10 16 0 1 15 76) +169 85 (179 90 88 87 82 80 78 79 9 8 48 38 40) +169 111 (179 90 88 87 82 80 78 79 9 6 10 16 17 54 56 58 62 132) diff --git a/examples/alnem/.cvsignore b/examples/alnem/.cvsignore new file mode 100644 index 0000000000..6ed4f5d8e1 --- /dev/null +++ b/examples/alnem/.cvsignore @@ -0,0 +1 @@ +.deps .libs Makefile Makefile.in _*.c alnem_builder alnem_maestro alnem_sensor alnem_simulator diff --git a/examples/alnem/Makefile.am b/examples/alnem/Makefile.am new file mode 100644 index 0000000000..4fb56f857e --- /dev/null +++ b/examples/alnem/Makefile.am @@ -0,0 +1,28 @@ +DISTCLEANFILES=Makefile.in +INCLUDES= -I$(top_srcdir)/src/include +#-I../../src -I../../nws_portability/Include @CFLAGS_XML@ @CFLAGS_SimGrid@ + +noinst_PROGRAMS=alnem_simulator alnem_sensor alnem_maestro + +alnem_simulator_SOURCES= _alnem_simulator.c alnem.c +alnem_sensor_SOURCES= _alnem_sensor.c alnem.c +alnem_maestro_SOURCES= _alnem_maestro.c alnem.c + + +alnem_simulator_LDADD= $(top_srcdir)/src/core/libgrassg.a $(top_srcdir)/src/modules/libgrasmodules.a @LIBS_SimGrid@ @LIBS_XML@ +alnem_sensor_LDADD= $(top_srcdir)/src/core/libgrasrl.a $(top_srcdir)/src/modules/libgrasmodules.a @LIBS_SimGrid@ +alnem_maestro_LDADD= $(top_srcdir)/src/core/libgrasrl.a $(top_srcdir)/src/modules/libgrasmodules.a @LIBS_SimGrid@ + +bin_PROGRAMS=alnem_builder +alnem_builder_LDADD= @LIBS_SimGrid@ @LIBS_XML@ + +# cleanup temps +CLEANFILES= _alnem_simulator.c _alnem_sensor.c _alnem_maestro.c + +# generate temps +_alnem_sensor.c _alnem_maestro.c _alnem_simulator.c: alnem_deployment.txt + ../gras_stub_generator alnem alnem_deployment.txt >/dev/null + + + + diff --git a/examples/alnem/alnem.c b/examples/alnem/alnem.c new file mode 100644 index 0000000000..9d4d95f17e --- /dev/null +++ b/examples/alnem/alnem.c @@ -0,0 +1,217 @@ +/* $Id$ */ + +/* ALNeM itself */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#include +#include +#include +#include + +#include + +#include /* alvin's graph toolbox (+ reconstruction algorithm) */ + +/* ********************************************************************** + * Sensor code + * **********************************************************************/ + +/* Global private data */ +typedef struct { + gras_sock_t *sock; +} sensor_data_t; + +/* Function prototypes */ +int sensor (int argc,char *argv[]); + +int sensor (int argc,char *argv[]) { + gras_error_t errcode; + sensor_data_t *g=gras_userdata_new(sensor_data_t); + + if ((errcode=gras_sock_server_open(4000,4000,&(g->sock)))) { + fprintf(stderr,"Sensor: Error %s encountered while opening the server socket\n",gras_error_name(errcode)); + return 1; + } + + if (grasbw_register_messages()) { + gras_sock_close(g->sock); + return 1; + } + + while (1) { + if ((errcode=gras_msg_handle(3600.0)) && errcode != timeout_error) { + fprintf(stderr,"Sensor: Error '%s' while handling message\n", + gras_error_name(errcode)); + } + } + + gras_sleep(5,0); + return gras_sock_close(g->sock); +} + +/* ********************************************************************** + * Maestro code + * **********************************************************************/ + +/* Global private data */ +typedef struct { + gras_sock_t *sock; +} maestro_data_t; + +/* Function prototypes */ +int maestro (int argc,char *argv[]); + +#define MAXHOSTS 100 + +#define INTERF(graph,table,a,u,b,v) INTERFERENCE(table,\ + TBX_Graph_nodeSearch(graph,a),\ + TBX_Graph_nodeSearch(graph,u),\ + TBX_Graph_nodeSearch(graph,b),\ + TBX_Graph_nodeSearch(graph,v)) + +int maestro(int argc,char *argv[]) { + int bufSize=32 * 1024; + int expSize= 1024 * 1024; + int msgSize=expSize; + int satSize=msgSize * 100; + double dummy,beginSim; + gras_error_t errcode; + maestro_data_t *g=gras_userdata_new(maestro_data_t); + + double bw[MAXHOSTS][MAXHOSTS]; + double bw_sat[MAXHOSTS][MAXHOSTS]; + + int a,b,c,d,begin; + + TBX_Graph_t graph = TBX_Graph_newGraph("Essai",0,NULL); /* a dummy graph containing all hosts */ + TBX_FIFO_t host_fifo = TBX_FIFO_newFIFO(); + TBX_InterfTable_t interf = NULL; /* the measured interferences */ + TBX_Graph_t builded_graph = NULL; /* the graph builded from the interferences */ + + /* basics setups */ + if (argc>MAXHOSTS) { + fprintf(stderr,"You gave more than %d sensors for this experiment. Increase the MAX HOSTS constant in alnem code to be bigger than this number.\n",argc); + return 1; + } + + if ((errcode=gras_sock_server_open(4000,5000,&(g->sock)))) { + fprintf(stderr,"MAESTRO: Error %s encountered while opening the server socket\n",gras_error_name(errcode)); + return 1; + } + + if (grasbw_register_messages()) { + gras_sock_close(g->sock); + return 1; + } + + for (a=1; a %f (%f vs %f)%s\n", + gras_time(), + argv[c],argv[d],argv[a],argv[b], + bw_sat[c][d]/bw[c][d],bw[c][d],bw_sat[c][d], + + (bw_sat[c][d]/bw[c][d] < 0.75) ? " THERE IS SOME INTERFERENCE !!!":""); + INTERF(graph,interf,argv[c],argv[d],argv[a],argv[b])= + (bw_sat[c][d]/bw[c][d] < 0.75) ? 1 : 0; + } + } + + if ((errcode=grasbw_saturate_stop(argv[a],4000,argv[b],4000))) { + fprintf(stderr,"MAESTRO: Error %s encountered while stopping saturation\n", + gras_error_name(errcode)); + return -1; + } + fprintf(stderr,"Did an iteration on saturation pair in %ld sec (%.2f simulated sec)\n", + time(NULL)-begin, gras_time()-beginSim); + } + } + + /* reconstruct the graph */ + TBX_Graph_interferenceTableDump(interf); + TBX_Graph_interferenceTableSave(interf,"interference.dat"); + begin=time(NULL); + fprintf(stderr, "MAESTRO: Reconstruct the graph... "); + builded_graph = TBX_Graph_exploreInterference(interf); + TBX_Graph_exportToGraphViz(builded_graph, "toto.dot"); + fprintf(stderr, "done (took %d sec)",(int)time(NULL)); + + /* end */ + TBX_Graph_freeGraph(graph,NULL,NULL,NULL); + TBX_Graph_freeGraph(builded_graph,NULL,NULL,NULL); + TBX_Graph_freeInterfTable(interf); + + gras_sleep(5,0); + exit(0); /* FIXME: There is a bug in MSG preventing me from terminating this server properly */ + return gras_sock_close(g->sock); +} diff --git a/examples/alnem/alnem_builder.c b/examples/alnem/alnem_builder.c new file mode 100644 index 0000000000..3077cb6c9c --- /dev/null +++ b/examples/alnem/alnem_builder.c @@ -0,0 +1,38 @@ +/* $Id$ */ + +/* ALNeM builder. Take an interference matrix as argument, */ +/* and reconstruct the corresponding graph itself */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + + +#include +#include + +#include /* alvin's graph toolbox (+ reconstruction algorithm) */ + +int main(int argc,char *argv[]) { + TBX_Graph_t graph; /* a dummy graph containing all hosts */ + TBX_FIFO_t host_fifo; + TBX_InterfTable_t interf; /* the measured interferences */ + TBX_Graph_t builded_graph; /* the graph builded from the interferences */ + + if (argc != 2) { + fprintf(stderr,"alnem_builder: USAGE:\n"); + fprintf(stderr," alnem_builder interference_file\n"); + exit (1); + } + + if (TBX_Graph_interferenceTableRead (argv[1],&graph,&interf,&host_fifo)) { + fprintf(stderr,"Can't read the interference data, aborting\n"); + exit (1); + } + + builded_graph = TBX_Graph_exploreInterference(interf); + TBX_Graph_exportToGraphViz(builded_graph, "toto.dot"); + return 0; +} diff --git a/examples/alnem/alnem_deployment.txt b/examples/alnem/alnem_deployment.txt new file mode 100644 index 0000000000..963935a901 --- /dev/null +++ b/examples/alnem/alnem_deployment.txt @@ -0,0 +1,5 @@ +A sensor +B sensor +C sensor +D sensor +Master maestro A B C D diff --git a/examples/alnem/deploy_WAN3.txt b/examples/alnem/deploy_WAN3.txt new file mode 100644 index 0000000000..6a88ba61ac --- /dev/null +++ b/examples/alnem/deploy_WAN3.txt @@ -0,0 +1,34 @@ +61 sensor +62 sensor +63 sensor +69 sensor +70 sensor +77 sensor +81 sensor +83 sensor +85 sensor +87 sensor +88 sensor +95 sensor +98 sensor +107 sensor +109 sensor +111 sensor +112 sensor +121 sensor +124 sensor +125 sensor +131 sensor +145 sensor +150 sensor +156 sensor +157 sensor +162 sensor +165 sensor +168 sensor +169 sensor +170 sensor +175 sensor +177 sensor +178 sensor +109 maestro 61 62 63 69 70 77 81 83 85 98 107 109 111 112 121 124 125 131 145 150 156 157 162 165 168 169 170 175 177 178 diff --git a/examples/alnem/interference.dat b/examples/alnem/interference.dat new file mode 100644 index 0000000000..c2fdc05c83 --- /dev/null +++ b/examples/alnem/interference.dat @@ -0,0 +1,30 @@ +INTERFERENCE GRAPH DUMPED TO FILE. DO NOT EDIT, EVEN TO ADD OR REMOVE A SPACE !! +4 +A +B +C +D +1 1 +1 1 +1 0 +1 1 +1 0 +1 1 +1 1 +1 1 +1 0 +1 1 +1 0 +1 1 +1 1 +0 1 +1 1 +0 1 +1 1 +1 1 +1 1 +0 1 +1 1 +0 1 +1 1 +1 1 diff --git a/examples/bandwidth/.cvsignore b/examples/bandwidth/.cvsignore new file mode 100644 index 0000000000..3e22f82813 --- /dev/null +++ b/examples/bandwidth/.cvsignore @@ -0,0 +1 @@ +.deps .libs Makefile Makefile.in _*.c bandwidth_maestro bandwidth_sensor bandwidth_simulator diff --git a/examples/bandwidth/Makefile.am b/examples/bandwidth/Makefile.am new file mode 100644 index 0000000000..b8105fc5cf --- /dev/null +++ b/examples/bandwidth/Makefile.am @@ -0,0 +1,20 @@ +DISTCLEANFILES=Makefile.in +INCLUDES= -I$(top_srcdir)/src/include + +noinst_PROGRAMS=bandwidth_simulator bandwidth_maestro bandwidth_sensor + +bandwidth_simulator_SOURCES= _bandwidth_simulator.c bandwidth.c +bandwidth_maestro_SOURCES= _bandwidth_maestro.c bandwidth.c +bandwidth_sensor_SOURCES= _bandwidth_sensor.c bandwidth.c + + +bandwidth_simulator_LDADD= $(top_srcdir)/src/core/libgrassg.a $(top_srcdir)/src/modules/libgrasmodules.a @LIBS_SimGrid@ @LIBS_XML@ +bandwidth_maestro_LDADD= $(top_srcdir)/src/core/libgrasrl.a $(top_srcdir)/src/modules/libgrasmodules.a +bandwidth_sensor_LDADD= $(top_srcdir)/src/core/libgrasrl.a $(top_srcdir)/src/modules/libgrasmodules.a + +# cleanup temps +CLEANFILES=_bandwidth_simulator.c _bandwidth_maestro.c _bandwidth_sensor.c + +# generate temps +_bandwidth_maestro.c _bandwidth_sensor.c _bandwidth_simulator.c: bandwidth_deployment.txt + $(top_srcdir)/src/examples/gras_stub_generator bandwidth bandwidth_deployment.txt >/dev/null diff --git a/examples/bandwidth/bandwidth.c b/examples/bandwidth/bandwidth.c new file mode 100644 index 0000000000..6019be2081 --- /dev/null +++ b/examples/bandwidth/bandwidth.c @@ -0,0 +1,104 @@ +/* $Id$ */ + +/* bandwidth - bandwidth test demo of GRAS features */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#include +#include +#include + +#include + +/* ********************************************************************** + * Sensor code + * **********************************************************************/ + +/* Global private data */ +typedef struct { + gras_sock_t *sock; +} sensor_data_t; + +/* Function prototypes */ +int sensor (int argc,char *argv[]); + +int sensor (int argc,char *argv[]) { + gras_error_t errcode; + sensor_data_t *g=gras_userdata_new(sensor_data_t); + + if ((errcode=gras_sock_server_open(4000,4000,&(g->sock)))) { + fprintf(stderr,"Sensor: Error %s encountered while opening the server socket\n",gras_error_name(errcode)); + return 1; + } + + if (grasbw_register_messages()) { + gras_sock_close(g->sock); + return 1; + } + + while (1) { + if ((errcode=gras_msg_handle(60.0)) && errcode != timeout_error) { + fprintf(stderr,"Sensor: Error '%s' while handling message\n",gras_error_name(errcode)); + gras_sock_close(g->sock); + return errcode; + } + if (errcode==no_error) + break; + } + + gras_sleep(5,0); + return gras_sock_close(g->sock); +} + +/* ********************************************************************** + * Maestro code + * **********************************************************************/ + +/* Global private data */ +typedef struct { + gras_sock_t *sock; +} maestro_data_t; + +/* Function prototypes */ +int maestro (int argc,char *argv[]); + +int maestro(int argc,char *argv[]) { + gras_error_t errcode; + maestro_data_t *g=gras_userdata_new(maestro_data_t); + double sec, bw; + int bufSize=32 * 1024; + int expSize=64 * 1024; + int msgSize=64 * 1024; + + if ((errcode=gras_sock_server_open(4000,5000,&(g->sock)))) { + fprintf(stderr,"Maestro: Error %s encountered while opening the server socket\n",gras_error_name(errcode)); + return 1; + } + + if (grasbw_register_messages()) { + gras_sock_close(g->sock); + return 1; + } + + if (argc != 5) { + fprintf(stderr,"Usage: maestro host port host port\n"); + return 1; + } + + if ((errcode=grasbw_request(argv[1],atoi(argv[2]),argv[3],atoi(argv[4]), + bufSize,expSize,msgSize,&sec,&bw))) { + fprintf(stderr,"maestro: Error %s encountered while doing the test\n",gras_error_name(errcode)); + return 1; + } + + fprintf(stderr,"maestro: Experience (%d ko in msgs of %d ko) took %f sec, achieving %f Mb/s\n", + expSize/1024,msgSize/1024, + sec,bw); + + gras_sleep(5,0); + return gras_sock_close(g->sock); +} diff --git a/examples/bandwidth/bandwidth_deployment.txt b/examples/bandwidth/bandwidth_deployment.txt new file mode 100644 index 0000000000..6c61a0e270 --- /dev/null +++ b/examples/bandwidth/bandwidth_deployment.txt @@ -0,0 +1,3 @@ +125 sensor +95 sensor +109 maestro 125 4000 95 4000 diff --git a/examples/gras_stub_generator b/examples/gras_stub_generator new file mode 100755 index 0000000000..63828eb4ec --- /dev/null +++ b/examples/gras_stub_generator @@ -0,0 +1,193 @@ +#! /usr/bin/perl + +# gras_stub_generator - creates the main() to use a GRAS program + +# Authors: Martin Quinson +# Copyright (C) 2003 the OURAGAN project. + +# This program is free software; you can redistribute it and/or modify it +# under the terms of the license (GNU LGPL) which comes with this package. + +use strict; +use warnings; + + +sub usage { + my ($msg)=@_; + fail ($msg? "gras_stub_generator: $msg\n":""). + "gras_stub_generator: USAGE\n". + " gras_stub_generator project_name deployment_file\n" +} + +my ($project,$deploy_file)=@ARGV; + +$project && $deploy_file || usage(); + +my (%process); + +open (DEPLOY, $deploy_file) || usage("Cannot open $deploy_file: $!"); +my $linenum=0; +while () { + $linenum++; + /^\W*\w*\W*(\w*)/ || usage("$deploy_file:$linenum: Parse error"); + $process{$1}=1; +} + +my $warn="/***********\n * DO NOT EDIT! THIS FILE WERE AUTOMATICALLY GENERATED FROM $deploy_file BY gras_stub_generator\n ***********/\n"; + +##### +# Generate the file for the simulator +##### + +open (OUT,">_${project}_simulator.c") || die "Cannot open _${project}_simulator,c: $!"; +print OUT < +#include +#include +#include + +EOF + ; +foreach (keys %process) { print OUT "int $_(int argc,char *argv[]);\n"; } +print OUT "\n"; +foreach (keys %process) { print OUT "int launch_$_(int argc,char *argv[]);\n"; } +print OUT "\n$warn\n"; + +foreach (keys %process) { + print OUT<_${project}_$pname.c") || die "Cannot open _${project}_$pname,c: $!"; + print OUT < +#include +#include + +/* signal handler for SIGPIPE from NWS */ +void SocketFailure(int sig); +/* minimum needed from diagnostic.h for initialization, so that we don''t have to ship this file */ +typedef enum {DIAGLOG, DIAGINFO, DIAGWARN, DIAGERROR, DIAGFATAL, DIAGDEBUG} DiagLevels; +void DirectDiagnostics(DiagLevels level, FILE *whereTo); +/* user code */ +int $pname(int argc, char *argv[]); + +$warn + +int main(int argc, char *argv[]){ + int errcode; + + DirectDiagnostics(DIAGDEBUG, stdout); + DirectDiagnostics(DIAGINFO, stdout); + DirectDiagnostics(DIAGLOG, stdout); + DirectDiagnostics(DIAGWARN, stderr); + DirectDiagnostics(DIAGERROR, stderr); + DirectDiagnostics(DIAGFATAL, stderr); + + signal(SIGPIPE, SocketFailure); + + gras_process_init(); + errcode=$pname(argc,argv); + gras_process_finalize(); + + return errcode; +} + +$warn +EOF +; + close OUT || die "Cannot write _${project}_$pname,c: $!"; +} + +##### +# Outputs the Makefile.am snippet +##### + +print ">>> Files for project '$project' successfully generated.\n"; +print ">>> Add (and edit) the following to you Makefile.am:\n\n"; + +print "# AUTOMAKE variable definition\n"; +print "INCLUDES= \@CFLAGS_GRAS\@ \@CFLAGS_XML\@ \@CFLAGS_SimGrid\@\n\n"; +print "PROGRAMS=${project}_simulator "; + +foreach (keys %process) { + print "${project}_$_ "; +} +print "\n\n${project}_simulator_SOURCES=\t_${project}_simulator.c $project.c\n"; +foreach (keys %process) { + print "${project}_${_}_SOURCES=\t_${project}_${_}.c $project.c\n"; +} + +print "\n\n${project}_simulator_LDADD=\tpath/to/libgrassg.a \@LIBS_SimGrid\@ \@LIBS_XML\@\n"; +foreach (keys %process) { + print "${project}_${_}_LDADD=\tpath/to/libgrasrl.a\n"; +} + +print "\n# cleanup temps\n"; +print "CLEANFILES= _${project}_simulator.c "; +foreach (keys %process) { + print "_${project}_$_.c "; +} +print "\n"; + +print "\n# generate temps\n"; +# A rule to generate the source file each time the deployment file changes +foreach (keys %process) { + print "_${project}_$_.c "; +} +print "_${project}_simulator.c: $deploy_file\n"; +print "\tgras_stub_generator $project $deploy_file >/dev/null\n"; + + +print "\n>>> Bye.\n" diff --git a/examples/ping/.cvsignore b/examples/ping/.cvsignore new file mode 100644 index 0000000000..0bf428aa79 --- /dev/null +++ b/examples/ping/.cvsignore @@ -0,0 +1 @@ +.deps .libs Makefile Makefile.in _*.c ping_server ping_client ping_simulator diff --git a/examples/ping/Makefile.am b/examples/ping/Makefile.am new file mode 100644 index 0000000000..9f1823303c --- /dev/null +++ b/examples/ping/Makefile.am @@ -0,0 +1,23 @@ +DISTCLEANFILES=Makefile.in +INCLUDES= -I$(top_srcdir)/src/include + +# AUTOMAKE variable definition +noinst_PROGRAMS=ping_simulator ping_client ping_server + +ping_simulator_SOURCES= _ping_simulator.c ping.c +ping_client_SOURCES= _ping_client.c ping.c +ping_server_SOURCES= _ping_server.c ping.c + + +ping_simulator_LDADD= $(top_srcdir)/src/core/libgrassg.a @LIBS_SimGrid@ @LIBS_XML@ +ping_client_LDADD= $(top_srcdir)/src/core/libgrasrl.a +ping_server_LDADD= $(top_srcdir)/src/core/libgrasrl.a + +# cleanup temps +CLEANFILES= _ping_simulator.c _ping_client.c _ping_server.c + +# generate temps +_ping_client.c _ping_server.c _ping_simulator.c: ping_deployment.txt + $(top_srcdir)/src/examples/gras_stub_generator ping ping_deployment.txt >/dev/null + + diff --git a/examples/ping/ping.c b/examples/ping/ping.c new file mode 100644 index 0000000000..6395d51eb4 --- /dev/null +++ b/examples/ping/ping.c @@ -0,0 +1,175 @@ +/* $Id$ */ + +/* ping - ping/pong demo of GRAS features */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#include +#include +#include + +#include + +/* ********************************************************************** + * Comon code + * **********************************************************************/ +/* message definition */ +#define MSG_PING 1024 +#define MSG_PONG 1025 + +typedef struct { + int dummy; +} msgPing_t; + +static const DataDescriptor msgPingDesc[] = + {SIMPLE_MEMBER(INT_TYPE,1,offsetof(msgPing_t,dummy))}; +#define msgPingLength 1 + +typedef msgPing_t msgPong_t; +static const DataDescriptor msgPongDesc[] = + {SIMPLE_MEMBER(INT_TYPE,1,offsetof(msgPong_t,dummy))}; +#define msgPongLength 1 + +/* Function prototypes */ +gras_error_t register_messages(const char *prefix); + +/* Code */ +gras_error_t register_messages(const char *prefix) { + gras_error_t errcode; + + if ((errcode=gras_msgtype_register(MSG_PING,"ping",1,msgPingDesc,msgPingLength)) || + (errcode=gras_msgtype_register(MSG_PONG,"pong",1,msgPongDesc,msgPongLength))) { + fprintf(stderr,"%s: Unable register the messages (got error %s)\n", + prefix,gras_error_name(errcode)); + return errcode; + } + return no_error; +} + +/* ********************************************************************** + * Server code + * **********************************************************************/ + +/* Global private data */ +typedef struct { + gras_sock_t *sock; + int endcondition; +} server_data_t; + +/* Function prototypes */ +int server_cbPingHandler(gras_msg_t *msg); +int server (int argc,char *argv[]); + + +int server_cbPingHandler(gras_msg_t *msg) { + int *dummy=malloc(sizeof(int*)); + server_data_t *g=(server_data_t*)gras_userdata_get(); + + g->endcondition = 0; + *dummy=4321; + fprintf (stderr,"SERVER: >>>>>>>> Got message PING(%d) from %s:%d <<<<<<<<\n", + gras_msg_ctn(msg,0,0,int), gras_sock_get_peer_name(msg->sock),gras_sock_get_peer_port(msg->sock)); + + if (gras_msg_new_and_send(msg->sock,MSG_PONG,1, dummy,1)) { + fprintf(stderr,"SERVER: Unable answer with PONG\n"); + gras_sock_close(g->sock); + return 1; + } + + gras_msg_free(msg); + fprintf(stderr,"SERVER: >>>>>>>> Answed with PONG(4321) <<<<<<<<\n"); + g->endcondition = 1; + return 1; +} + +int server (int argc,char *argv[]) { + gras_error_t errcode; + server_data_t *g=gras_userdata_new(server_data_t); + + if ((errcode=gras_sock_server_open(4000,4000,&(g->sock)))) { + fprintf(stderr,"SERVER: Error %s encountered while opening the server socket\n",gras_error_name(errcode)); + return 1; + } + + if (register_messages("SERVER") || + gras_cb_register(MSG_PING,-1,&server_cbPingHandler)) { + gras_sock_close(g->sock); + return 1; + } + + fprintf(stderr,"SERVER: >>>>>>>> Listening on port %d <<<<<<<<\n",gras_sock_get_my_port(g->sock)); + g->endcondition=0; + + while (!g->endcondition) { + if ((errcode=gras_msg_handle(60.0))) { + fprintf(stderr,"SERVER: Error '%s' while handling message\n",gras_error_name(errcode)); + gras_sock_close(g->sock); + return errcode; + } + } + + gras_sleep(5,0); + fprintf(stderr,"SERVER: Done.\n"); + return gras_sock_close(g->sock); +} + +/* ********************************************************************** + * Client code + * **********************************************************************/ + +/* Global private data */ +typedef struct { + gras_sock_t *sock; +} client_data_t; + +/* Function prototypes */ +int client (int argc,char *argv[]); + +int client(int argc,char *argv[]) { + int dummy=1234; + gras_msg_t *msg; + gras_error_t errcode; + client_data_t *g=gras_userdata_new(client_data_t); + + if ((errcode=gras_sock_client_open("102",4000,&(g->sock)))) { + fprintf(stderr,"Client: Unable to connect to the server. Got %s\n", + gras_error_name(errcode)); + return 1; + } + + if (register_messages("Client")) { + // grasCloseSocket(g->sock); + return 1; + } + + fprintf(stderr,"Client: >>>>>>>> Connected to server which is on %s:%d <<<<<<<<\n", + gras_sock_get_peer_name(g->sock),gras_sock_get_peer_port(g->sock)); + + if (gras_msg_new_and_send(g->sock,MSG_PING, 1, &dummy,1)) { + fprintf(stderr,"Client: Unable send PING to server\n"); + gras_sock_close(g->sock); + return 1; + } + fprintf(stderr,"Client: >>>>>>>> Message PING(%d) sent to %s:%d <<<<<<<<\n", + dummy, gras_sock_get_peer_name(g->sock),gras_sock_get_peer_port(g->sock)); + + if ((errcode=gras_msg_wait(6000,MSG_PONG,&msg))) { + fprintf(stderr,"Client: Why can't I get my PONG message like everyone else (%s error)?!\n", + gras_error_name(errcode)); + gras_sock_close(g->sock); + return 1; + } + + fprintf(stderr,"Client: >>>>>>>> Message PONG(%d) got from %s:%d <<<<<<<<\n", + gras_msg_ctn(msg,0,0,int),gras_sock_get_peer_name(msg->sock),gras_sock_get_peer_port(msg->sock)); + gras_msg_free(msg); + + gras_sleep(5,0); + gras_sock_close(g->sock); + fprintf(stderr,"Client: Done.\n"); + return 0; +} diff --git a/examples/ping/ping_deployment.txt b/examples/ping/ping_deployment.txt new file mode 100644 index 0000000000..7ac98993ff --- /dev/null +++ b/examples/ping/ping_deployment.txt @@ -0,0 +1,2 @@ +102 server +161 client 102 0 diff --git a/examples/saturate/.cvsignore b/examples/saturate/.cvsignore new file mode 100644 index 0000000000..f5d26929f0 --- /dev/null +++ b/examples/saturate/.cvsignore @@ -0,0 +1 @@ +.deps .libs Makefile Makefile.in _*.c saturate_sensor saturate_maestro saturate_simulator diff --git a/examples/saturate/Makefile.am b/examples/saturate/Makefile.am new file mode 100644 index 0000000000..338a314874 --- /dev/null +++ b/examples/saturate/Makefile.am @@ -0,0 +1,23 @@ +DISTCLEANFILES=Makefile.in +INCLUDES= -I$(top_srcdir)/src/include + +noinst_PROGRAMS=saturate_simulator saturate_sensor saturate_maestro + +saturate_simulator_SOURCES= _saturate_simulator.c saturate.c +saturate_sensor_SOURCES= _saturate_sensor.c saturate.c +saturate_maestro_SOURCES= _saturate_maestro.c saturate.c + +saturate_simulator_LDADD= $(top_srcdir)/src/core/libgrassg.a $(top_srcdir)/src/modules/libgrasmodules.a @LIBS_SimGrid@ @LIBS_XML@ +saturate_sensor_LDADD= $(top_srcdir)/src/core/libgrasrl.a $(top_srcdir)/src/modules/libgrasmodules.a +saturate_maestro_LDADD= $(top_srcdir)/src/core/libgrasrl.a $(top_srcdir)/src/modules/libgrasmodules.a + +# cleanup templates +CLEANFILES= _saturate_simulator.c _saturate_sensor.c _saturate_maestro.c + +# generate templates +_saturate_sensor.c _saturate_maestro.c _saturate_simulator.c: saturate_deployment.txt + ../gras_stub_generator saturate saturate_deployment.txt >/dev/null + + + + diff --git a/examples/saturate/deploy_old.txt b/examples/saturate/deploy_old.txt new file mode 100644 index 0000000000..88a1b07a61 --- /dev/null +++ b/examples/saturate/deploy_old.txt @@ -0,0 +1,34 @@ +61 sensor +62 sensor +63 sensor +69 sensor +70 sensor +77 sensor +81 sensor +83 sensor +85 sensor +87 sensor +88 sensor +95 sensor +98 sensor +107 sensor +109 sensor +111 sensor +112 sensor +121 sensor +124 sensor +125 sensor +131 sensor +145 sensor +150 sensor +156 sensor +157 sensor +162 sensor +165 sensor +168 sensor +169 sensor +170 sensor +175 sensor +177 sensor +178 sensor +109 maestro 95 4000 112 4000 125 4000 87 4000 diff --git a/examples/saturate/saturate.c b/examples/saturate/saturate.c new file mode 100644 index 0000000000..52136fd4cd --- /dev/null +++ b/examples/saturate/saturate.c @@ -0,0 +1,253 @@ +/* $Id$ */ + +/* saturate - link saturation demo of GRAS features */ +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + + +#include +#include +#include +#include + +#include + +/* ********************************************************************** + * Sensor code + * **********************************************************************/ + +/* Global private data */ +typedef struct { + gras_sock_t *sock; +} sensor_data_t; + +/* Function prototypes */ +int sensor (int argc,char *argv[]); + +int sensor (int argc,char *argv[]) { + gras_error_t errcode; + sensor_data_t *g=gras_userdata_new(sensor_data_t); + + if ((errcode=gras_sock_server_open(4000,4000,&(g->sock)))) { + fprintf(stderr,"Sensor: Error %s encountered while opening the server socket\n",gras_error_name(errcode)); + return 1; + } + + if (grasbw_register_messages()) { + gras_sock_close(g->sock); + return 1; + } + + while (1) { + if ((errcode=gras_msg_handle(60.0)) && errcode != timeout_error) { + fprintf(stderr,"Sensor: Error '%s' while handling message\n", + gras_error_name(errcode)); + } + } + + gras_sleep(5,0); + return gras_sock_close(g->sock); +} + +/* ********************************************************************** + * Maestro code + * **********************************************************************/ + +/* Global private data */ +typedef struct { + gras_sock_t *sock; +} maestro_data_t; + +/* Function prototypes */ +int maestro (int argc,char *argv[]); +double XP(const char *bw1, const char *bw2, const char *sat1, const char *sat2); + +double XP(const char *bw1, const char *bw2, const char *sat1, const char *sat2) { + gras_error_t errcode; + int bufSize=32 * 1024; + int expSize=64 * 1024; + int msgSize=64 * 1024; + int satSize=msgSize * 10; + double sec, bw, sec_sat,bw_sat; + + if ((errcode=grasbw_request(bw1,4000,bw2,4000,bufSize,expSize,msgSize,&sec,&bw))) { + fprintf(stderr,"MAESTRO: Error %s encountered while doing the test\n",gras_error_name(errcode)); + return -1; + } + + fprintf(stderr,"MAESTRO: BW(%s,%s) => %f sec, achieving %f Mb/s\n",bw1,bw2,sec,bw); + + if ((errcode=grasbw_saturate_start(sat1,4000,sat2,4000,satSize,60))) { + fprintf(stderr,"MAESTRO: Error %s encountered while starting saturation\n", + gras_error_name(errcode)); + return -1; + } + gras_sleep(1,0); + if ((errcode=grasbw_request(bw1,4000,bw2,4000,bufSize,expSize,msgSize,&sec_sat,&bw_sat))) { + fprintf(stderr,"MAESTRO: Error %s encountered while doing the test\n",gras_error_name(errcode)); + return -1; + } + + fprintf(stderr,"MAESTRO: BW(%s,%s//%s,%s) => %f sec, achieving %f Mb/s\n", + bw1,bw2,sat1,sat2,sec_sat,bw_sat); + + if ((errcode=grasbw_saturate_stop(sat1,4000,sat2,4000))) { + fprintf(stderr,"MAESTRO: Error %s encountered while stopping saturation\n", + gras_error_name(errcode)); + return -1; + } + + if (bw_sat/bw < 0.7) { + fprintf(stderr,"MAESTRO: THERE IS SOME INTERFERENCE !!!\n"); + } + if (bw/bw_sat < 0.7) { + fprintf(stderr,"MAESTRO: THERE IS SOME INTERFERENCE (and Im a cretin) !!!\n"); + } + return bw_sat/bw; + +} + +//#define MAXHOSTS 33 +#define MAXHOSTS 4 + +int maestro(int argc,char *argv[]) { + int bufSize=32 * 1024; + int expSize= 1024 * 1024; + int msgSize=expSize; + int satSize=msgSize * 100; + double dummy,beginSim; + gras_error_t errcode; + maestro_data_t *g=gras_userdata_new(maestro_data_t); + // const char *hosts[MAXHOSTS] = { "61", "62", "63", "69", "70", "77", "81", "83", "85", "87", "88", "95", "98", "107", "109", "111", "112", "121", "124", "125", "131", "145", "150", "156", "157", "162", "165", "168", "169", "170", "175", "177", "178" }; + const char *hosts[MAXHOSTS] = { "A", "B", "C", "D" }; + + double bw[MAXHOSTS][MAXHOSTS]; + double bw_sat[MAXHOSTS][MAXHOSTS]; + + int a,b,c,d,begin; + + if ((errcode=gras_sock_server_open(4000,5000,&(g->sock)))) { + fprintf(stderr,"MAESTRO: Error %s encountered while opening the server socket\n",gras_error_name(errcode)); + return 1; + } + + if (grasbw_register_messages()) { + gras_sock_close(g->sock); + return 1; + } + + begin=time(NULL); + beginSim=gras_time(); + for (a=0; a %f (%f vs %f)%s\n", + gras_time(), + hosts[c],hosts[d],hosts[a],hosts[b], + bw_sat[c][d]/bw[c][d],bw[c][d],bw_sat[c][d], + + (bw_sat[c][d]/bw[c][d] < 0.7) ? " THERE IS SOME INTERFERENCE !!!": + ((bw[c][d]/bw_sat[c][d] < 0.7) ? " THERE IS SOME INTERFERENCE (and Im a cretin) !!!": + "")); + } + } + + if ((errcode=grasbw_saturate_stop(hosts[a],4000,hosts[b],4000))) { + fprintf(stderr,"MAESTRO: Error %s encountered while stopping saturation\n", + gras_error_name(errcode)); + return -1; + } + fprintf(stderr,"Did an iteration on saturation pair in %ld sec (%.2f simulated sec)\n", + time(NULL)-begin, gras_time()-beginSim); + } + } + + gras_sleep(5,0); + exit(0); +#if 0 + return 0; + /* start saturation */ + fprintf(stderr,"MAESTRO: Start saturation with size %d\n",msgSize); + if ((errcode=grasbw_saturate_start(argv[5],atoi(argv[6]),argv[7],atoi(argv[8]),msgSize*10,60))) { + fprintf(stderr,"MAESTRO: Error %s encountered while starting saturation\n", + gras_error_name(errcode)); + return 1; + } + fprintf(stderr,"MAESTRO: Saturation started\n"); + gras_sleep(5,0); + + /* test with saturation */ + if ((errcode=grasbw_request(argv[1],atoi(argv[2]),argv[3],atoi(argv[4]), + bufSize,expSize,msgSize,&sec,&bw))) { + fprintf(stderr,"MAESTRO: Error %s encountered while doing the test\n",gras_error_name(errcode)); + return 1; + } + + fprintf(stderr,"MAESTRO: Experience3 (%d ko in msgs of %d ko with saturation) took %f sec, achieving %f Mb/s\n", + expSize/1024,msgSize/1024, + sec,bw); + + /* stop saturation */ + if ((errcode=grasbw_saturate_stop(argv[5],atoi(argv[6]),argv[7],atoi(argv[8])))) { + fprintf(stderr,"MAESTRO: Error %s encountered while stopping saturation\n", + gras_error_name(errcode)); + return 1; + } + + /* test without saturation */ + if ((errcode=grasbw_request(argv[1],atoi(argv[2]),argv[3],atoi(argv[4]), + bufSize,expSize,msgSize,&sec,&bw))) { + fprintf(stderr,"MAESTRO: Error %s encountered while doing the test\n",gras_error_name(errcode)); + return 1; + } + + fprintf(stderr,"MAESTRO: Experience4 (%d ko in msgs of %d ko, without saturation) took %f sec, achieving %f Mb/s\n", + expSize/1024,msgSize/1024, + sec,bw); + + gras_sleep(5,0); +#endif + return gras_sock_close(g->sock); +} diff --git a/examples/saturate/saturate_deployment.txt b/examples/saturate/saturate_deployment.txt new file mode 100644 index 0000000000..678c4e5188 --- /dev/null +++ b/examples/saturate/saturate_deployment.txt @@ -0,0 +1,5 @@ +A sensor +B sensor +C sensor +D sensor +Master maestro diff --git a/include/config.h b/include/config.h new file mode 100644 index 0000000000..e57ebeb9ec --- /dev/null +++ b/include/config.h @@ -0,0 +1,123 @@ +/* $Id$ */ + +/* config - Dictionnary where the type of each cell is provided. */ + +/* This is useful to build named structs, like option or property sets. */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2001,2002,2003,2004 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef _GRAS_CONFIG_H_ +#define _GRAS_CONFIG_H_ + +typedef struct { + char *name; + int port; +} gras_host_t; + +/* For now, a config is only a special dynar. But don't rely on it, */ +/* it may change in the future. */ +typedef gras_dynar_t gras_cfg_t; + +/* type of a typed hash cell */ +typedef enum { + gras_cfgelm_int=0, gras_cfgelm_double, gras_cfgelm_string, gras_cfgelm_host, + gras_cfgelm_type_count +} gras_cfgelm_type_t; + +/*----[ Memory management ]-----------------------------------------------*/ +gras_error_t gras_cfg_new (gras_cfg_t **whereto); /* (whereto == NULL) is ok */ +gras_error_t gras_cfg_cpy(gras_cfg_t **whereto, gras_cfg_t *tocopy); +void gras_cfg_free(gras_cfg_t **cfg); +void gras_cfg_dump(const char *name,const char*indent,gras_cfg_t *cfg); + +/*----[ Registering stuff ]-----------------------------------------------*/ +/* Register a possible cell */ +gras_error_t gras_cfg_register(gras_cfg_t *cfg, + const char *name, gras_cfgelm_type_t type, + int min, int max); +/* Unregister a possible cell */ +gras_error_t gras_cfg_unregister(gras_cfg_t *cfg, const char *name); + +/* Parse the configuration descriptor and register it */ +/* Should be of the form ":_to__", */ +/* with type being one of 'string','int', 'host' or 'double' */ +gras_error_t gras_cfg_register_str(gras_cfg_t *cfg, const char *entry); + +/* Check that each cell have the right amount of elements */ +gras_error_t gras_cfg_check(gras_cfg_t *cfg); + +/* Get the type of this option in that repository */ +gras_error_t gras_cfg_get_type(gras_cfg_t *cfg, const char *name, + /* OUT */ gras_cfgelm_type_t *type); + +/*----[ Setting ]--------------------------------------------------------- + * gras_cfg_set_* functions. + * + * If the registered maximum is equal to 1, those functions remplace the + * current value with the provided one. If max>1, the provided value is + * appended to the list. + * + * string values are strdup'ed before use, so you have to free your copy */ + +gras_error_t gras_cfg_set_vargs(gras_cfg_t *cfg, va_list pa); +gras_error_t gras_cfg_set(gras_cfg_t *cfg, ...); + +/* + Add the cells described in a string to a typed hash. + */ +gras_error_t gras_cfg_set_parse(gras_cfg_t *cfg, const char *options); + + +/* + Set the value of the cell @name in @cfg with the provided value. + */ +gras_error_t gras_cfg_set_int (gras_cfg_t *cfg, const char *name, + int val); +gras_error_t gras_cfg_set_double(gras_cfg_t *cfg, const char *name, + double val); +gras_error_t gras_cfg_set_string(gras_cfg_t *cfg, const char *name, + const char *val); +gras_error_t gras_cfg_set_host (gras_cfg_t *cfg, const char *name, + const char *host,int port); + +/* + Remove the provided value from the cell @name in @cfg. + */ +gras_error_t gras_cfg_rm_int (gras_cfg_t *cfg, const char *name, + int val); +gras_error_t gras_cfg_rm_double(gras_cfg_t *cfg, const char *name, + double val); +gras_error_t gras_cfg_rm_string(gras_cfg_t *cfg, const char *name, + const char *val); +gras_error_t gras_cfg_rm_host (gras_cfg_t *cfg, const char *name, + const char *host,int port); + +/* rm every values */ +gras_error_t gras_cfg_empty(gras_cfg_t *cfg, const char *name); + +/*----[ Getting ]---------------------------------------------------------*/ +/* Returns a pointer to the values actually stored in the cache. Do not */ +/* modify them unless you really know what you're doing. */ +gras_error_t gras_cfg_get_int (gras_cfg_t *cfg, + const char *name, + int *val); +gras_error_t gras_cfg_get_double(gras_cfg_t *cfg, + const char *name, + double *val); +gras_error_t gras_cfg_get_string(gras_cfg_t *cfg, + const char *name, + char **val); +gras_error_t gras_cfg_get_host (gras_cfg_t *cfg, + const char *name, + char **host, + int *port); +gras_error_t gras_cfg_get_dynar (gras_cfg_t *cfg, + const char *name, + gras_dynar_t **dynar); + + +#endif /* _GRAS_CONFIG_H_ */ diff --git a/include/core.h b/include/core.h new file mode 100644 index 0000000000..f487dc1e34 --- /dev/null +++ b/include/core.h @@ -0,0 +1,121 @@ +/* $Id$ */ + +/* gras/core.h - Unsorted part of the GRAS public interface */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef GRAS_CORE_H +#define GRAS_CORE_H + +#include /* offsetof() */ +#include /* size_t */ +#include + + +/*! C++ users need love */ +#ifndef BEGIN_DECL +# ifdef __cplusplus +# define BEGIN_DECL extern "C" { +# else +# define BEGIN_DECL +# endif +#endif + +/*! C++ users need love */ +#ifndef END_DECL +# ifdef __cplusplus +# define END_DECL } +# else +# define END_DECL +# endif +#endif +/* End of cruft for C++ */ + +BEGIN_DECL + +/* ************************************************************************** + * Garbage collection support + * **************************************************************************/ +typedef enum { free_after_use, free_never } e_gras_free_directive_t; + +/* ************************************************************************** + * Initializing the processes + * **************************************************************************/ +/** + * gras_process_init: + * + * Perform the various intialisations needed by gras. Each process must run it + */ +gras_error_t gras_process_init(void); + +/** + * gras_process_finalize: + * + * Perform the various intialisations needed by gras. Each process must run it + */ +gras_error_t gras_process_finalize(void); + +/****************************************************************************/ +/* Manipulating User Data */ +/****************************************************************************/ +/** + * gras_userdata_get: + * + * Get the data associated with the current process. + */ +void *gras_userdata_get(void); + +/** + * gras_userdata_set: + * + * Set the data associated with the current process. + */ +void *gras_userdata_set(void *ud); + +/** + * gras_userdata_new: + * + * Malloc and set the data associated with the current process. + */ + +#define gras_userdata_new(type) gras_userdata_set(malloc(sizeof(type))) + +/* ************************************************************************** + * Wrappers over OS functions + * **************************************************************************/ + +/** + * gras_get_my_fqdn: + * + * Returns the fully-qualified name of the host machine, or NULL if the name + * cannot be determined. Always returns the same value, so multiple calls + * cause no problems. + */ +const char * +gras_get_my_fqdn(void); + +/** + * gras_time: + * + * Get the time in number of second since the Epoch. + * (00:00:00 UTC, January 1, 1970 in Real Life, and begining of simulation in SG) + */ +double gras_time(void); + +/** + * gras_sleep: + * @sec: number of seconds to sleep + * @usec: number of microseconds to sleep + * + * sleeps for the given amount of seconds plus the given amount of microseconds. + */ +void gras_sleep(unsigned long sec, unsigned long usec); + +END_DECL + +#endif /* GRAS_CORE_H */ + diff --git a/include/data_description.h b/include/data_description.h new file mode 100644 index 0000000000..949fac3a22 --- /dev/null +++ b/include/data_description.h @@ -0,0 +1,375 @@ +/* gs_interface.h */ +#ifndef GS_INTERFACE_H +#define GS_INTERFACE_H + +/* Mask internal structures to users */ +typedef struct s_gs_type_bag gras_type_bag_t; +typedef struct s_gs_connection gras_connection_t; +typedef struct s_gs_type gras_type_t; +typedef struct s_gs_message gras_message_t; +typedef struct s_gs_net_driver gras_net_driver_t; +typedef struct s_gs_message_instance gras_message_instance_t; +typedef struct s_gs_type_driver gras_type_driver_t; + + +/* public functions */ +void +gs_init(int argc, + char **argv); + +void +gs_purge_cmd_line(int *argc, + char **argv); + +void +gs_exit(void); + +/* -- */ + +gras_type_t * +gs_type_new_unsigned_integer_elemental(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + const char *name, + long int size); + +gras_type_t * +gs_type_new_signed_integer_elemental(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + const char *name, + long int size); + +gras_type_t * +gs_type_new_floating_point_elemental(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + const char *name, + long int size); + +gras_type_t * +gs_type_new_struct(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + const char *name); + +void +gs_type_struct_append_field(gras_type_t *p_struct_type, + const char *name, + gras_type_t *p_field_type); + +gras_type_t * +gs_type_new_union(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + const char *name, + + int (*field_callback)(void *vars, + gras_type_t *p_type, + void *data)); + +void +gs_type_union_append_field(gras_type_t *p_union_type, + const char *name, + gras_type_t *p_field_type); + +gras_type_t * +gs_type_new_ref(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + const char *name, + gras_type_t *p_referenced_type); + +gras_type_t * +gs_type_new_array(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + const char *name, + long int size, + gras_type_t *p_array_element_type); + +gras_type_t * +gs_type_new_ignored(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + const char *name, + long int size, + long int alignment, + void *default_value); + +/* -- */ + +gras_type_t * +gs_type_new_unsigned_integer_elemental_with_callback(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + const char *name, + long int size, + + void (*callback)(void *vars, + gras_type_t *p_type, + void *data)); + +gras_type_t * +gs_type_new_signed_integer_elemental_with_callback(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + const char *name, + long int size, + + void (*callback)(void *vars, + gras_type_t *p_type, + void *data)); + +gras_type_t * +gs_type_new_floating_point_elemental_with_callback(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + const char *name, + long int size, + + void (*callback)(void *vars, + gras_type_t *p_type, + void *data)); + +gras_type_t * +gs_type_new_struct_with_callback(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + const char *name, + + void (*before_callback)(void *vars, + gras_type_t *p_type, + void *data), + + void (*after_callback)(void *vars, + gras_type_t *p_type, + void *data)); + +void +gs_type_struct_append_field_with_callback(gras_type_t *p_struct_type, + const char *name, + gras_type_t *p_field_type, + + void (*before_callback)(void *vars, + gras_type_t *p_type, + void *data), + + void (*after_callback)(void *vars, + gras_type_t *p_type, + void *data)); + + +gras_type_t * +gs_type_new_union_with_callback(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + const char *name, + + int (*field_callback)(void *vars, + gras_type_t *p_type, + void *data), + + void (*after_callback)(void *vars, + gras_type_t *p_type, + void *data)); + +void +gs_type_union_append_field_with_callback(gras_type_t *p_union_type, + const char *name, + gras_type_t *p_field_type, + + void (*before_callback)(void *vars, + gras_type_t *p_type, + void *data), + + void (*after_callback)(void *vars, + gras_type_t *p_type, + void *data)); + +gras_type_t * +gs_type_new_ref_with_callback(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + const char *name, + gras_type_t *p_referenced_type, + + int (*type_callback)(void *vars, + gras_type_t *p_type, + void *data), + + void (*after_callback)(void *vars, + gras_type_t *p_type, + void *data)); + +gras_type_t * +gs_type_new_array_with_callback(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + const char *name, + long int size, + gras_type_t *p_array_element_type, + + long int (*size_callback)(void *vars, + gras_type_t *p_type, + void *data), + + void (*after_callback)(void *vars, + gras_type_t *p_type, + void *data)); + +gras_type_t * +gs_type_new_ignored_with_callback(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + const char *name, + long int size, + long int alignment, + void *default_value, + void (*callback)(void *vars, + gras_type_t *p_type, + void *data)); + +/* Automatic parsing of datatypes */ +gras_type_t * +_gs_type_parse(gras_type_bag_t *p_bag, + const char *definition); + +#define GRAS_DEFINE_TYPE(name,def) \ + static const char * _gs_this_type_symbol_does_not_exist__##name=#def; def + +#define gras_type_symbol_parse(bag,name) \ + _gs_type_parse(bag, _gs_this_type_symbol_does_not_exist__##name) + +#define gs_type_get_by_symbol(bag,name) \ + (bag->bag_ops->get_type_by_name(bag, NULL, #name) ? \ + bag->bag_ops->get_type_by_name(bag, NULL, #name) : \ + gras_type_symbol_parse(bag, name) \ + ) + +/* -- */ + +void +gs_bootstrap_incoming_connection(gras_type_bag_t *p_bag, + gras_connection_t *p_cnx); + +void +gs_bootstrap_type_bag(gras_type_bag_t *p_bag); + + +void +gs_bootstrap_outgoing_connection(gras_type_bag_t *p_bag, + gras_connection_t *p_cnx); + +/* -- */ + +gras_message_t * +gs_message_new(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + const char *name); + + +void +gs_message_append_new_sequence(gras_message_t *p_message, + gras_type_t *p_type); + +gras_message_instance_t * +gs_message_init_send_by_ref(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + gras_message_t *p_message); + +gras_message_instance_t * +gs_message_init_send_by_name(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + const char *name); + +gras_message_instance_t * +gs_message_init_send_by_code(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + int code); + + +void +gs_message_send_next_sequence_ext(void *vars, + gras_message_instance_t *p_message_instance, + void *data); + +void +gs_message_send_next_sequence(gras_message_instance_t *p_message_instance, + void *data); + +void * +gs_message_receive_next_sequence(gras_message_instance_t *p_message_instance); + +gras_message_instance_t * +gs_message_init_receive(gras_type_bag_t *p_bag, + gras_connection_t *p_cnx); + +/* -- */ + +void * +gs_vars_alloc(void); + +void +gs_vars_free(void *p_vars); + +void +gs_vars_enter(void *p_vars); + +void +gs_vars_leave(void *p_vars); + +void +gs_vars_push(void *p_vars, + gras_type_t *p_type, + const char *name, + void *data); + +void * +gs_vars_get(void *p_vars, + const char *name, + gras_type_t **pp_type); + +void +gs_vars_set(void *p_vars, + gras_type_t *p_type, + const char *name, + void *data); + +void * +gs_vars_pop(void *p_vars, + const char *name, + gras_type_t **pp_type); + +/* -- */ + +void +gs_net_drivers_init(void); + +gras_net_driver_t * +gs_net_driver_init(const char *name); + +void +gs_net_driver_exit(gras_net_driver_t *p_net_driver); + +gras_connection_t * +gs_net_connection_connect(gras_net_driver_t *p_net_driver, + void *arg); + +gras_connection_t * +gs_net_connection_accept(gras_net_driver_t *p_net_driver, + void *arg); + +void +gs_net_connection_close(gras_connection_t *p_connection); + +/* -- */ + +void +gs_type_drivers_init(void); + +gras_type_driver_t * +gs_type_driver_init(const char *name); + +void +gs_type_driver_exit(gras_type_driver_t *p_type_driver); + + +gras_type_bag_t * +gs_type_bag_alloc(gras_type_driver_t *p_driver); + +void +gs_type_bag_free(gras_type_bag_t *p_bag); + +/* -- */ + +void * +gs_memdup(const void * const ptr, + const size_t length); + + +#endif /* GS_INTERFACE_H */ diff --git a/include/datadesc.h b/include/datadesc.h new file mode 100644 index 0000000000..1948e24922 --- /dev/null +++ b/include/datadesc.h @@ -0,0 +1,83 @@ +/* $Id$ */ + +/* gras/datadesc.h - Describing the data you want to exchange */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef GRAS_DATADESC_H +#define GRAS_DATADESC_H + +#include /* offsetof() */ +#include /* size_t */ +#include + + +/*! C++ users need love */ +#ifndef BEGIN_DECL +# ifdef __cplusplus +# define BEGIN_DECL extern "C" { +# else +# define BEGIN_DECL +# endif +#endif + +/*! C++ users need love */ +#ifndef END_DECL +# ifdef __cplusplus +# define END_DECL } +# else +# define END_DECL +# endif +#endif +/* End of cruft for C++ */ + +BEGIN_DECL + +/** + * Basic types we can embeed in DataDescriptors. + */ +typedef enum + {CHAR_TYPE, DOUBLE_TYPE, FLOAT_TYPE, INT_TYPE, LONG_TYPE, SHORT_TYPE, + UNSIGNED_INT_TYPE, UNSIGNED_LONG_TYPE, UNSIGNED_SHORT_TYPE, STRUCT_TYPE} + DataTypes; +#define SIMPLE_TYPE_COUNT 9 + +/*! \brief Describe a collection of data. + * +** A description of a collection of #type# data. #repetitions# is used only +** for arrays; it contains the number of elements. #offset# is used only for +** struct members in host format; it contains the offset of the member from the +** beginning of the struct, taking into account internal padding added by the +** compiler for alignment purposes. #members#, #length#, and #tailPadding# are +** used only for STRUCT_TYPE data; the #length#-long array #members# describes +** the members of the nested struct, and #tailPadding# indicates how many +** padding bytes the compiler adds to the end of the structure. +*/ + +typedef struct DataDescriptorStruct { + DataTypes type; + size_t repetitions; + size_t offset; + /*@null@*/ struct DataDescriptorStruct *members; + size_t length; + size_t tailPadding; +} DataDescriptor; +/** DataDescriptor for an array */ +#define SIMPLE_DATA(type,repetitions) \ + {type, repetitions, 0, NULL, 0, 0} +/** DataDescriptor for an structure member */ +#define SIMPLE_MEMBER(type,repetitions,offset) \ + {type, repetitions, offset, NULL, 0, 0} +/** DataDescriptor for padding bytes */ +#define PAD_BYTES(structType,lastMember,memberType,repetitions) \ + sizeof(structType) - offsetof(structType, lastMember) - \ + sizeof(memberType) * repetitions + +END_DECL + +#endif /* GRAS_DATADESC_H */ + diff --git a/include/dd_type_bag.h b/include/dd_type_bag.h new file mode 100644 index 0000000000..c8d8772ffe --- /dev/null +++ b/include/dd_type_bag.h @@ -0,0 +1,97 @@ +/* gs_type_bag.h */ +#ifndef GS_TYPE_BAG_H +#define GS_TYPE_BAG_H + +/* used structs */ +struct s_gs_type_bag; +struct s_gs_type_driver; + +struct s_gs_type_bag_ops { + + void + (*_init) (struct s_gs_type_bag *p_type_bag); + + void + (*_exit) (struct s_gs_type_bag *p_type_bag); + + + void + (*register_incoming_connection) (struct s_gs_type_bag *p_type_bag, + struct s_gs_connection *p_connection); + + void + (*register_outgoing_connection) (struct s_gs_type_bag *p_type_bag, + struct s_gs_connection *p_connection); + + + void + (*store_type) (struct s_gs_type_bag *p_type_bag, + struct s_gs_connection *p_connection, + struct s_gs_type *p_type); + + void + (*store_incoming_type) (struct s_gs_type_bag *p_type_bag, + struct s_gs_connection *p_connection, + struct s_gs_type *p_type); + + struct s_gs_type * + (*get_type_by_name) (struct s_gs_type_bag *p_type_bag, + struct s_gs_connection *p_connection, + const char *name); + + struct s_gs_type * + (*get_type_by_code) (struct s_gs_type_bag *p_type_bag, + struct s_gs_connection *p_connection, + int code); + + void + (*mark_type) (struct s_gs_type_bag *p_type_bag, + struct s_gs_connection *p_connection, + const char *name); + + int + (*check_type_mark) (struct s_gs_type_bag *p_type_bag, + struct s_gs_connection *p_connection, + const char *name); + + + void + (*store_message) (struct s_gs_type_bag *p_type_bag, + struct s_gs_connection *p_connection, + struct s_gs_message *p_message); + + void + (*store_incoming_message) (struct s_gs_type_bag *p_type_bag, + struct s_gs_connection *p_connection, + struct s_gs_message *p_message); + + struct s_gs_message * + (*get_message_by_name) (struct s_gs_type_bag *p_type_bag, + struct s_gs_connection *p_connection, + const char *name); + + struct s_gs_message * + (*get_message_by_code) (struct s_gs_type_bag *p_type_bag, + struct s_gs_connection *p_connection, + int code); + + void + (*mark_message) (struct s_gs_type_bag *p_type_bag, + struct s_gs_connection *p_connection, + const char *name); + + int + (*check_message_mark) (struct s_gs_type_bag *p_type_bag, + struct s_gs_connection *p_connection, + const char *name); + +}; + +struct s_gs_type_bag { + struct s_gs_type_bag_ops *bag_ops; + struct s_gs_type_driver *p_type_driver; + void *specific; +}; + + +#endif /* GS_TYPE_BAG_H */ diff --git a/include/dict.h b/include/dict.h new file mode 100644 index 0000000000..fd4348786d --- /dev/null +++ b/include/dict.h @@ -0,0 +1,147 @@ +/* $Id$ */ + +/* gras/dict.h -- api to a generic dictionary */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + + +#ifndef _GRAS_DICT_H +#define _GRAS_DICT_H + +#ifdef __cplusplus +extern "C" +#endif + +/*####[ Type definition ]####################################################*/ +typedef struct gras_dict_ gras_dict_t; + +/*####[ Simple dict functions ]#############################################*/ + +gras_error_t gras_dict_new(gras_dict_t **dict); +void gras_dict_free(gras_dict_t **dict); + + +gras_error_t gras_dict_insert (gras_dict_t *head, + const char *key, + void *data, + void_f_pvoid_t *free_ctn); +gras_error_t gras_dict_insert_ext(gras_dict_t *head, + const char *key, + int key_len, + void *data, + void_f_pvoid_t *free_ctn); + +/*----[ gras_dict_retrieve ]-------------------------------------------------*/ +/* Search the given #key#. data=NULL when not found. */ +/* Returns true if anything went ok, and false on internal error. */ +/*---------------------------------------------------------------------------*/ +gras_error_t gras_dict_retrieve(gras_dict_t *head,const char *key, + /* OUT */void **data); +gras_error_t gras_dict_retrieve_ext(gras_dict_t *head,const char *key, + int key_len, + /* OUT */void **data); +/*----[ gras_dict_remove ]---------------------------------------------------*/ +/* Remove the entry associated with the given #key#. */ +/* Returns if ok. Removing a non-existant key is ok. */ +/*---------------------------------------------------------------------------*/ +gras_error_t gras_dict_remove(gras_dict_t *head,const char *key); + +gras_error_t gras_dict_remove_ext(gras_dict_t *head,const char *key, + int key_len); + +/*----[ gras_dict_dump ]-----------------------------------------------------*/ +/* Outputs the content of the structure. (for debuging purpose) */ +/* #output# is a function to output the data.If NULL, data won't be displayed*/ +/* Returns if it was ok or not */ +/*---------------------------------------------------------------------------*/ +gras_error_t gras_dict_dump(gras_dict_t *head, + void (*output)(void*)); +/*----[ gras_dict_print ]----------------------------------------------------*/ +/* To dump multicache, this function dump a cache */ +/*---------------------------------------------------------------------------*/ +void gras_dict_print(void *data); +/* To dump multicache, this one dumps a string */ +void gras_dict_prints(void *data); + + +/*####[ Multi cache functions ]##############################################*/ +/* The are cache of cache of data. Any function there works the same way */ +/* than their simple cache counterpart. */ +/*###############################"###########################################*/ + +/*----[ gras_multidict_free ]------------------------------------------------*/ +/* This function does not exist. Use gras_dict_free instead. */ +/*---------------------------------------------------------------------------*/ + +/*----[ gras_multidict_insert ]----------------------------------------------*/ +/* Insert the data in the structure under the #keycount# #key#s. */ +/* The key are destroyed in the process. Think to strdup it before. */ +/* Returns if it was ok or not */ +/*---------------------------------------------------------------------------*/ +gras_error_t gras_multidict_insert(gras_dict_t **head, + int keycount,char **key, + void *data,void (*free_ctn)(void*)); + +gras_error_t gras_multidict_insert_ext(gras_dict_t **head, + int keycount,char **key,int *key_len, + void *data,void_f_pvoid_t *free_ctn); + +/*----[ gras_multidict_retrieve ]--------------------------------------------*/ +/* Search the given #key#. data=NULL when not found. */ +/* Returns true if anything went ok, and false on internal error. */ +/*---------------------------------------------------------------------------*/ +gras_error_t gras_multidict_retrieve(gras_dict_t *head, + int keycount,const char **key, + /* OUT */void **data); + +gras_error_t gras_multidict_retrieve_ext(gras_dict_t *head, + int keycount,const char **key,int *key_len, + /* OUT */void **data); + +/*----[ gras_multidict_remove ]----------------------------------------------*/ +/* Remove the entry associated with the given #key#. */ +/* Returns if ok. Removing a non-existant key is ok. */ +/*---------------------------------------------------------------------------*/ +gras_error_t gras_multidict_remove(gras_dict_t *head, + int keycount,const char **key); + +gras_error_t gras_multidict_remove_ext(gras_dict_t *head, + int keycount,const char **key,int *key_len); + +/*####[ Cache cursor functions ]#############################################*/ +/* To traverse (simple) caches */ +/* Don't add or remove entries to the cache while traversing !!! */ +/*###########################################################################*/ +typedef struct gras_dict_cursor_ gras_dict_cursor_t; +/* creator/destructor */ +gras_error_t gras_dict_cursor_new(gras_dict_t *head, + /*OUT*/gras_dict_cursor_t **cursor); +void gras_dict_cursor_free(gras_dict_cursor_t *cursor); + +/* next element. Returns true if ok, and false on last entry */ +gras_error_t gras_dict_cursor_next(gras_dict_cursor_t *cursor); +/* back to first element + it is not enough to reinit the cache after an add/remove in cache*/ +gras_error_t gras_dict_cursor_rewind(gras_dict_cursor_t *cursor); + +/* Get current element. The key will be overwriten over calls */ +gras_error_t gras_dict_cursor_get_key(gras_dict_cursor_t *cursor, + /*OUT*/char **key); +gras_error_t gras_dict_cursor_get_data(gras_dict_cursor_t *cursor, + /*OUT*/void **data); + +#define gras_dict_foreach(dict,cursor) \ + for (cursor = NULL; \ + ( cursor || gras_dict_cursor_new((dict),&(cursor)) == no_error ) && \ + ( gras_dict_cursor_next(cursor) || (gras_dict_cursor_free(cursor), 0) ) ; \ + ) + +#ifdef __cplusplus +} +#endif + +#endif /* _GRAS_DICT_H */ diff --git a/include/dynar.h b/include/dynar.h new file mode 100644 index 0000000000..3d2829b06d --- /dev/null +++ b/include/dynar.h @@ -0,0 +1,81 @@ +/* $Id$ */ + +/* dynar - a generic dynamic array */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef _GRAS_DYNAR_H +#define _GRAS_DYNAR_H + +#include /* malloc() */ +#include /* strlen() */ + +typedef struct gras_dynar_s gras_dynar_t; + +/* pointer to a function freeing something */ +typedef void (void_f_ppvoid_t)(void**); +typedef void (void_f_pvoid_t) (void*); + +gras_error_t gras_dynar_new(gras_dynar_t **whereto, + size_t elm_size, + void_f_pvoid_t *free_func); +void gras_dynar_free(gras_dynar_t *dynar); +void gras_dynar_free_container(gras_dynar_t *dynar); + +size_t gras_dynar_length(const gras_dynar_t *dynar); +void gras_dynar_reset(gras_dynar_t *dynar); + + +/* regular array functions */ +void gras_dynar_get(const gras_dynar_t *dynar, + int idx, void *dst); +gras_error_t gras_dynar_set(gras_dynar_t *dynar, + int idx, const void *src); +gras_error_t gras_dynar_remplace(gras_dynar_t *dynar, + int idx, const void *object); + +/* perl array function */ +gras_error_t gras_dynar_insert_at(gras_dynar_t *dynar, + int idx, const void *src); +void gras_dynar_remove_at(gras_dynar_t *dynar, + int idx, void *object); +gras_error_t gras_dynar_push (gras_dynar_t *dynar, const void *src); +void gras_dynar_pop (gras_dynar_t *dynar, void *dst); +gras_error_t gras_dynar_unshift (gras_dynar_t *dynar, const void *src); +void gras_dynar_shift (gras_dynar_t *dynar, void *dst); +void gras_dynar_map(const gras_dynar_t *dynar, void_f_pvoid_t *operator); + +/* cursor functions */ +void _gras_dynar_first (const gras_dynar_t *dynar, int *cursor); +int _gras_dynar_next (const gras_dynar_t *dynar, + int *cursor, void *whereto); + +/** + * gras_dynar_foreach: + * @_dynar: what to iterate over + * @_cursor: an integer used as cursor + * @_data: + * + * Iterates over the whole dynar. Example: + * + * + * gras_dynar_t *dyn; + * int cpt; + * string *str; + * gras_dynar_foreach (dyn,cpt,str) { + * printf("Seen %s\n",str); + * } + */ +#define gras_dynar_foreach(_dynar,_cursor,_data) \ + for (_gras_dynar_first(_dynar,&_cursor); \ + _gras_dynar_next(_dynar,&_cursor,&_data); \ + ) + +void gras_dynar_cursor_rm(gras_dynar_t * dynar, + int * const cursor); + +#endif /* _GRAS_DYNAR_H */ diff --git a/include/error.h b/include/error.h new file mode 100644 index 0000000000..4a45d910df --- /dev/null +++ b/include/error.h @@ -0,0 +1,143 @@ +/* $Id$ */ + +/* gras/error.h - Error tracking support */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + + +#ifndef GRAS_ERROR_H +#define GRAS_ERROR_H + +#include /* offsetof() */ +#include /* size_t */ +#include +#include /* to print the backtrace */ + + +/* C++ users need love */ +#ifndef BEGIN_DECL +# ifdef __cplusplus +# define BEGIN_DECL extern "C" { +# else +# define BEGIN_DECL +# endif +#endif + +/*! C++ users need love */ +#ifndef END_DECL +# ifdef __cplusplus +# define END_DECL } +# else +# define END_DECL +# endif +#endif +/* End of cruft for C++ */ + +BEGIN_DECL + +typedef enum { + no_error=0, /* succes */ + malloc_error, /* Well known error */ + mismatch_error, /* The provided ID does not match */ + system_error, /* a syscall did fail */ + network_error, /* error while sending/receiving data */ + timeout_error, /* not quick enough, dude */ + thread_error, /* error while [un]locking */ + unknown_error +} gras_error_t; + +/*@observer@*/ const char *gras_error_name(gras_error_t errcode); + +#define TRY(a) if ((errcode=a) != no_error) return errcode +#define TRYCATCH(a,b) if ((errcode=a) != no_error && errcode !=b) return errcode +#define TRYFAIL(a) do { \ + if ((errcode=a) != no_error) { \ + fprintf(stderr,"Got '%s' error !\n", \ + gras_error_name(errcode)); \ + fflush(stdout); \ + abort(); \ + } } while(0) + +#define TRYEXPECT(action,expected_error) do { \ + errcode=action; \ + if (errcode != expected_error) { \ + fprintf(stderr,"Got error %s (instead of %s expected)\n", \ + gras_error_name(errcode), \ + gras_error_name(expected_error)); \ + abort(); \ + } \ +} while(0) + +/* FIXME TRYCLEAN should be avoided for readability */ +#define TRYCLEAN(action,cleanup) do { \ + if ((errcode=action) != no_error) { \ + cleanup; \ + return errcode; \ + } \ +} while(0) + +#define _GRAS_ERR_PRE do { \ + void *_gs_array[30]; \ + size_t _gs_size= backtrace (_gs_array, 30); \ + char **_gs_strings= backtrace_symbols (_gs_array, _gs_size); \ + size_t _gs_i; + +#define _GRAS_ERR_POST(code) \ + fprintf(stderr,"Backtrace follows\n"); \ + for (_gs_i = 0; _gs_i < _gs_size; _gs_i++) \ + fprintf (stderr," %s\n", _gs_strings[_gs_i]); \ + return code; \ +} while (0) + + +#define RAISE0(code,fmt) _GRAS_ERR_PRE \ + fprintf(stderr,"%s:%d:%s: " fmt "\n", \ + __FILE__,__LINE__,__FUNCTION__); \ + _GRAS_ERR_POST(code) +#define RAISE1(code,fmt,a1) _GRAS_ERR_PRE \ + fprintf(stderr,"%s:%d:%s: " fmt "\n", \ + __FILE__,__LINE__,__FUNCTION__,a1); \ + _GRAS_ERR_POST(code) +#define RAISE2(code,fmt,a1,a2) _GRAS_ERR_PRE \ + fprintf(stderr,"%s:%d:%s: " fmt "\n", \ + __FILE__,__LINE__,__FUNCTION__,a1,a2); \ + _GRAS_ERR_POST(code) +#define RAISE3(code,fmt,a1,a2,a3) _GRAS_ERR_PRE \ + fprintf(stderr,"%s:%d:%s: " fmt "\n", \ + __FILE__,__LINE__,__FUNCTION__,a1,a2,a3); \ + _GRAS_ERR_POST(code) +#define RAISE4(code,fmt,a1,a2,a3,a4) _GRAS_ERR_PRE \ + fprintf(stderr,"%s:%d:%s: " fmt "\n", \ + __FILE__,__LINE__,__FUNCTION__,a1,a2,a3,a4); \ + _GRAS_ERR_POST(code) +#define RAISE5(code,fmt,a1,a2,a3,a4,a5) _GRAS_ERR_PRE \ + fprintf(stderr,"%s:%d:%s: " fmt "\n", \ + __FILE__,__LINE__,__FUNCTION__,a1,a2,a3,a4,a5); \ + _GRAS_ERR_POST(code) +#define RAISE6(code,fmt,a1,a2,a3,a4,a5,a6) _GRAS_ERR_PRE \ + fprintf(stderr,"%s:%d:%s: " fmt "\n", \ + __FILE__,__LINE__,__FUNCTION__,a1,a2,a3,a4,a5,a6); \ + _GRAS_ERR_POST(code) + +#define RAISE_MALLOC RAISE0(malloc_error,"Malloc error") +#define RAISE_IMPOSSIBLE RAISE0(unknown_error,"The Impossible did happen") + +#define gras_abort abort + +#define gras_assert(cond) if (!(cond)) { CRITICAL1("Assertion %s failed", #cond); gras_abort(); } +#define gras_assert0(cond,msg) if (!(cond)) { CRITICAL0(msg); gras_abort(); } +#define gras_assert1(cond,msg,a) if (!(cond)) { CRITICAL1(msg,a); gras_abort(); } +#define gras_assert2(cond,msg,a,b) if (!(cond)) { CRITICAL2(msg,a,b); gras_abort(); } +#define gras_assert3(cond,msg,a,b,c) if (!(cond)) { CRITICAL3(msg,a,b,c); gras_abort(); } +#define gras_assert4(cond,msg,a,b,c,d) if (!(cond)) { CRITICAL4(msg,a,b,c,d); gras_abort(); } +#define gras_assert5(cond,msg,a,b,c,d,e) if (!(cond)) { CRITICAL5(msg,a,b,c,d,e); gras_abort(); } +#define gras_assert6(cond,msg,a,b,c,d,e,f) if (!(cond)) { CRITICAL6(msg,a,b,c,d,e,f); gras_abort(); } + +END_DECL + +#endif /* GRAS_ERROR_H */ + diff --git a/include/gras.h b/include/gras.h new file mode 100644 index 0000000000..dc093dba3b --- /dev/null +++ b/include/gras.h @@ -0,0 +1,51 @@ +/* $Id$ */ + +/* gras.h - Public interface to the GRAS */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef GRAS_H +#define GRAS_H + +/* Oli's macro */ +#ifndef GS_FAILURE_CONTEXT +# define GS_FAILURE_CONTEXT +#endif /* GS_FAILURE_CONTEXT */ + +#define GS_FAILURE(str) \ + (fprintf(stderr, "FAILURE: %s(%s:%d)" GS_FAILURE_CONTEXT "%s\n", __func__, __FILE__, __LINE__, (str)), \ + abort()) + +#define aligned(v, a) (((v) + (a - 1)) & ~(a - 1)) +#define max(a, b) (((a) > (b))?(a):(b)) +#define min(a, b) (((a) < (b))?(a):(b)) + +#define TRUE 1 +#define FALSE 0 + +/* end of Oli's cruft */ + +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include + +#endif /* GRAS_H */ diff --git a/include/log.h b/include/log.h new file mode 100644 index 0000000000..bcd6a0a8b8 --- /dev/null +++ b/include/log.h @@ -0,0 +1,525 @@ +/* $Id$ */ + +/* log - a generic logging facility in the spirit of log4j */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003, 2004 Martin Quinson. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +/* GRAS_LOG_MAYDAY: define this to replace the logging facilities with basic + printf function. Useful to debug the logging facilities themselves */ +#undef GRAS_LOG_MAYDAY +//#define GRAS_LOG_MAYDAY + + +#ifndef _GRAS_LOG_H_ +#define _GRAS_LOG_H_ + +#include + +/** + * gras_log_priority_t: + * @gras_log_priority_none: used internally (don't poke with) + * @gras_log_priority_debug: crufty output + * @gras_log_priority_verbose: verbose output for the user wanting more + * @gras_log_priority_info: output about the regular functionning + * @gras_log_priority_warning: minor issue encountered + * @gras_log_priority_error: issue encountered + * @gras_log_priority_critical: major issue encountered + * @gras_log_priority_infinite: value for GRAS_LOG_STATIC_THRESHOLD to not log + * @gras_log_priority_uninitialized: used internally (don't poke with) + * + * The different existing priorities. + */ +typedef enum { + gras_log_priority_none = 0, + gras_log_priority_debug = 1, + gras_log_priority_verbose = 2, + gras_log_priority_info = 3, + gras_log_priority_warning = 4, + gras_log_priority_error = 5, + gras_log_priority_critical = 6, + + gras_log_priority_infinite = 7, + + gras_log_priority_uninitialized = -1 +} gras_log_priority_t; + + +/** + * GRAS_LOG_STATIC_THRESHOLD: + * + * All logging with priority < GRAS_LOG_STATIC_THRESHOLD is disabled at + * compile time, i.e., compiled out. + */ +#ifndef GRAS_LOG_STATIC_THRESHOLD +# define GRAS_LOG_STATIC_THRESHOLD gras_log_priority_none +#endif + + +/* Transforms a category name to a global variable name. */ +#define _GRAS_LOGV(cat) _GRAS_LOG_CONCAT(_gras_this_log_category_does_not_exist__, cat) +#define _GRAS_LOG_CONCAT(x,y) x ## y + +/* The root of the category hierarchy. */ +#define GRAS_LOG_ROOT_CAT root + +/** + * GRAS_LOG_NEW_SUBCATEGORY: + * @catName: name of new category + * @parent: father of the new category in the tree + * + * Defines a new subcategory of the parent. + */ +#define GRAS_LOG_NEW_SUBCATEGORY(catName, parent) \ + extern gras_log_category_t _GRAS_LOGV(parent); \ + gras_log_category_t _GRAS_LOGV(catName) = { \ + &_GRAS_LOGV(parent), 0, 0, \ + #catName, gras_log_priority_uninitialized, 1, \ + 0, 1 \ + }; + +/** + * GRAS_LOG_NEW_CATEGORY: + * @catName: name of new category + * + * Creates a new subcategory of the root category. + */ +#define GRAS_LOG_NEW_CATEGORY(catName) GRAS_LOG_NEW_SUBCATEGORY(catName, GRAS_LOG_ROOT_CAT) + +/** + * GRAS_LOG_DEFAULT_CATEGORY: + * @cname: name of the cat + * + * Indicates which category is the default one. + */ + +#ifdef GRAS_LOG_MAYDAY /* debuging the logs themselves */ +# define GRAS_LOG_DEFAULT_CATEGORY(cname) +#else +# define GRAS_LOG_DEFAULT_CATEGORY(cname) \ + static gras_log_category_t* _GRAS_LOGV(default) = &_GRAS_LOGV(cname) +#endif + +/** + * GRAS_LOG_NEW_DEFAULT_CATEGORY: + * @cname: name of the cat + * + * Creates a new subcategory of the root category and makes it the default + * (used by macros that don't explicitly specify a category). + */ +#define GRAS_LOG_NEW_DEFAULT_CATEGORY(cname) \ + GRAS_LOG_NEW_CATEGORY(cname) \ + GRAS_LOG_DEFAULT_CATEGORY(cname) + +/** + * GRAS_LOG_NEW_DEFAULT_SUBCATEGORY: + * @cname: name of the cat + * @parent: name of the parent + * + * Creates a new subcategory of the parent category and makes it the default + * (used by macros that don't explicitly specify a category). + */ +#define GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(cname, parent) \ + GRAS_LOG_NEW_SUBCATEGORY(cname, parent) \ + GRAS_LOG_DEFAULT_CATEGORY(cname) + +/** + * GRAS_LOG_EXTERNAL_CATEGORY: + * @cname: name of the cat + * + * Indicates that a category you'll use in this file (to get subcategories of it, + * for example) really lives in another file. + */ + +#define GRAS_LOG_EXTERNAL_CATEGORY(cname) \ + extern gras_log_category_t _GRAS_LOGV(cname) + +// Functions you may call + +extern gras_error_t gras_log_control_set(const char* cs); + +// Forward declarations +typedef struct gras_log_appender_s gras_log_appender_t; +typedef struct gras_log_event_s gras_log_event_t; +typedef struct gras_log_category_s gras_log_category_t; + +/** + * Do NOT access any members of this structure directly. + */ +struct gras_log_category_s { + gras_log_category_t *parent; + gras_log_category_t *firstChild, *nextSibling; + const char *name; + int threshold; + int isThreshInherited; + gras_log_appender_t *appender; + int willLogToParent; + // TODO: Formats? +}; + +struct gras_log_appender_s { + void (*do_append) (gras_log_appender_t* thisLogAppender, + gras_log_event_t* event); + void *appender_data; +}; + +struct gras_log_event_s { + gras_log_category_t* cat; + gras_log_priority_t priority; + const char* fileName; + const char* functionName; + int lineNum; + const char* fmt; + va_list ap; +}; + +/** + * gras_log_threshold_set: + * @cat: the category (not only its name, but the variable) + * @thresholdPriority: the priority + * + * Programatically alters a category's threshold priority (don't use). + */ +extern void gras_log_threshold_set(gras_log_category_t* cat, + gras_log_priority_t thresholdPriority); + +/** + * gras_log_parent_set: + * @cat: the category (not only its name, but the variable) + * @parent: the parent cat + * + * Programatically alter a category's parent (don't use). + */ +extern void gras_log_parent_set(gras_log_category_t* cat, + gras_log_category_t* parent); + +/** + * gras_log_appender_set: + * @cat: the category (not only its name, but the variable) + * @app: the appender + * + * Programatically sets the category's appender (don't use). + */ +extern void gras_log_appender_set(gras_log_category_t* cat, + gras_log_appender_t* app); + +// Functions that you shouldn't call. +extern void _gras_log_event_log(gras_log_event_t*ev, + ...); +extern int _gras_log_cat_init(gras_log_priority_t priority, + gras_log_category_t* category); + + +extern gras_log_category_t _GRAS_LOGV(GRAS_LOG_ROOT_CAT); +GRAS_LOG_EXTERNAL_CATEGORY(GRAS); +extern gras_log_appender_t *gras_log_default_appender; + +/** + * GRAS_LOG_ISENABLED: + * @catName: name of the category + * @priority: minimal priority to be enabled to return true + * + * Returns true if the given priority is enabled for the category. + * If you have expensive expressions that are computed outside of the log + * command and used only within it, you should make its evaluation conditional + * using this macro. + */ +#define GRAS_LOG_ISENABLED(catName, priority) \ + _GRAS_LOG_ISENABLEDV(_GRAS_LOGV(catName), priority) + +/* + * Helper function that implements GRAS_LOG_ISENABLED. + * + * NOTES + * First part is a compile-time constant. + * Call to _log_initCat only happens once. + */ +#define _GRAS_LOG_ISENABLEDV(catv, priority) \ + (priority >= GRAS_LOG_STATIC_THRESHOLD \ + && priority >= catv.threshold \ + && (catv.threshold != gras_log_priority_uninitialized \ + || _gras_log_cat_init(priority, &catv)) ) + +/* + * Internal Macros + * Some kludge macros to ease maintenance. See how they're used below. + * + * IMPLEMENTATION NOTE: To reduce the parameter passing overhead of an enabled + * message, the many parameters passed to the logging function are packed in a + * structure. Since these values will be usually be passed to at least 3 + * functions, this is a win. + * It also allows adding new values (such as a timestamp) without breaking + * code. + * Setting the LogEvent's valist member is done inside _log_logEvent. + */ + +#define _GRAS_LOG_PRE(catv, priority, fmt) do { \ + if (_GRAS_LOG_ISENABLEDV(catv, priority)) { \ + gras_log_event_t _log_ev = \ + {&(catv),priority,__FILE__,__FUNCTION__,__LINE__,fmt}; \ + _gras_log_event_log(&_log_ev +#define _GRAS_LOG_POST \ + ); \ + } } while(0) + + +/* Logging Macros */ + +#ifdef GRAS_LOG_MAYDAY +# define CLOG0(c, p, f) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__) +# define CLOG1(c, p, f,a1) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1) +# define CLOG2(c, p, f,a1,a2) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2) +# define CLOG3(c, p, f,a1,a2,a3) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3) +# define CLOG4(c, p, f,a1,a2,a3,a4) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4) +# define CLOG5(c, p, f,a1,a2,a3,a4,a5) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5) +# define CLOG6(c, p, f,a1,a2,a3,a4,a5,a6) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6) +#else +# define CLOG0(c, p, f) _GRAS_LOG_PRE(_GRAS_LOGV(c),p,f) _GRAS_LOG_POST +# define CLOG1(c, p, f,a1) _GRAS_LOG_PRE(_GRAS_LOGV(c),p,f) ,a1 _GRAS_LOG_POST +# define CLOG2(c, p, f,a1,a2) _GRAS_LOG_PRE(_GRAS_LOGV(c),p,f) ,a1,a2 _GRAS_LOG_POST +# define CLOG3(c, p, f,a1,a2,a3) _GRAS_LOG_PRE(_GRAS_LOGV(c),p,f) ,a1,a2,a3 _GRAS_LOG_POST +# define CLOG4(c, p, f,a1,a2,a3,a4) _GRAS_LOG_PRE(_GRAS_LOGV(c),p,f) ,a1,a2,a3,a4 _GRAS_LOG_POST +# define CLOG5(c, p, f,a1,a2,a3,a4,a5) _GRAS_LOG_PRE(_GRAS_LOGV(c),p,f) ,a1,a2,a3,a4,a5 _GRAS_LOG_POST +# define CLOG6(c, p, f,a1,a2,a3,a4,a5,a6) _GRAS_LOG_PRE(_GRAS_LOGV(c),p,f) ,a1,a2,a3,a4,a5,a6 _GRAS_LOG_POST +#endif + +#define CDEBUG0(c, f) CLOG0(c, gras_log_priority_debug, f) +#define CDEBUG1(c, f,a1) CLOG1(c, gras_log_priority_debug, f,a1) +#define CDEBUG2(c, f,a1,a2) CLOG2(c, gras_log_priority_debug, f,a1,a2) +#define CDEBUG3(c, f,a1,a2,a3) CLOG3(c, gras_log_priority_debug, f,a1,a2,a3) +#define CDEBUG4(c, f,a1,a2,a3,a4) CLOG4(c, gras_log_priority_debug, f,a1,a2,a3,a4) +#define CDEBUG5(c, f,a1,a2,a3,a4,a5) CLOG5(c, gras_log_priority_debug, f,a1,a2,a3,a4,a5) +#define CDEBUG6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_debug, f,a1,a2,a3,a4,a5,a6) + +#define CVERB0(c, f) CLOG0(c, gras_log_priority_verbose, f) +#define CVERB1(c, f,a1) CLOG1(c, gras_log_priority_verbose, f,a1) +#define CVERB2(c, f,a1,a2) CLOG2(c, gras_log_priority_verbose, f,a1,a2) +#define CVERB3(c, f,a1,a2,a3) CLOG3(c, gras_log_priority_verbose, f,a1,a2,a3) +#define CVERB4(c, f,a1,a2,a3,a4) CLOG4(c, gras_log_priority_verbose, f,a1,a2,a3,a4) +#define CVERB5(c, f,a1,a2,a3,a4,a5) CLOG5(c, gras_log_priority_verbose, f,a1,a2,a3,a4,a5) +#define CVERB6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_verbose, f,a1,a2,a3,a4,a5,a6) + +#define CINFO0(c, f) CLOG0(c, gras_log_priority_info, f) +#define CINFO1(c, f,a1) CLOG1(c, gras_log_priority_info, f,a1) +#define CINFO2(c, f,a1,a2) CLOG2(c, gras_log_priority_info, f,a1,a2) +#define CINFO3(c, f,a1,a2,a3) CLOG3(c, gras_log_priority_info, f,a1,a2,a3) +#define CINFO4(c, f,a1,a2,a3,a4) CLOG4(c, gras_log_priority_info, f,a1,a2,a3,a4) +#define CINFO5(c, f,a1,a2,a3,a4,a5) CLOG5(c, gras_log_priority_info, f,a1,a2,a3,a4,a5) +#define CINFO6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_info, f,a1,a2,a3,a4,a5,a6) + +#define CWARNING0(c, f) CLOG0(c, gras_log_priority_warning, f) +#define CWARNING1(c, f,a1) CLOG1(c, gras_log_priority_warning, f,a1) +#define CWARNING2(c, f,a1,a2) CLOG2(c, gras_log_priority_warning, f,a1,a2) +#define CWARNING3(c, f,a1,a2,a3) CLOG3(c, gras_log_priority_warning, f,a1,a2,a3) +#define CWARNING4(c, f,a1,a2,a3,a4) CLOG4(c, gras_log_priority_warning, f,a1,a2,a3,a4) +#define CWARNING5(c, f,a1,a2,a3,a4,a5) CLOG5(c, gras_log_priority_warning, f,a1,a2,a3,a4,a5) +#define CWARNING6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_warning, f,a1,a2,a3,a4,a5,a6) + +#define CERROR0(c, f) CLOG0(c, gras_log_priority_error, f) +#define CERROR1(c, f,a1) CLOG1(c, gras_log_priority_error, f,a1) +#define CERROR2(c, f,a1,a2) CLOG2(c, gras_log_priority_error, f,a1,a2) +#define CERROR3(c, f,a1,a2,a3) CLOG3(c, gras_log_priority_error, f,a1,a2,a3) +#define CERROR4(c, f,a1,a2,a3,a4) CLOG4(c, gras_log_priority_error, f,a1,a2,a3,a4) +#define CERROR5(c, f,a1,a2,a3,a4,a5) CLOG5(c, gras_log_priority_error, f,a1,a2,a3,a4,a5) +#define CERROR6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_error, f,a1,a2,a3,a4,a5,a6) + +/** + * CCRITICAL6: + * @c: the category to log into + * @f: the format string + * @a1: first argument of the format + * @a2: second argument of the format + * @a3: third argument of the format + * @a4: fourth argument of the format + * @a5: fifth argument of the format + * @a6: sixth argument of the format + * + * Log something to the current default category under the warning priority. + * + * The macros CCRITICAL0 ... CCRITICAL5 naturally also exist, but are not listed here + * for sake of clarity. They just differ in the number of arguments passed + * along with the format string. + */ + +#define CCRITICAL0(c, f) CLOG0(c, gras_log_priority_critical, f) +#define CCRITICAL1(c, f,a1) CLOG1(c, gras_log_priority_critical, f,a1) +#define CCRITICAL2(c, f,a1,a2) CLOG2(c, gras_log_priority_critical, f,a1,a2) +#define CCRITICAL3(c, f,a1,a2,a3) CLOG3(c, gras_log_priority_critical, f,a1,a2,a3) +#define CCRITICAL4(c, f,a1,a2,a3,a4) CLOG4(c, gras_log_priority_critical, f,a1,a2,a3,a4) +#define CCRITICAL5(c, f,a1,a2,a3,a4,a5) CLOG5(c, gras_log_priority_critical, f,a1,a2,a3,a4,a5) +#define CCRITICAL6(c, f,a1,a2,a3,a4,a5,a6) CLOG6(c, gras_log_priority_critical, f,a1,a2,a3,a4,a5,a6) + +#ifdef GRAS_LOG_MAYDAY +# define LOG0(p, f) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__) +# define LOG1(p, f,a1) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1) +# define LOG2(p, f,a1,a2) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2) +# define LOG3(p, f,a1,a2,a3) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3) +# define LOG4(p, f,a1,a2,a3,a4) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4) +# define LOG5(p, f,a1,a2,a3,a4,a5) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5) +# define LOG6(p, f,a1,a2,a3,a4,a5,a6) fprintf(stderr,"%s:%d:" f "\n",__FILE__,__LINE__,a1,a2,a3,a4,a5,a6) +#else +# define LOG0(p, f) _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p,f) _GRAS_LOG_POST +# define LOG1(p, f,a1) _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p,f) ,a1 _GRAS_LOG_POST +# define LOG2(p, f,a1,a2) _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p,f) ,a1,a2 _GRAS_LOG_POST +# define LOG3(p, f,a1,a2,a3) _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p,f) ,a1,a2,a3 _GRAS_LOG_POST +# define LOG4(p, f,a1,a2,a3,a4) _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p,f) ,a1,a2,a3,a4 _GRAS_LOG_POST +# define LOG5(p, f,a1,a2,a3,a4,a5) _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p,f) ,a1,a2,a3,a4,a5 _GRAS_LOG_POST +# define LOG6(p, f,a1,a2,a3,a4,a5,a6) _GRAS_LOG_PRE((*_GRAS_LOGV(default)),p,f) ,a1,a2,a3,a4,a5,a6 _GRAS_LOG_POST +#endif + +/** + * DEBUG6: + * @f: the format string + * @a1: first argument of the format + * @a2: second argument of the format + * @a3: third argument of the format + * @a4: fourth argument of the format + * @a5: fifth argument of the format + * @a6: sixth argument of the format + * + * Log something to the current default category under the debug priority. + * + * The macros DEBUG0 ... DEBUG5 naturally also exist, but are not listed here + * for sake of clarity. They just differ in the number of arguments passed + * along with the format string. + */ + +#define DEBUG0(f) LOG0(gras_log_priority_debug, f) +#define DEBUG1(f,a1) LOG1(gras_log_priority_debug, f,a1) +#define DEBUG2(f,a1,a2) LOG2(gras_log_priority_debug, f,a1,a2) +#define DEBUG3(f,a1,a2,a3) LOG3(gras_log_priority_debug, f,a1,a2,a3) +#define DEBUG4(f,a1,a2,a3,a4) LOG4(gras_log_priority_debug, f,a1,a2,a3,a4) +#define DEBUG5(f,a1,a2,a3,a4,a5) LOG5(gras_log_priority_debug, f,a1,a2,a3,a4,a5) +#define DEBUG6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_debug, f,a1,a2,a3,a4,a5,a6) + +/** + * VERB6: + * @f: the format string + * @a1: first argument of the format + * @a2: second argument of the format + * @a3: third argument of the format + * @a4: fourth argument of the format + * @a5: fifth argument of the format + * @a6: sixth argument of the format + * + * Log something to the current default category under the verbose priority. + * + * The macros VERB0 ... VERB5 naturally also exist, but are not listed here + * for sake of clarity. They just differ in the number of arguments passed + * along with the format string. + */ + +#define VERB0(f) LOG0(gras_log_priority_verbose, f) +#define VERB1(f,a1) LOG1(gras_log_priority_verbose, f,a1) +#define VERB2(f,a1,a2) LOG2(gras_log_priority_verbose, f,a1,a2) +#define VERB3(f,a1,a2,a3) LOG3(gras_log_priority_verbose, f,a1,a2,a3) +#define VERB4(f,a1,a2,a3,a4) LOG4(gras_log_priority_verbose, f,a1,a2,a3,a4) +#define VERB5(f,a1,a2,a3,a4,a5) LOG5(gras_log_priority_verbose, f,a1,a2,a3,a4,a5) +#define VERB6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_verbose, f,a1,a2,a3,a4,a5,a6) + +/** + * INFO6: + * @f: the format string + * @a1: first argument of the format + * @a2: second argument of the format + * @a3: third argument of the format + * @a4: fourth argument of the format + * @a5: fifth argument of the format + * @a6: sixth argument of the format + * + * Log something to the current default category under the info priority. + * + * The macros INFO0 ... INFO5 naturally also exist, but are not listed here + * for sake of clarity. They just differ in the number of arguments passed + * along with the format string. + */ + +#define INFO0(f) LOG0(gras_log_priority_info, f) +#define INFO1(f,a1) LOG1(gras_log_priority_info, f,a1) +#define INFO2(f,a1,a2) LOG2(gras_log_priority_info, f,a1,a2) +#define INFO3(f,a1,a2,a3) LOG3(gras_log_priority_info, f,a1,a2,a3) +#define INFO4(f,a1,a2,a3,a4) LOG4(gras_log_priority_info, f,a1,a2,a3,a4) +#define INFO5(f,a1,a2,a3,a4,a5) LOG5(gras_log_priority_info, f,a1,a2,a3,a4,a5) +#define INFO6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_info, f,a1,a2,a3,a4,a5,a6) + +/** + * WARNING6: + * @f: the format string + * @a1: first argument of the format + * @a2: second argument of the format + * @a3: third argument of the format + * @a4: fourth argument of the format + * @a5: fifth argument of the format + * @a6: sixth argument of the format + * + * Log something to the current default category under the warning priority. + * + * The macros WARNING0 ... WARNING5 naturally also exist, but are not listed here + * for sake of clarity. They just differ in the number of arguments passed + * along with the format string. + */ + +#define WARNING0(f) LOG0(gras_log_priority_warning, f) +#define WARNING1(f,a1) LOG1(gras_log_priority_warning, f,a1) +#define WARNING2(f,a1,a2) LOG2(gras_log_priority_warning, f,a1,a2) +#define WARNING3(f,a1,a2,a3) LOG3(gras_log_priority_warning, f,a1,a2,a3) +#define WARNING4(f,a1,a2,a3,a4) LOG4(gras_log_priority_warning, f,a1,a2,a3,a4) +#define WARNING5(f,a1,a2,a3,a4,a5) LOG5(gras_log_priority_warning, f,a1,a2,a3,a4,a5) +#define WARNING6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_warning, f,a1,a2,a3,a4,a5,a6) + +/** + * ERROR6: + * @f: the format string + * @a1: first argument of the format + * @a2: second argument of the format + * @a3: third argument of the format + * @a4: fourth argument of the format + * @a5: fifth argument of the format + * @a6: sixth argument of the format + * + * Log something to the current default category under the error priority. + * + * The macros ERROR0 ... ERROR5 naturally also exist, but are not listed here + * for sake of clarity. They just differ in the number of arguments passed + * along with the format string. + */ + +#define ERROR0(f) LOG0(gras_log_priority_error, f) +#define ERROR1(f,a1) LOG1(gras_log_priority_error, f,a1) +#define ERROR2(f,a1,a2) LOG2(gras_log_priority_error, f,a1,a2) +#define ERROR3(f,a1,a2,a3) LOG3(gras_log_priority_error, f,a1,a2,a3) +#define ERROR4(f,a1,a2,a3,a4) LOG4(gras_log_priority_error, f,a1,a2,a3,a4) +#define ERROR5(f,a1,a2,a3,a4,a5) LOG5(gras_log_priority_error, f,a1,a2,a3,a4,a5) +#define ERROR6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_error, f,a1,a2,a3,a4,a5,a6) + +/** + * CRITICAL6: + * @f: the format string + * @a1: first argument of the format + * @a2: second argument of the format + * @a3: third argument of the format + * @a4: fourth argument of the format + * @a5: fifth argument of the format + * @a6: sixth argument of the format + * + * Log something to the current default category under the critical priority. + * + * The macros CRITICAL0 ... CRITICAL5 naturally also exist, but are not listed here + * for sake of clarity. They just differ in the number of arguments passed + * along with the format string. + */ +#define CRITICAL0(f) LOG0(gras_log_priority_critical, f) +#define CRITICAL1(f,a1) LOG1(gras_log_priority_critical, f,a1) +#define CRITICAL2(f,a1,a2) LOG2(gras_log_priority_critical, f,a1,a2) +#define CRITICAL3(f,a1,a2,a3) LOG3(gras_log_priority_critical, f,a1,a2,a3) +#define CRITICAL4(f,a1,a2,a3,a4) LOG4(gras_log_priority_critical, f,a1,a2,a3,a4) +#define CRITICAL5(f,a1,a2,a3,a4,a5) LOG5(gras_log_priority_critical, f,a1,a2,a3,a4,a5) +#define CRITICAL6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_critical, f,a1,a2,a3,a4,a5,a6) + +#define GRAS_IN DEBUG0(">> begin of function") +#define GRAS_OUT DEBUG0("<< end of function") + +#endif /* ! _GRAS_LOG_H_ */ diff --git a/include/messages.h b/include/messages.h new file mode 100644 index 0000000000..e9d1aa6b34 --- /dev/null +++ b/include/messages.h @@ -0,0 +1,238 @@ +/* $Id$ */ + +/* gras/messages.h - Public interface to GRAS messages */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + + +#ifndef GRAS_MSG_H +#define GRAS_MSG_H + +#include /* offsetof() */ +#include /* size_t */ +#include + + +/*! C++ users need love */ +#ifndef BEGIN_DECL +# ifdef __cplusplus +# define BEGIN_DECL extern "C" { +# else +# define BEGIN_DECL +# endif +#endif + +/*! C++ users need love */ +#ifndef END_DECL +# ifdef __cplusplus +# define END_DECL } +# else +# define END_DECL +# endif +#endif +/* End of cruft for C++ */ + +BEGIN_DECL + +typedef unsigned int gras_msgid_t; +typedef struct gras_msgheader_s gras_msgheader_t; +typedef struct gras_msgentry_s gras_msgentry_t; + +/** + * A message sent or received to/from the network + * + * Do not mess with the content of this structure. Only access it through the following functions: + * @gras_msg_new() or @gras_msg_copy() to create such struct. + * @gras_msg_free() to get ride of it. + * @gras_msg_ctn() to read its content. + * + */ +typedef struct { + /* public */ + gras_sock_t *sock; /** the socket on which the message was received (to answer) */ + + /* private */ + gras_msgheader_t *header; + gras_msgentry_t *entry; + unsigned int *dataCount; + void **data; + e_gras_free_directive_t freeDirective; +} gras_msg_t; + +/** + * gras_msgtype_register: + * @msgId: identificator of such messages + * @name: name as it should be used for logging messages + * @sequence_count: number of groups in variadics + * @Varargs: List of (const DataDescriptor *, int DDcount), describing the + * elements in each sequence (DDlength is the length of the corresponding + * DataDescriptor). + * @Returns: the error code (or no_error). + * + * Registers a message to the GRAS mecanism. + */ +gras_error_t +gras_msgtype_register(gras_msgid_t msgId, + const char *name, + int sequence_count, + ...); + +/** + * gras_msg_new_and_send: + * @sd: Socket on which the message should be sent + * @msgId: identificator this messages + * @Varargs: List of (void **data, int seqLen) forming the payload of the message. + * The number of sequences is given by the registration of ht + * @Returns: the error code (or no_error). + * + * Create a new message, and send it on the network through the given socket. + */ +gras_error_t +gras_msg_new_and_send(gras_sock_t *sd, + gras_msgid_t msgId, + int seqCount, + ...); + + +/** + * gras_msg_new: + * @msgId: identificator this messages + * @free_data_on_free: boolean indicating wheater the data must be freed when the msg get freed. + * @seqCount: number of sequences in this message (must be the same than the value + * registered using gras_msgtype_register() for that msgId) + * @Varargs: List of (void **data, int seqLen) forming the payload of the message. + * The number of sequences is given by the registration of ht + * @Returns: the message built or NULL on error + * + * Build a message to be sent + */ + +gras_msg_t *gras_msg_new(gras_msgid_t msgId, + e_gras_free_directive_t free_data_on_free, + int seqCount, + ...); + +/** + * gras_msg_new_va: + * + * Build a new message in the exact same way than gras_msg_new(), but taking its arguments as + * variadic ones. + */ +gras_msg_t *gras_msg_new_va(gras_msgid_t msgId, + e_gras_free_directive_t free_data, + int seqCount, + va_list ap); + +/** + * gras_msg_copy: + * @msg: original to copy. + * + * Copy a message. + */ + +gras_msg_t *gras_msg_copy(gras_msg_t *msg); + +/** + * gras_msg_free: + * @msg: poor guy going to diediedie. + * + * Free a msg built with gras_msg_new(). + */ +void gras_msg_free(gras_msg_t *msg); + +/** + * gras_msg_ctn: + * @msg: the carrier of the data + * @sequence: Sequence in which you want to see the data. + * @num: Number in this sequence of the element to access. + * @type: type of the element to access. + * + * Access to the content of a message. + */ +#define gras_msg_ctn(msg,sequence,num,type) \ + ((type *)msg->data[sequence])[num] + +/** + * gras_cb_t: + * @msg: The message itself + * @Returns: true if the message was accepted by the callback and false if it should be passed to the next one. + * + * Type of message callback functions. Once a such a function is registered to + * handle messages of a given type with RegisterCallback(), it will be called + * each time such a message incomes. + * + * If the callback accepts the message, it should free it after use. + */ + +typedef int (*gras_cb_t)(gras_msg_t *msg); + +/** + * gras_cb_register: + * @message: id of the concerned messages + * @TTL: How many time should this callback be used + * @cb: The callback. + * @Returns: the error code (or no_error). + * + * Indicates a desire that the function #cb# be called whenever a + * #message# message comes in. + * #TTL# is how many time this callback should be used. After that, this + * callback will be unregistred. If <0, the callback will never be unregistered. + * (ie, it will be permanent) + */ +gras_error_t +gras_cb_register(gras_msgid_t message, + int TTL, + gras_cb_t cb); + +/** + * gras_msg_handle: + * @timeOut: How long to wait for incoming messages + * @Returns: the error code (or no_error). + * + * Waits up to #timeOut# seconds to see if a message comes in; if so, calls the + * registered listener for that message (see RegisterCallback()). + */ +gras_error_t gras_msg_handle(double timeOut); + + +/** + * gras_msg_send: + * @sd: Socket to write on + * @msg: to send (build it with @gras_msg_new()) + * @freeDirective: if the msg passed as argument should be gras_msg_free'ed after sending. + * @Returns: the error code (or no_error). + * + * Sends the message on the socket sd using an automatic and adaptative timeout. + */ + +gras_error_t +gras_msg_send(gras_sock_t *sd, + gras_msg_t *msg, + e_gras_free_directive_t freeDirective); + +/** + * gras_msg_wait: + * @timeout: How long should we wait for this message. + * @id: id of awaited msg + * @message: where to store the message when it comes. + * @Returns: the error code (or no_error). + * + * Waits for a message to come in over a given socket. + * + * Every message of another type received before the one waited will be queued + * and used by subsequent call to this function or MsgHandle(). + */ +gras_error_t +gras_msg_wait(double timeout, + gras_msgid_t id, + gras_msg_t **message); + + +END_DECL + +#endif /* GRAS_MSG_H */ + diff --git a/include/modules/bandwidth.h b/include/modules/bandwidth.h new file mode 100644 index 0000000000..179e89a861 --- /dev/null +++ b/include/modules/bandwidth.h @@ -0,0 +1,135 @@ +/* $Id$ */ + +/* gras_bandwidth - GRAS mecanism to do Bandwidth tests between to hosts */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef GRAS_BANDWIDTH_H +#define GRAS_BANDWIDTH_H + +#include + +/* **************************************************************************** + * The messages themselves + * ****************************************************************************/ + +#ifndef GRAS_BANDWIDTH_FIRST_MESSAGE +#define GRAS_BANDWIDTH_FIRST_MESSAGE 0 +#endif + +#define GRASMSG_BW_REQUEST GRAS_BANDWIDTH_FIRST_MESSAGE +#define GRASMSG_BW_RESULT GRAS_BANDWIDTH_FIRST_MESSAGE+1 +#define GRASMSG_BW_HANDSHAKE GRAS_BANDWIDTH_FIRST_MESSAGE+2 +#define GRASMSG_BW_HANDSHAKED GRAS_BANDWIDTH_FIRST_MESSAGE+3 + +#define GRASMSG_SAT_START GRAS_BANDWIDTH_FIRST_MESSAGE+4 +#define GRASMSG_SAT_STARTED GRAS_BANDWIDTH_FIRST_MESSAGE+5 +#define GRASMSG_SAT_STOP GRAS_BANDWIDTH_FIRST_MESSAGE+6 +#define GRASMSG_SAT_STOPPED GRAS_BANDWIDTH_FIRST_MESSAGE+7 + +#define GRASMSG_SAT_BEGIN GRAS_BANDWIDTH_FIRST_MESSAGE+8 +#define GRASMSG_SAT_BEGUN GRAS_BANDWIDTH_FIRST_MESSAGE+9 +#define GRASMSG_SAT_END GRAS_BANDWIDTH_FIRST_MESSAGE+10 +#define GRASMSG_SAT_ENDED GRAS_BANDWIDTH_FIRST_MESSAGE+11 + +/* **************************************************************************** + * The functions to triger those messages + * ****************************************************************************/ + +/** + * grasbw_register_messages: + * + * Register all messages and callbacks needed for the current process to be ready + * to do BW tests + */ +gras_error_t grasbw_register_messages(void); + +/* *************************************************************************** + * Bandwidth tests + * ***************************************************************************/ +/** + * grasbw_test: + * @to_name: Name of the host with which we should conduct the experiment + * @to_port: port on which the peer process is listening (for message, do not + * give a raw socket here. The needed raw socket will be negociated between + * the peers) + * @bufSize: Size of the socket buffer + * @expSize: Total size of data sent across the network + * @msgSize: Size of each message sent. Ie, (@expSize % @msgSize) messages will be sent. + * @sec: where the result (in seconds) should be stored. + * @bw: observed Bandwidth (in Mb/s) + * + * Conduct a bandwidth test from the local process to the given peer. + * This call is blocking until the end of the experiment. + */ +gras_error_t grasbw_test(const char*to_name,unsigned int to_port, + unsigned int bufSize,unsigned int expSize,unsigned int msgSize, + /*OUT*/ double *sec, double*bw); + +/** + * grasbw_request: + * @from_name: Name of the host we are asking to do a experiment with (to_name:to_port) + * @from_port: port on which the process we are asking for an experiment is listening for message + * @to_name: Name of the host with which we should conduct the experiment + * @to_port: port on which the peer process is listening (for message, do not + * give a raw socket here. The needed raw socket will be negociated between + * the peers) + * @bufSize: Size of the socket buffer + * @expSize: Total size of data sent across the network + * @msgSize: Size of each message sent. Ie, (@expSize % @msgSize) messages will be sent. + * @sec: where the result (in seconds) should be stored. + * @bw: observed Bandwidth (in Mb/s) + * + * Conduct a bandwidth test from the process from_host:from_port to to_host:to_port. + * This call is blocking until the end of the experiment. + */ +gras_error_t grasbw_request(const char* from_name,unsigned int from_port, + const char* to_name,unsigned int to_port, + unsigned int bufSize,unsigned int expSize,unsigned int msgSize, + /*OUT*/ double *sec, double*bw); + + +/* *************************************************************************** + * Link saturation + * ***************************************************************************/ + +/** + * grasbw_saturate_start: + * @from_name: Name of the host we are asking to do a experiment with (to_name:to_port) + * @from_port: port on which the process we are asking for an experiment is listening + * (for message, do not give a raw socket here. The needed raw socket will be negociated + * between the peers) + * @to_name: Name of the host with which we should conduct the experiment + * @to_port: port on which the peer process is listening for message + * @msgSize: Size of each message sent. + * @timeout: How long in maximum should be the saturation. + * + * Ask the process 'from_name:from_port' to start to saturate the link between itself + * and to_name:to_name. + */ +gras_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port, + const char* to_name,unsigned int to_port, + unsigned int msgSize, unsigned int timeout); + +/** + * grasbw_saturate_stop: + * @from_name: Name of the host we are asking to do a experiment with (to_name:to_port) + * @from_port: port on which the process we are asking for an experiment is listening + * (for message, do not give a raw socket here. The needed raw socket will be negociated + * between the peers) + * @to_name: Name of the host with which we should conduct the experiment + * @to_port: port on which the peer process is listening for message + * + * Ask the process 'from_name:from_port' to stop saturating the link between itself + * and to_name:to_name. + */ +gras_error_t grasbw_saturate_stop(const char* from_name,unsigned int from_port, + const char* to_name,unsigned int to_port); + + + +#endif /* GRAS_BANDWIDTH_H */ diff --git a/include/modules/base.h b/include/modules/base.h new file mode 100644 index 0000000000..e0a674881b --- /dev/null +++ b/include/modules/base.h @@ -0,0 +1,90 @@ +/* $Id$ */ + +/* gras_addons - several addons to do specific stuff not in GRAS itself */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef GRAS_ADDONS_H +#define GRAS_ADDONS_H + +#include + +#define HOSTNAME_LEN 256 +#define ERRMSG_LEN 50 + +/* **************************************************************************** + * The common types used as payload in the messages and their definitions + * ****************************************************************************/ + +/** + * msgHost_t: + * + * Description of an host + */ + +typedef struct { + char host[HOSTNAME_LEN]; + unsigned int port; +} msgHost_t; + +static const DataDescriptor msgHostDesc[] = + { SIMPLE_MEMBER(CHAR_TYPE,HOSTNAME_LEN,offsetof(msgHost_t,host)), + SIMPLE_MEMBER(UNSIGNED_INT_TYPE,1, offsetof(msgHost_t,port))}; +#define msgHostLen 2 + +/** + * msgError_t: + * + * how to indicate an eventual error + */ + +typedef struct { + char errmsg[ERRMSG_LEN]; + unsigned int errcode; +} msgError_t; + +static const DataDescriptor msgErrorDesc[] = + { SIMPLE_MEMBER(CHAR_TYPE, ERRMSG_LEN,offsetof(msgError_t,errmsg)), + SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(msgError_t,errcode))}; +#define msgErrorLen 2 + +/** + * msgResult_t: + * + * how to report the result of an experiment + */ + +typedef struct { + unsigned int timestamp; + double value; +} msgResult_t; + +static const DataDescriptor msgResultDesc[] = + { SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(msgResult_t,timestamp)), + SIMPLE_MEMBER(DOUBLE_TYPE, 1, offsetof(msgResult_t,value))}; +#define msgResultLen 2 + +/** + * grasRepportError: + * + * Repports an error to the process listening on socket sock. + * + * The information will be embeeded in a message of type id, which must take a msgError_t as first + * sequence (and SeqCount sequences in total). Other sequences beside the error one will be of + * length 0. + * + * The message will be builded as sprintf would, using the given format and extra args. + * + * If the message cannot be builded and sent to recipient, the string severeError will be printed + * on localhost's stderr. + */ +void +grasRepportError (gras_sock_t *sock, gras_msgid_t id, int SeqCount, + const char *severeError, + gras_error_t errcode, const char* format,...); + +#endif /* GRAS_ADDONS_H */ diff --git a/include/socket.h b/include/socket.h new file mode 100644 index 0000000000..c0169ad6ea --- /dev/null +++ b/include/socket.h @@ -0,0 +1,223 @@ +/* $Id$ */ + +/* gras/socket.h - handling sockets in GRAS */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + + +#ifndef GRAS_SOCK_H +#define GRAS_SOCK_H + +#include /* offsetof() */ +#include /* size_t */ +#include + + +/*! C++ users need love */ +#ifndef BEGIN_DECL +# ifdef __cplusplus +# define BEGIN_DECL extern "C" { +# else +# define BEGIN_DECL +# endif +#endif + +/*! C++ users need love */ +#ifndef END_DECL +# ifdef __cplusplus +# define END_DECL } +# else +# define END_DECL +# endif +#endif +/* End of cruft for C++ */ + +BEGIN_DECL + +/****************************************************************************/ +/* Openning/Maintaining/Closing connexions */ +/****************************************************************************/ +/** Number of channel opened at most on a given host within SimGrid */ +#define MAX_CHANNEL 10 + +/*! Type of a communication socket */ +typedef struct gras_sock_s gras_sock_t; + +/** + * gras_sock_client_open: + * @host: name of the host we want to connect to + * @Param2: port on which we want to connect on this host + * @sock: Newly created socket + * @Returns: an errcode + * + * Attempts to establish a connection to the server listening to host:port + */ +gras_error_t +gras_sock_client_open(const char *host, short port, + /* OUT */ gras_sock_t **sock); + +/** + * gras_sock_server_open: + * @Param1: starting port + * @Param2: ending port + * @sock: Newly create socket + * @Returns: an errcode + * + * Attempts to bind to any port between #startingPort# and #endingPort#, + * inclusive. + * + * You can get the port on which you connected using grasSockGetPort(). + */ +gras_error_t +gras_sock_server_open(unsigned short startingPort, + unsigned short endingPort, + /* OUT */ gras_sock_t **sock); + +/** + * gras_sock_close: + * @sock: The socket to close. + * @Returns: an errcode + * + * Tears down a socket. + */ +gras_error_t gras_sock_close(gras_sock_t *sock); + + +/****************************************************************************/ +/* Converting DNS name <-> IP */ +/****************************************************************************/ +/** + * gras_sock_get_peer_name: + * @sd: + * @Returns: the DNS name of the host connected to #sd#, or descriptive text if + * #sd# is not an inter-host connection: returns NULL in case of error + * + * The value returned should not be freed. + */ +char * +gras_sock_get_peer_name(gras_sock_t *sd); + +/** + * gras_sock_get_peer_port: + * @sd: + * @Returns: the port number on the other side of socket sd. -1 is returned + * if pipes or unknown + */ +unsigned short +gras_sock_get_peer_port(gras_sock_t *sd); + +/** + * gras_sock_get_peer_addr: + * @sd: + * @Returns: the IP address of the other side of this socket. + * + * can return NULL (out of memory condition). + * Do not free the result. + */ +char * +gras_sock_get_peer_addr(gras_sock_t *sd); + +/** + * gras_sock_get_my_port: + * @sd: + * @Returns: the port number on the this side of socket sd. -1 is returned + * if pipes or unknown + */ +unsigned short +gras_sock_get_my_port(gras_sock_t *sd); + +/* ************************************************************************** + * Raw sockets and BW experiments (should be placed in another file) + * **************************************************************************/ +typedef struct gras_rawsock_s gras_rawsock_t; + +/** + * gras_rawsock_client_open: + * + * Establishes a connection to @machine : @port on which the buffer sizes have + * been set to @bufSize bytes. + * + * Those sockets are meant to send raw data without any conversion, for example + * for bandwidth tests. + */ +gras_error_t +gras_rawsock_client_open(const char *host, short port, unsigned int bufSize, + /* OUT */ gras_rawsock_t **sock); + +/** + * gras_rawsock_server_open: + * + * Open a connexion waiting for external input, on which the buffer sizes have + * been set to @bufSize bytes. + * + * Those sockets are meant to send raw data without any conversion, for example + * for bandwidth tests. + */ +gras_error_t +gras_rawsock_server_open(unsigned short startingPort, unsigned short endingPort, + unsigned int bufSize, /* OUT */ gras_rawsock_t **sock); + +/** + * gras_rawsock_close: + * + * Close a raw socket. + * + * Those sockets are meant to send raw data without any conversion, for example + * for bandwidth tests. + */ +gras_error_t +gras_rawsock_close(gras_rawsock_t *sock); + +/** + * gras_rawsocket_get_my_port: + * @sd: + * @Returns: the port number on the this side of socket sd. -1 is returned + * if pipes or unknown + */ +unsigned short +gras_rawsocket_get_my_port(gras_rawsock_t *sd); + +/** + * gras_rawsocket_get_peer_port: + * @sd: + * @Returns: the port number on the other side of socket sd. -1 is returned + * if pipes or unknown + */ +unsigned short +gras_rawsock_get_peer_port(gras_rawsock_t *sd); + +/** + * gras_rawsock_send: + * @sock: on which raw socket to send the data + * @expSize: total size of data sent + * @msgSize: size of each message sent one after the other + * + * Send a raw bunch of data, for example for a bandwith test. + */ + +gras_error_t +gras_rawsock_send(gras_rawsock_t *sd, unsigned int expSize, unsigned int msgSize); + +/** + * gras_rawsock_recv: + * @sock: on which raw socket to read the data + * @expSize: total size of data received + * @msgSize: size of each message received one after the other + * @timeout: time to wait for that data + * + * Receive a raw bunch of data, for example for a bandwith test. + */ + +gras_error_t +gras_rawsock_recv(gras_rawsock_t *sd, unsigned int expSize, unsigned int msgSize, + unsigned int timeout); + + +END_DECL + +#endif /* GRAS_SOCK_H */ + diff --git a/install-sh b/install-sh new file mode 100755 index 0000000000..0ec27bcd48 --- /dev/null +++ b/install-sh @@ -0,0 +1,294 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# 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 "$0: no input file specified" >&2 + exit 1 +else + : +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d "$dst" ]; then + instcmd=: + chmodcmd="" + else + instcmd=$mkdirprog + 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" ] || [ -d "$src" ] + then + : + else + echo "$0: $src does not exist" >&2 + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "$0: no destination specified" >&2 + exit 1 + else + : + 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 + : + 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 + : + fi + + pathcomp=$pathcomp/ +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd "$dst" && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; 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 + : + fi + +# Make a couple of temp file names in the proper directory. + + dsttmp=$dstdir/#inst.$$# + rmtmp=$dstdir/#rm.$$# + +# Trap to clean up temp files at exit. + + trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 + trap '(exit $?); exit' 1 2 13 15 + +# Move or copy the file name to the temp name + + $doit $instcmd "$src" "$dsttmp" && + +# 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 :;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && + +# Now remove or move aside any old file at destination location. We try this +# two ways since rm can't unlink itself on some systems and the destination +# file might be busy for other reasons. In this case, the final cleanup +# might fail but the new file should still install successfully. + +{ + if [ -f "$dstdir/$dstfile" ] + then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || + $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || + { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi +} && + +# Now rename the file to the real destination. + + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + +fi && + +# The final little trick to "correctly" pass the exit status to the exit trap. + +{ + (exit 0); exit +} diff --git a/ltmain.sh b/ltmain.sh new file mode 100644 index 0000000000..b5afd12a8f --- /dev/null +++ b/ltmain.sh @@ -0,0 +1,6358 @@ +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun configure. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003 +# Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +##################################### +# Shell function definitions: +# This seems to be the best place for them + +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +win32_libid () { + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ + grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then + win32_nmres=`eval $NM -f posix -A $1 | \ + sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` + if test "X$win32_nmres" = "Ximport" ; then + win32_libid_type="x86 archive import" + else + win32_libid_type="x86 archive static" + fi + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $echo $win32_libid_type +} + +# End of Shell function definitions +##################################### + +# Parse our command line options once, thoroughly. +while test "$#" -gt 0 +do + arg="$1" + shift + + case $arg in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + execute_dlfiles) + execute_dlfiles="$execute_dlfiles $arg" + ;; + tag) + tagname="$arg" + preserve_args="${preserve_args}=$arg" + + # Check whether tagname contains only valid characters + case $tagname in + *[!-_A-Za-z0-9,/]*) + $echo "$progname: invalid tag name: $tagname" 1>&2 + exit 1 + ;; + esac + + case $tagname in + CC) + # Don't test for the "default" C tag, as we know, it's there, but + # not specially marked. + ;; + *) + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then + taglist="$taglist $tagname" + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`" + else + $echo "$progname: ignoring unknown tag $tagname" 1>&2 + fi + ;; + esac + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case $arg in + --help) + show_help=yes + ;; + + --version) + $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + $echo + $echo "Copyright (C) 2003 Free Software Foundation, Inc." + $echo "This is free software; see the source for copying conditions. There is NO" + $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + exit 0 + ;; + + --config) + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 + # Now print the configurations for the tags. + for tagname in $taglist; do + ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0" + done + exit 0 + ;; + + --debug) + $echo "$progname: enabling shell trace mode" + set -x + preserve_args="$preserve_args $arg" + ;; + + --dry-run | -n) + run=: + ;; + + --features) + $echo "host: $host" + if test "$build_libtool_libs" = yes; then + $echo "enable shared libraries" + else + $echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + $echo "enable static libraries" + else + $echo "disable static libraries" + fi + exit 0 + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --preserve-dup-deps) duplicate_deps="yes" ;; + + --quiet | --silent) + show=: + preserve_args="$preserve_args $arg" + ;; + + --tag) prevopt="--tag" prev=tag ;; + --tag=*) + set tag "$optarg" ${1+"$@"} + shift + prev=tag + preserve_args="$preserve_args --tag" + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 +fi + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 + $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 + case $nonopt in + *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) + mode=link + for arg + do + case $arg in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case $mode in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + + for arg + do + case "$arg_mode" in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; + + target ) + libobj="$arg" + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + if test -n "$libobj" ; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + arg_mode=target + continue + ;; + + -static | -prefer-pic | -prefer-non-pic) + later="$later $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + lastarg="$lastarg $arg" + done + IFS="$save_ifs" + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` + + # Add the arguments to base_compile. + base_compile="$base_compile $lastarg" + continue + ;; + + * ) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + case $lastarg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + base_compile="$base_compile $lastarg" + done # for arg + + case $arg_mode in + arg) + $echo "$modename: you must specify an argument for -Xcompile" + exit 1 + ;; + target) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + *) + # Get the name of the library object. + [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSifmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.ii) xform=ii ;; + *.class) xform=class ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + *.java) xform=java ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case $libobj in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit 1 + ;; + esac + + # Infer tagged configuration to use if any are available and + # if one wasn't chosen via the "--tag" command line option. + # Only attempt this if the compiler in the base compile + # command doesn't match the default compiler. + if test -n "$available_tags" && test -z "$tagname"; then + case $base_compile in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" + case "$base_compile " in + "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit 1 +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi + + for arg in $later; do + case $arg in + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir= + else + xdir=$xdir/ + fi + lobj=${xdir}$objdir/$objname + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit 1" 1 2 15 + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit 1" 1 2 15 + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $run ln "$0" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + $echo $srcfile > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + + $run $rm "$libobj" "${libobj}T" + + # Create a libtool object file (analogous to a ".la" file), + # but don't create it if we're doing a dry run. + test -z "$run" && cat > ${libobj}T </dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + $show "$mv $output_obj $lobj" + if $run $mv $output_obj $lobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the PIC object to the libtool object file. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T </dev/null`" != "X$srcfile"; then + $echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Append the name of the non-PIC object the libtool object file. + # Only append if the libtool object file exists. + test -z "$run" && cat >> ${libobj}T <> ${libobj}T < /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" + case "$base_compile " in + "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) + # The compiler in $compile_command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit 1 +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -all-static | -static) + if test "X$arg" = "X-all-static"; then + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + fi + build_libtool_libs=no + build_old_libs=yes + prefer_static_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + base_compile="$base_compile $arg" + shift + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test + ;; + *) qarg=$arg ;; + esac + libtool_args="$libtool_args $qarg" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case $prev in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit 1 + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat $save_arg` + do +# moreargs="$moreargs $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit 1 + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit 1 + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + done + else + $echo "$modename: link input file \`$save_arg' does not exist" + exit 1 + fi + arg=$save_arg + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + xcompiler) + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + xlinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $wl$qarg" + prev= + compile_command="$compile_command $wl$qarg" + finalize_command="$finalize_command $wl$qarg" + continue + ;; + xcclinker) + linker_flags="$linker_flags $qarg" + compiler_flags="$compiler_flags $qarg" + prev= + compile_command="$compile_command $qarg" + finalize_command="$finalize_command $qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: more than one -exported-symbols argument is not allowed" + exit 1 + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + ;; + esac + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + exit 1 + fi + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$dir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-pw32* | *-*-beos*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-mingw* | *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + deplibs="$deplibs -framework System" + continue + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + deplibs="$deplibs $arg" + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + deplibs="$deplibs $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # gcc -m* arguments should be passed to the linker via $compiler_flags + # in order to pass architecture information to the linker + # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo + # but this is not reliable with gcc because gcc may use -mfoo to + # select a different linker, different libraries, etc, while + # -Wl,-mfoo simply passes -mfoo to the linker. + -m*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + if test "$with_gcc" = "yes" ; then + compiler_flags="$compiler_flags $arg" + fi + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # The PATH hackery in wrapper scripts is required on Windows + # in order for the loader to find any dlls it needs. + $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 + $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -Wc,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Wl,*) + args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + case $flag in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + flag="\"$flag\"" + ;; + esac + arg="$arg $wl$flag" + compiler_flags="$compiler_flags $wl$flag" + linker_flags="$linker_flags $flag" + done + IFS="$save_ifs" + arg=`$echo "X$arg" | $Xsed -e "s/^ //"` + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + + *.$objext) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + pic_object= + non_pic_object= + + # Read the .lo file + # If there is no directory component, then add one. + case $arg in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + if test -z "$pic_object" || \ + test -z "$non_pic_object" || + test "$pic_object" = none && \ + test "$non_pic_object" = none; then + $echo "$modename: cannot find name of object for \`$arg'" 1>&2 + exit 1 + fi + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles $pic_object" + prev= + fi + + # A PIC object. + libobjs="$libobjs $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + non_pic_objects="$non_pic_objects $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + fi + else + # Only an error if not doing a dry-run. + if test -z "$run"; then + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 + exit 1 + else + # Dry-run case. + + # Extract subdirectory from the argument. + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$arg"; then + xdir= + else + xdir="$xdir/" + fi + + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` + libobjs="$libobjs $pic_object" + non_pic_objects="$non_pic_objects $non_pic_object" + fi + fi + ;; + + *.$libext) + # An archive. + deplibs="$deplibs $arg" + old_deplibs="$old_deplibs $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + dlfiles="$dlfiles $arg" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + dlprefiles="$dlprefiles $arg" + prev= + else + deplibs="$deplibs $arg" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done # argument parsing loop + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + # Create the object directory. + if test ! -d "$output_objdir"; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test "$status" -ne 0 && test ! -d "$output_objdir"; then + exit $status + fi + fi + + # Determine the type of output + case $output in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + case $host in + *cygwin* | *mingw* | *pw32*) + # don't eliminate duplcations in $postdeps and $predeps + duplicate_compiler_generated_deps=yes + ;; + *) + duplicate_compiler_generated_deps=$duplicate_deps + ;; + esac + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if test "X$duplicate_deps" = "Xyes" ; then + case "$libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + libs="$libs $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; + esac + pre_post_deps="$pre_post_deps $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + case $linkmode in + lib) + passes="conv link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 + exit 1 + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + for pass in $passes; do + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 + continue + fi + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do + for search_ext in .la $shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if (${SED} -e '2q' $lib | + grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + library_names= + old_library= + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) lib="$deplib" ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + if test "$deplibs_check_method" != pass_all; then + $echo + $echo "*** Warning: Trying to link with static lib archive $deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because the file extensions .$libext of this argument makes me believe" + $echo "*** that it is just a static archive that I should not used here." + else + $echo + $echo "*** Warning: Linking the shared library $output against the" + $echo "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + newdlprefiles="$newdlprefiles $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + newdlfiles="$newdlfiles $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + if test "$found" = yes || test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib'" 1>&2 + exit 1 + fi + + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + + # Read the .la file + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && dlfiles="$dlfiles $dlopen" + test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + elif test "$linkmode" != prog && test "$linkmode" != lib; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit 1 + fi + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 + exit 1 + fi + if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + dlprefiles="$dlprefiles $lib $dependency_libs" + else + newdlfiles="$newdlfiles $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + abs_ladir="$ladir" + fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + $echo "$modename: warning: library \`$lib' was moved." 1>&2 + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + notinst_path="$notinst_path $abs_ladir" + fi # $installed = yes + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir"; then + $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 + exit 1 + fi + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + newdlprefiles="$newdlprefiles $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + newdlprefiles="$newdlprefiles $dir/$dlname" + else + newdlprefiles="$newdlprefiles $dir/$linklib" + fi + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + newlib_search_path="$newlib_search_path $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + fi + # This is a shared library + + # Warn about portability, can't link against -module's on some systems (darwin) + if test "$shouldnotlink" = yes && test "$pass" = link ; then + $echo + if test "$linkmode" = prog; then + $echo "*** Warning: Linking the executable $output against the loadable module" + else + $echo "*** Warning: Linking the shared library $output against the loadable module" + fi + $echo "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw*) + major=`expr $current - $age` + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + soname=`$echo $soroot | ${SED} -e 's/^.*\///'` + newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + save_ifs="$IFS"; IFS='~' + eval cmds=\"$extract_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + save_ifs="$IFS"; IFS='~' + eval cmds=\"$old_archive_from_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5* ) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a module then we can not link against it, someone + # is ignoring the new warnings I added + if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then + $echo "** Warning, lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + $echo + $echo "** And there doesn't seem to be a static archive available" + $echo "** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case "$libdir" in + [\\/]*) + add_dir="$add_dir -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + $echo + $echo "*** Warning: This system can not link to static lib archive $lib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + $echo "*** But as you try to build a module library, libtool will still create " + $echo "*** a static module, that should work as long as the dlopening application" + $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + newlib_search_path="$newlib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + if test "X$duplicate_deps" = "Xyes" ; then + case "$tmp_libs " in + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; + esac + fi + tmp_libs="$tmp_libs $deplib" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case $deplib in + -L*) path="$deplib" ;; + *.la) + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + fi + ;; + esac + if grep "^installed=no" $deplib > /dev/null; then + path="$absdir/$objdir" + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + if test "$absdir" != "$libdir"; then + $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 + fi + path="$absdir" + fi + depdepl= + case $host in + *-*-darwin*) + # we do not want to link against static libs, but need to link against shared + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$path/$depdepl" ; then + depdepl="$path/$depdepl" + fi + # do not add paths which are already there + case " $newlib_search_path " in + *" $path "*) ;; + *) newlib_search_path="$newlib_search_path $path";; + esac + path="" + fi + ;; + *) + path="-L$path" + ;; + esac + + ;; + -l*) + case $host in + *-*-darwin*) + # Again, we only want to link against shared libraries + eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` + for tmp in $newlib_search_path ; do + if test -f "$tmp/lib$tmp_libs.dylib" ; then + eval depdepl="$tmp/lib$tmp_libs.dylib" + break + fi + done + path="" + ;; + *) continue ;; + esac + ;; + *) continue ;; + esac + case " $deplibs " in + *" $depdepl "*) ;; + *) deplibs="$deplibs $depdepl" ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$deplibs $path" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + ;; + *) tmp_libs="$tmp_libs $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + tmp_libs="$tmp_libs $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval shared_ext=\"$shrext\" + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval shared_ext=\"$shrext\" + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 + exit 1 + else + $echo + $echo "*** Warning: Linking the shared library $output against the non-libtool" + $echo "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi + fi + + if test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test "$#" -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$2" + number_minor="$3" + number_revision="$4" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows) + current=`expr $number_major + $number_minor` + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + current=`expr $number_major + $number_minor - 1` + age="$number_minor" + revision="$number_minor" + ;; + esac + ;; + no) + current="$2" + revision="$3" + age="$4" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case $revision in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case $age in + 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; + *) + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + if test "$age" -gt "$current"; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + minor_current=`expr $current + 1` + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + irix | nonstopux) + major=`expr $current - $age + 1` + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=.`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + major=`expr $current - $age` + versuffix="-$major" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + fi + + if test "$mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$echo "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + removelist="$removelist $p" + ;; + *) ;; + esac + done + if test -n "$removelist"; then + $show "${rm}r $removelist" + $run ${rm}r $removelist + fi + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + for path in $notinst_path; do + lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` + deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` + dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` + done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) dlfiles="$dlfiles $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) dlprefiles="$dlprefiles $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + deplibs="$deplibs -framework System" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + deplibs="$deplibs -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for file magic test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a file magic. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name="`expr $a_deplib : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test -n "$name" && test "$name" != "0"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval $echo \"$potent_lib\" 2>/dev/null \ + | ${SED} 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + $echo + $echo "*** Warning: linker path does not have real file for library $a_deplib." + $echo "*** I have the capability to make that library automatically link in when" + $echo "*** you link to this library. But I can only do this if you have a" + $echo "*** shared version of the library, which you do not appear to have" + $echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $echo "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $echo "*** with $libname and none of the candidates passed a file format test" + $echo "*** using a regex pattern. Last file checked: $potlib" + fi + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` + done + fi + if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ + | grep . >/dev/null; then + $echo + if test "X$deplibs_check_method" = "Xnone"; then + $echo "*** Warning: inter-library dependencies are not supported in this platform." + else + $echo "*** Warning: inter-library dependencies are not known to be supported." + fi + $echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + $echo + $echo "*** Warning: libtool could not satisfy all declared inter-library" + $echo "*** dependencies of module $libname. Therefore, libtool will create" + $echo "*** a static module, that should work as long as the dlopening" + $echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + $echo + $echo "*** However, this would only work if libtool was able to extract symbol" + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + $echo "*** not find such a program. So, this module is probably useless." + $echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + $echo "*** The inter-library dependencies that have been dropped here will be" + $echo "*** automatically added whenever a program is linked with this library" + $echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + $echo + $echo "*** Since this library must not contain undefined symbols," + $echo "*** because either the platform does not support them or" + $echo "*** it was explicitly requested with -no-undefined," + $echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + for link + do + linknames="$linknames $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + eval cmds=\"$export_symbols_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + if len=`expr "X$cmd" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + $show "$cmd" + $run eval "$cmd" || exit $? + skipped_export=false + else + # The command line is too long to execute in one step. + $show "using reloadable object file for export list..." + skipped_export=: + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + tmp_deplibs="$tmp_deplibs $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + status=$? + if test "$status" -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "$mkdir $xdir" + $run $mkdir "$xdir" + status=$? + if test "$status" -ne 0 && test ! -d "$xdir"; then + exit $status + fi + # We will extract separately just the conflicting names and we will no + # longer touch any unique names. It is faster to leave these extract + # automatically by $AR in one run. + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $AR t "$xabs" | sort | uniq -cd | while read -r count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? + i=`expr $i + 1` + done + done + fi + + libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval cmds=\"$module_expsym_cmds\" + else + eval cmds=\"$module_cmds\" + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else + eval cmds=\"$archive_cmds\" + fi + fi + + if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise. + $echo "creating reloadable object files..." + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + delfiles= + last_robj= + k=1 + output=$output_objdir/$save_output-${k}.$objext + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + eval test_cmds=\"$reload_cmds $objlist $last_robj\" + if test "X$objlist" = X || + { len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len"; }; then + objlist="$objlist $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + eval concat_cmds=\"$reload_cmds $objlist $last_robj\" + else + # All subsequent reloadable object files will link in + # the last one created. + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" + fi + last_robj=$output_objdir/$save_output-${k}.$objext + k=`expr $k + 1` + output=$output_objdir/$save_output-${k}.$objext + objlist=$obj + len=1 + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" + + if ${skipped_export-false}; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + libobjs=$output + # Append the command to create the export file. + eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" + fi + + # Set up a command to remove the reloadale object files + # after they are used. + i=0 + while test "$i" -lt "$k" + do + i=`expr $i + 1` + delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" + done + + $echo "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else + eval cmds=\"$archive_cmds\" + fi + + # Append the command to remove the reloadable object files + # to the just-reset $cmds. + eval cmds=\"\$cmds~$rm $delfiles\" + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$mode" = relink; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + exit 0 + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case $output in + *.lo) + if test -n "$objs$old_deplibs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit 1 + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + status=$? + if test "$status" -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "$mkdir $xdir" + $run $mkdir "$xdir" + status=$? + if test "$status" -ne 0 && test ! -d "$xdir"; then + exit $status + fi + # We will extract separately just the conflicting names and we will no + # longer touch any unique names. It is faster to leave these extract + # automatically by $AR in one run. + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $AR t "$xabs" | sort | uniq -cd | while read -r count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? + i=`expr $i + 1` + done + done + fi + + reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + eval cmds=\"$reload_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $run eval "echo timestamp > $libobj" || exit $? + exit 0 + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + eval cmds=\"$reload_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + ;; + + prog) + case $host in + *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; + esac + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` + ;; + esac + + case $host in + *darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + if test "$tagname" = CXX ; then + compile_command="$compile_command ${wl}-bind_at_load" + finalize_command="$finalize_command ${wl}-bind_at_load" + fi + ;; + esac + + compile_command="$compile_command $compile_deplibs" + finalize_command="$finalize_command $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + case :$dllsearchpath: in + *":$libdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$libdir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case $dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$output.exp" + $run $rm $export_symbols + $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + else + $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' + $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` + $run eval '$echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + $echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr void * +#else +# define lt_ptr char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr address; +} +lt_preloaded_symbols[] = +{\ +" + + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit 1 + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $run $rm $output + # Link the executable and exit + $show "$link_command" + $run eval "$link_command" || exit $? + exit 0 + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $0 --fallback-echo"; then + case $0 in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; + *) qecho="$SHELL `pwd`/$0 --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + cwrappersource=`$echo ${objdir}/lt-${output}.c` + cwrapper=`$echo ${output}.exe` + $rm $cwrappersource $cwrapper + trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15 + + cat > $cwrappersource <> $cwrappersource<<"EOF" +#include +#include +#include +#include +#include +#include + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef DIR_SEPARATOR +#define DIR_SEPARATOR '/' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +#define HAVE_DOS_BASED_FILE_SYSTEM +#ifndef DIR_SEPARATOR_2 +#define DIR_SEPARATOR_2 '\\' +#endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +const char *program_name = NULL; + +void * xmalloc (size_t num); +char * xstrdup (const char *string); +char * basename (const char *name); +char * fnqualify(const char *path); +char * strendzap(char *str, const char *pat); +void lt_fatal (const char *message, ...); + +int +main (int argc, char *argv[]) +{ + char **newargz; + int i; + + program_name = (char *) xstrdup ((char *) basename (argv[0])); + newargz = XMALLOC(char *, argc+2); +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" + newargz[1] = fnqualify(argv[0]); + /* we know the script has the same name, without the .exe */ + /* so make sure newargz[1] doesn't end in .exe */ + strendzap(newargz[1],".exe"); + for (i = 1; i < argc; i++) + newargz[i+1] = xstrdup(argv[i]); + newargz[argc+1] = NULL; +EOF + + cat >> $cwrappersource <> $cwrappersource <<"EOF" +} + +void * +xmalloc (size_t num) +{ + void * p = (void *) malloc (num); + if (!p) + lt_fatal ("Memory exhausted"); + + return p; +} + +char * +xstrdup (const char *string) +{ + return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL +; +} + +char * +basename (const char *name) +{ + const char *base; + +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + /* Skip over the disk name in MSDOS pathnames. */ + if (isalpha (name[0]) && name[1] == ':') + name += 2; +#endif + + for (base = name; *name; name++) + if (IS_DIR_SEPARATOR (*name)) + base = name + 1; + return (char *) base; +} + +char * +fnqualify(const char *path) +{ + size_t size; + char *p; + char tmp[LT_PATHMAX + 1]; + + assert(path != NULL); + + /* Is it qualified already? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha (path[0]) && path[1] == ':') + return xstrdup (path); +#endif + if (IS_DIR_SEPARATOR (path[0])) + return xstrdup (path); + + /* prepend the current directory */ + /* doesn't handle '~' */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal ("getcwd failed"); + size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ + p = XMALLOC(char, size); + sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); + return p; +} + +char * +strendzap(char *str, const char *pat) +{ + size_t len, patlen; + + assert(str != NULL); + assert(pat != NULL); + + len = strlen(str); + patlen = strlen(pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp(str, pat) == 0) + *str = '\0'; + } + return str; +} + +static void +lt_error_core (int exit_status, const char * mode, + const char * message, va_list ap) +{ + fprintf (stderr, "%s: %s: ", program_name, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, "FATAL", message, ap); + va_end (ap); +} +EOF + # we should really use a build-platform specific compiler + # here, but OTOH, the wrappers (shell script and this C one) + # are only useful if you want to execute the "real" binary. + # Since the "real" binary is built for $host, then this + # wrapper might as well be built for $host, too. + $run $LTCC -s -o $cwrapper $cwrappersource + ;; + esac + $rm $output + trap "$rm $output; exit 1" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='${SED} -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $echo >> $output "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + $echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $echo \"\$relink_command_output\" >&2 + $rm \"\$progdir/\$file\" + exit 1 + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + $echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \$progdir\\\\\$program \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit 1 + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + $echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" + chmod +x $output + fi + exit 0 + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "$mkdir $gentop" + $run $mkdir "$gentop" + status=$? + if test "$status" -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + # Add in members from convenience archives. + for xlib in $addlibs; do + # Extract the objects. + case $xlib in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "$mkdir $xdir" + $run $mkdir "$xdir" + status=$? + if test "$status" -ne 0 && test ! -d "$xdir"; then + exit $status + fi + # We will extract separately just the conflicting names and we will no + # longer touch any unique names. It is faster to leave these extract + # automatically by $AR in one run. + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 + $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 + $AR t "$xabs" | sort | uniq -cd | while read -r count name + do + i=1 + while test "$i" -le "$count" + do + # Put our $i before any first dot (extension) + # Never overwrite any file + name_to="$name" + while test "X$name_to" = "X$name" || test -f "$xdir/$name_to" + do + name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` + done + $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')" + $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $? + i=`expr $i + 1` + done + done + fi + + oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` + done + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + eval cmds=\"$old_archive_from_new_cmds\" + else + eval cmds=\"$old_archive_cmds\" + + if len=`expr "X$cmds" : ".*"` && + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # the command line is too long to link in one step, link in parts + $echo "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + # GNU ar 2.10+ was changed to match POSIX; thus no paths are + # encoded into archives. This makes 'ar r' malfunction in + # this piecewise linking case whenever conflicting object + # names appear in distinct ar calls; check, warn and compensate. + if (for obj in $save_oldobjs + do + $echo "X$obj" | $Xsed -e 's%^.*/%%' + done | sort | sort -uc >/dev/null 2>&1); then + : + else + $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2 + $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2 + AR_FLAGS=cq + fi + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + for obj in $save_oldobjs + do + oldobjs="$objlist $obj" + objlist="$objlist $obj" + eval test_cmds=\"$old_archive_cmds\" + if len=`expr "X$test_cmds" : ".*"` && + test "$len" -le "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~$old_archive_cmds\" + fi + fi + fi + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` + relink_command="$var=\"$var_value\"; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $0 $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + for lib in $dlfiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdlfiles="$newdlfiles $libdir/$name" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + if test -z "$libdir"; then + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdlprefiles="$newdlprefiles $libdir/$name" + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlfiles="$newdlfiles $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + newdlprefiles="$newdlprefiles $abs" + done + dlprefiles="$newdlprefiles" + fi + $rm $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; + esac + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $echo >> $output "\ +relink_command=\"$relink_command\"" + fi + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? + ;; + esac + exit 0 + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg="$nonopt" + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest="$arg" + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) prev="-f" ;; + -g) prev="-g" ;; + -m) prev="-m" ;; + -o) prev="-o" ;; + -s) + stripme=" -s" + continue + ;; + -*) ;; + + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest="$arg" + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case $arg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit 1 + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test "$#" -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + library_names= + old_library= + relink_command= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + if test "$inst_prefix_dir" = "$destdir"; then + $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 + exit 1 + fi + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + $echo "$modename: warning: relinking \`$file'" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + exit 1 + fi + fi + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$srcname $destdir/$realname" + $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? + if test -n "$stripme" && test -n "$striplib"; then + $show "$striplib $destdir/$realname" + $run eval "$striplib $destdir/$realname" || exit $? + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + eval cmds=\"$postinstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit 0 + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + file=`$echo $file|${SED} 's,.exe$,,'` + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin*|*mingw*) + wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` + ;; + *) + wrapper=$file + ;; + esac + if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + notinst_deplibs= + relink_command= + + # To insure that "foo" is sourced, and not "foo.exe", + # finese the cygwin/MSYS system by explicitly sourcing "foo." + # which disallows the automatic-append-.exe behavior. + case $build in + *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; + *) wrapperdot=${wrapper} ;; + esac + # If there is no directory component, then add one. + case $file in + */* | *\\*) . ${wrapperdot} ;; + *) . ./${wrapperdot} ;; + esac + + # Check the variables that should have been set. + if test -z "$notinst_deplibs"; then + $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 + exit 1 + fi + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + relink_command= + # To insure that "foo" is sourced, and not "foo.exe", + # finese the cygwin/MSYS system by explicitly sourcing "foo." + # which disallows the automatic-append-.exe behavior. + case $build in + *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; + *) wrapperdot=${wrapper} ;; + esac + # If there is no directory component, then add one. + case $file in + */* | *\\*) . ${wrapperdot} ;; + *) . ./${wrapperdot} ;; + esac + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir="/tmp" + test -n "$TMPDIR" && tmpdir="$TMPDIR" + tmpdir="$tmpdir/libtool-$$" + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + else + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi + file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyways + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` + ;; + esac + ;; + esac + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + if test -n "$stripme" && test -n "$striplib"; then + $show "$old_striplib $oldlib" + $run eval "$old_striplib $oldlib" || exit $? + fi + + # Do each command in the postinstall commands. + eval cmds=\"$old_postinstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $0 $preserve_args --finish$current_libdirs' + else + exit 0 + fi + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + eval cmds=\"$finish_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = : && exit 0 + + $echo "----------------------------------------------------------------------" + $echo "Libraries have been installed in:" + for libdir in $libdirs; do + $echo " $libdir" + done + $echo + $echo "If you ever happen to want to link against installed libraries" + $echo "in a given directory, LIBDIR, you must either use libtool, and" + $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + $echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + $echo " during execution" + fi + if test -n "$runpath_var"; then + $echo " - add LIBDIR to the \`$runpath_var' environment variable" + $echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + $echo + $echo "See any operating system documentation about shared libraries for" + $echo "more information, such as the ld(1) and ld.so(8) manual pages." + $echo "----------------------------------------------------------------------" + exit 0 + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit 1 + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + dir= + case $file in + *.la) + # Check to see that this really is a libtool archive. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit 1 + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit 0 + fi + ;; + + # libtool clean and uninstall mode + clean | uninstall) + modename="$modename: $mode" + rm="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) rm="$rm $arg"; rmforce=yes ;; + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + rmdirs= + + origobjdir="$objdir" + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$file"; then + dir=. + objdir="$origobjdir" + else + objdir="$dir/$origobjdir" + fi + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + test "$mode" = uninstall && objdir="$dir" + + # Remember objdir for removal later, being careful to avoid duplicates + if test "$mode" = clean; then + case " $rmdirs " in + *" $objdir "*) ;; + *) rmdirs="$rmdirs $objdir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if (test -L "$file") >/dev/null 2>&1 \ + || (test -h "$file") >/dev/null 2>&1 \ + || test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $objdir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" + test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" + + if test "$mode" = uninstall; then + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + eval cmds=\"$postuninstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + eval cmds=\"$old_postuninstall_cmds\" + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + if test "$?" -ne 0 && test "$rmforce" != yes; then + exit_status=1 + fi + done + IFS="$save_ifs" + fi + # FIXME: should reinstall the best remaining shared library. + fi + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + + # Read the .lo file + . $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" \ + && test "$pic_object" != none; then + rmfiles="$rmfiles $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" \ + && test "$non_pic_object" != none; then + rmfiles="$rmfiles $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$mode" = clean ; then + noexename=$name + case $file in + *.exe) + file=`$echo $file|${SED} 's,.exe$,,'` + noexename=`$echo $name|${SED} 's,.exe$,,'` + # $file with .exe has already been added to rmfiles, + # add $file without .exe + rmfiles="$rmfiles $file" + ;; + esac + # Do a test to see if this is a libtool program. + if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$noexename + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + rmfiles="$rmfiles $objdir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + objdir="$origobjdir" + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + $show "rmdir $dir" + $run rmdir $dir >/dev/null 2>&1 + fi + done + + exit $exit_status + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + ;; + esac + + if test -z "$exec_cmd"; then + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + fi +fi # test -z "$show_help" + +if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit 1 +fi + +# We need to display help for each of the modes. +case $mode in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG + --version print version information + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE. + +Report bugs to ." + exit 0 + ;; + +clean) + $echo \ +"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -prefer-pic try to building PIC objects only + -prefer-non-pic try to building non-PIC objects only + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; +esac + +$echo +$echo "Try \`$modename --help' for more information about other modes." + +exit 0 + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/src/.cvsignore b/src/.cvsignore new file mode 100644 index 0000000000..cbdfe89c09 --- /dev/null +++ b/src/.cvsignore @@ -0,0 +1,3 @@ +Makefile Makefile.in +config.h config.h.in stamp-h1 +gras_config.h gras_config.h.in diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000000..a6d43913fa --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,2 @@ +SUBDIRS=nws_portability base modules examples +#SUBDIRS=core modules examples diff --git a/src/amok/.cvsignore b/src/amok/.cvsignore new file mode 100644 index 0000000000..737e1c688f --- /dev/null +++ b/src/amok/.cvsignore @@ -0,0 +1 @@ +.deps Makefile Makefile.in diff --git a/src/amok/Makefile.am b/src/amok/Makefile.am new file mode 100644 index 0000000000..17b25abd5c --- /dev/null +++ b/src/amok/Makefile.am @@ -0,0 +1,9 @@ +DISTCLEANFILES=Makefile.in +INCLUDES= -I$(top_srcdir)/src/include @CFLAGS_XML@ @CFLAGS_SimGrid@ + +lib_LIBRARIES= libgrasmodules.a + +libgrasmodules_a_SOURCES= \ + base.c bandwidth.c + + diff --git a/src/amok/bandwidth.c b/src/amok/bandwidth.c new file mode 100644 index 0000000000..a9917ff63a --- /dev/null +++ b/src/amok/bandwidth.c @@ -0,0 +1,687 @@ +/* $Id$ */ + +/* gras_bandwidth - GRAS mecanism to do Bandwidth tests between to hosts */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#include +#include +#include + +#include + +/** + * BwExp_t: + * + * Description of a BW experiment (payload when asking an host to do a BW experiment with us) + */ +typedef struct { + unsigned int bufSize; + unsigned int expSize; + unsigned int msgSize; + unsigned int port; /* raw socket to use */ +} BwExp_t; + +static const DataDescriptor BwExp_Desc[] = + { SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(BwExp_t,bufSize)), + SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(BwExp_t,expSize)), + SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(BwExp_t,msgSize)), + SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(BwExp_t,port))}; +#define BwExp_Len 4 + +/** + * SatExp_t: + * + * Description of a BW experiment (payload when asking an host to do a BW experiment with us) + */ +typedef struct { + unsigned int msgSize; + unsigned int timeout; + unsigned int port; /* raw socket to use */ +} SatExp_t; + +static const DataDescriptor SatExp_Desc[] = + { SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(SatExp_t,msgSize)), + SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(SatExp_t,timeout)), + SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(SatExp_t,port))}; +#define SatExp_Len 3 + + +/* Prototypes of local callbacks */ +int grasbw_cbBWHandshake(gras_msg_t *msg); +int grasbw_cbBWRequest(gras_msg_t *msg); + +int grasbw_cbSatStart(gras_msg_t *msg); +int grasbw_cbSatBegin(gras_msg_t *msg); + +/**** code ****/ +gras_error_t grasbw_register_messages(void) { + gras_error_t errcode; + + + if ( /* Bandwidth */ + (errcode=gras_msgtype_register(GRASMSG_BW_REQUEST,"BW request",2, + msgHostDesc,msgHostLen, + BwExp_Desc,BwExp_Len)) || + (errcode=gras_msgtype_register(GRASMSG_BW_RESULT, "BW result",2, + msgErrorDesc,msgErrorLen, + msgResultDesc,msgResultLen /* first=seconds, second=bw */)) || + + (errcode=gras_msgtype_register(GRASMSG_BW_HANDSHAKE, "BW handshake",1, + BwExp_Desc,BwExp_Len)) || + (errcode=gras_msgtype_register(GRASMSG_BW_HANDSHAKED, "BW handshake ACK",1, + BwExp_Desc,BwExp_Len)) || + + /* Saturation */ + (errcode=gras_msgtype_register(GRASMSG_SAT_START,"SAT_START",2, + msgHostDesc,msgHostLen, + SatExp_Desc,SatExp_Len)) || + (errcode=gras_msgtype_register(GRASMSG_SAT_STARTED, "SAT_STARTED",1, + msgErrorDesc,msgErrorLen)) || + + (errcode=gras_msgtype_register(GRASMSG_SAT_BEGIN,"SAT_BEGIN",1, + SatExp_Desc,SatExp_Len)) || + (errcode=gras_msgtype_register(GRASMSG_SAT_BEGUN, "SAT_BEGUN",2, + msgErrorDesc,msgErrorLen, + SatExp_Desc,SatExp_Len)) || + + (errcode=gras_msgtype_register(GRASMSG_SAT_END,"SAT_END",0)) || + (errcode=gras_msgtype_register(GRASMSG_SAT_ENDED, "SAT_ENDED",1, + msgErrorDesc,msgErrorLen)) || + + (errcode=gras_msgtype_register(GRASMSG_SAT_STOP,"SAT_STOP",0)) || + (errcode=gras_msgtype_register(GRASMSG_SAT_STOPPED, "SAT_STOPPED",1, + msgErrorDesc,msgErrorLen)) ) + { + + fprintf(stderr,"GRASBW: Unable register the messages (got error %s)\n", + gras_error_name(errcode)); + return errcode; + } + + if ((errcode=gras_cb_register(GRASMSG_BW_HANDSHAKE,-1,&grasbw_cbBWHandshake)) || + (errcode=gras_cb_register(GRASMSG_BW_REQUEST,-1,&grasbw_cbBWRequest)) || + + (errcode=gras_cb_register(GRASMSG_SAT_START,-1,&grasbw_cbSatStart)) || + (errcode=gras_cb_register(GRASMSG_SAT_BEGIN,-1,&grasbw_cbSatBegin)) ) { + + fprintf(stderr,"GRASBW: Unable register the callbacks (got error %s)\n", + gras_error_name(errcode)); + return errcode; + } + + return no_error; +} + +/* *************************************************************************** + * Bandwidth tests + * ***************************************************************************/ +/* Function to do a test from local to given host */ +gras_error_t grasbw_test(const char*to_name,unsigned int to_port, + unsigned int bufSize,unsigned int expSize,unsigned int msgSize, + /*OUT*/ double *sec, double *bw) { + gras_rawsock_t *rawIn,*rawOut; + gras_sock_t *sock; + gras_error_t errcode; + BwExp_t *request; + gras_msg_t *answer; + + if((errcode=gras_sock_client_open(to_name,to_port,&sock))) { + fprintf(stderr,"grasbw_test(): Error %s encountered while contacting peer\n", + gras_error_name(errcode)); + return errcode; + } + if ((errcode=gras_rawsock_server_open(6666,8000,bufSize,&rawIn))) { + fprintf(stderr,"grasbw_test(): Error %s encountered while opening a raw socket\n", + gras_error_name(errcode)); + return errcode; + } + + if (!(request=(BwExp_t *)malloc(sizeof(BwExp_t)))) { + fprintf(stderr,"grasbw_test(): Malloc error\n"); + gras_sock_close(sock); + return malloc_error; + } + request->bufSize=bufSize; + request->expSize=expSize; + request->msgSize=msgSize; + request->port=gras_rawsock_get_peer_port(rawIn); + + if ((errcode=gras_msg_new_and_send(sock,GRASMSG_BW_HANDSHAKE, 1, + request,1))) { + fprintf(stderr,"grasbw_test(): Error %s encountered while sending the request.\n", + gras_error_name(errcode)); + gras_sock_close(sock); + return errcode; + } + if ((errcode=gras_msg_wait(60,GRASMSG_BW_HANDSHAKED,&answer))) { + fprintf(stderr,"grasbw_test(): Error %s encountered while waiting for the answer.\n", + gras_error_name(errcode)); + gras_sock_close(sock); + return errcode; + } + if((errcode=gras_rawsock_client_open(to_name,gras_msg_ctn(answer,0,0,BwExp_t).port, + bufSize,&rawOut))) { + fprintf(stderr,"grasbw_test(): Error %s encountered while opening the raw socket to %s:%d\n", + gras_error_name(errcode),to_name,gras_msg_ctn(answer,0,0,BwExp_t).port); + return errcode; + } + + *sec=gras_time(); + if ((errcode=gras_rawsock_send(rawOut,expSize,msgSize)) || + (errcode=gras_rawsock_recv(rawIn,1,1,120))) { + fprintf(stderr,"grasbw_test(): Error %s encountered while sending the experiment.\n", + gras_error_name(errcode)); + gras_rawsock_close(rawOut); + gras_rawsock_close(rawIn); + return errcode; + } + *sec = gras_time() - *sec; + *bw = ((double)expSize /* 8.0*/) / *sec / (1024.0 *1024.0); + + gras_rawsock_close(rawIn); + gras_rawsock_close(rawOut); + gras_sock_close(sock); + gras_msg_free(answer); + return no_error; +} + +/* Callback to the GRASMSG_BW_HANDSHAKE message: + opens a server raw socket, + indicate its port in an answer GRASMSG_BW_HANDSHAKED message, + receive the corresponding data on the raw socket, + close the raw socket +*/ +int grasbw_cbBWHandshake(gras_msg_t *msg) { + gras_rawsock_t *rawIn,*rawOut; + BwExp_t *ans; + gras_error_t errcode; + + if ((errcode=gras_rawsock_server_open(6666,8000,gras_msg_ctn(msg,0,0,BwExp_t).bufSize,&rawIn))) { + fprintf(stderr,"grasbw_cbHandshake(): Error %s encountered while opening a raw socket\n", + gras_error_name(errcode)); + return 1; + } + if ((errcode=gras_rawsock_client_open(gras_sock_get_peer_name(msg->sock),gras_msg_ctn(msg,0,0,BwExp_t).port, + gras_msg_ctn(msg,0,0,BwExp_t).bufSize,&rawOut))) { + fprintf(stderr,"grasbw_cbHandshake(): Error %s encountered while opening a raw socket\n", + gras_error_name(errcode)); + return 1; + } + if (!(ans=(BwExp_t *)malloc(sizeof(BwExp_t)))) { + fprintf(stderr,"grasbw_cbHandshake(): Malloc error.\n"); + gras_rawsock_close(rawIn); + gras_rawsock_close(rawOut); + return 1; + } + ans->bufSize=gras_msg_ctn(msg,0,0,BwExp_t).bufSize; + ans->expSize=gras_msg_ctn(msg,0,0,BwExp_t).expSize; + ans->msgSize=gras_msg_ctn(msg,0,0,BwExp_t).msgSize; + ans->port=gras_rawsock_get_peer_port(rawIn); + // fprintf(stderr,"grasbw_cbHandshake. bufSize=%d expSize=%d msgSize=%d port=%d\n", + // ans->bufSize,ans->expSize,ans->msgSize,ans->port); + + if ((errcode=gras_msg_new_and_send(msg->sock,GRASMSG_BW_HANDSHAKED, 1, + ans, 1))) { + fprintf(stderr,"grasbw_cbHandshake(): Error %s encountered while sending the answer.\n", + gras_error_name(errcode)); + gras_rawsock_close(rawIn); + gras_rawsock_close(rawOut); + return 1; + } + + if ((errcode=gras_rawsock_recv(rawIn, + gras_msg_ctn(msg,0,0,BwExp_t).expSize, + gras_msg_ctn(msg,0,0,BwExp_t).msgSize, + 120)) || + (errcode=gras_rawsock_send(rawOut,1,1))) { + fprintf(stderr,"grasbw_cbHandshake(): Error %s encountered while receiving the experiment.\n", + gras_error_name(errcode)); + gras_rawsock_close(rawIn); + gras_rawsock_close(rawOut); + return 1; + } + gras_msg_free(msg); + gras_rawsock_close(rawIn); + gras_rawsock_close(rawOut); + return 1; +} + +/* function to request a BW test between to external hosts */ +gras_error_t grasbw_request(const char* from_name,unsigned int from_port, + const char* to_name,unsigned int to_port, + unsigned int bufSize,unsigned int expSize,unsigned int msgSize, + /*OUT*/ double *sec, double*bw) { + + gras_sock_t *sock; + gras_msg_t *answer; + gras_error_t errcode; + /* The request */ + BwExp_t *request; + msgHost_t *target; + + if((errcode=gras_sock_client_open(from_name,from_port,&sock))) { + fprintf(stderr,"grasbw_request(): Error %s encountered while contacting the actuator\n", + gras_error_name(errcode)); + return errcode; + } + if (!(request=(BwExp_t *)malloc(sizeof(BwExp_t))) || + !(target=(msgHost_t*)malloc(sizeof(msgHost_t)))) { + fprintf(stderr,"grasbw_test(): Malloc error\n"); + gras_sock_close(sock); + return malloc_error; + } + + request->bufSize=bufSize; + request->expSize=expSize; + request->msgSize=msgSize; + strcpy(target->host,to_name); + target->port=to_port; + + if ((errcode=gras_msg_new_and_send(sock,GRASMSG_BW_REQUEST, 2, + target,1, + request,1))) { + fprintf(stderr,"grasbw_request(): Error %s encountered while sending the request.\n", + gras_error_name(errcode)); + gras_sock_close(sock); + return errcode; + } + if ((errcode=gras_msg_wait(240,GRASMSG_BW_RESULT,&answer))) { + fprintf(stderr,"grasbw_request(): Error %s encountered while waiting for the answer.\n", + gras_error_name(errcode)); + gras_sock_close(sock); + return errcode; + } + + if((errcode=gras_msg_ctn(answer,0,0,msgError_t).errcode)) { + fprintf(stderr,"grasbw_request(): Peer reported error %s (%s).\n", + gras_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg); + gras_msg_free(answer); + gras_sock_close(sock); + return errcode; + } + + // fprintf(stderr,"sec=%p",gras_msg_ctn(answer,1,0,msgResult_t)); + *sec=gras_msg_ctn(answer,1,0,msgResult_t).value; + *bw=gras_msg_ctn(answer,1,1,msgResult_t).value; + + gras_msg_free(answer); + gras_sock_close(sock); + return no_error; +} + +int grasbw_cbBWRequest(gras_msg_t *msg) { + /* specification of the test to run */ + char* to_name=gras_msg_ctn(msg,0,0,msgHost_t).host; + unsigned int to_port=gras_msg_ctn(msg,0,0,msgHost_t).port; + + unsigned int bufSize=gras_msg_ctn(msg,1,0,BwExp_t).bufSize; + unsigned int expSize=gras_msg_ctn(msg,1,0,BwExp_t).expSize; + unsigned int msgSize=gras_msg_ctn(msg,1,0,BwExp_t).msgSize; + /* our answer */ + msgError_t *error; + msgResult_t *res; + + if (!(error=(msgError_t *)malloc(sizeof(msgError_t))) || + !(res=(msgResult_t *)malloc(sizeof(msgResult_t) * 2))) { + fprintf(stderr,"%s:%d:grasbw_cbRequest: Malloc error\n",__FILE__,__LINE__); + return malloc_error; + } + + if ((error->errcode=grasbw_test(to_name,to_port,bufSize,expSize,msgSize, + &(res[0].value),&(res[1].value) ))) { + fprintf(stderr, + "%s:%d:grasbw_cbRequest: Error %s encountered while doing the test\n", + __FILE__,__LINE__,gras_error_name(error->errcode)); + strncpy(error->errmsg,"Error within grasbw_test",ERRMSG_LEN); + gras_msg_new_and_send(msg->sock,GRASMSG_BW_RESULT,2, + error,1, + res,2); + return 1; + } + res[0].timestamp = (unsigned int) gras_time(); + res[1].timestamp = (unsigned int) gras_time(); + gras_msg_new_and_send(msg->sock,GRASMSG_BW_RESULT,2, + error,1, + res,2); + gras_msg_free(msg); + return 1; +} + +/* *************************************************************************** + * Link saturation + * ***************************************************************************/ + +gras_error_t grasbw_saturate_start(const char* from_name,unsigned int from_port, + const char* to_name,unsigned int to_port, + unsigned int msgSize, unsigned int timeout) { + gras_sock_t *sock; + gras_error_t errcode; + /* The request */ + SatExp_t *request; + msgHost_t *target; + /* answer */ + gras_msg_t *answer; + + if((errcode=gras_sock_client_open(from_name,from_port,&sock))) { + fprintf(stderr,"%s:%d:saturate_start(): Error %s encountered while contacting peer\n", + __FILE__,__LINE__,gras_error_name(errcode)); + return errcode; + } + if (!(request=(SatExp_t *)malloc(sizeof(SatExp_t))) || + !(target=(msgHost_t*)malloc(sizeof(msgHost_t)))) { + fprintf(stderr,"%s:%d:saturate_start(): Malloc error\n",__FILE__,__LINE__); + gras_sock_close(sock); + return malloc_error; + } + + request->timeout=timeout; + request->msgSize=msgSize; + + strcpy(target->host,to_name); + target->port=to_port; + + if ((errcode=gras_msg_new_and_send(sock,GRASMSG_SAT_START, 2, + target,1, + request,1))) { + fprintf(stderr,"%s:%d:saturate_start(): Error %s encountered while sending the request.\n", + __FILE__,__LINE__,gras_error_name(errcode)); + gras_sock_close(sock); + return errcode; + } + if ((errcode=gras_msg_wait(120,GRASMSG_SAT_STARTED,&answer))) { + fprintf(stderr,"%s:%d:saturate_start(): Error %s encountered while waiting for the ACK.\n", + __FILE__,__LINE__,gras_error_name(errcode)); + gras_sock_close(sock); + return errcode; + } + + if((errcode=gras_msg_ctn(answer,0,0,msgError_t).errcode)) { + fprintf(stderr,"%s:%d:saturate_start(): Peer reported error %s (%s).\n", + __FILE__,__LINE__,gras_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg); + gras_msg_free(answer); + gras_sock_close(sock); + return errcode; + } + + gras_msg_free(answer); + gras_sock_close(sock); + return no_error; +} + +int grasbw_cbSatStart(gras_msg_t *msg) { + gras_rawsock_t *raw; + gras_sock_t *sock; + gras_error_t errcode; + double start; /* time to timeout */ + + /* specification of the test to run */ + char* to_name=gras_msg_ctn(msg,0,0,msgHost_t).host; + unsigned int to_port=gras_msg_ctn(msg,0,0,msgHost_t).port; + + unsigned int msgSize=gras_msg_ctn(msg,1,0,SatExp_t).msgSize; + unsigned int timeout=gras_msg_ctn(msg,1,0,SatExp_t).timeout; + unsigned int raw_port; + + /* The request */ + SatExp_t *request; + /* answer */ + gras_msg_t *answer; + + /* + fprintf(stderr,"grasbw_cbSatStart(sd=%p)\n",msg->sock); + fprintf(stderr,"(server=%d,raw=%d,fromPID=%d,toPID=%d,toHost=%p,toPort=%d,toChan=%d)\n", + msg->sock->server_sock,msg->sock->raw_sock,msg->sock->from_PID, + msg->sock->to_PID,msg->sock->to_host,msg->sock->to_port,msg->sock->to_chan); + */ + + /* Negociate the saturation with the peer */ + if((errcode=gras_sock_client_open(to_name,to_port,&sock))) { + fprintf(stderr,"cbSatStart(): Error %s encountered while contacting peer\n", + gras_error_name(errcode)); + grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1, + "cbSatStart: Severe error: Cannot send error status to requester!!\n", + errcode,"Cannot contact peer.\n"); + return 1; + } + if (!(request=(SatExp_t *)malloc(sizeof(SatExp_t)))) { + fprintf(stderr,"cbSatStart(): Malloc error\n"); + gras_sock_close(sock); + grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1, + "cbSatStart: Severe error: Cannot send error status to requester!!\n", + malloc_error,"Cannot build request.\n"); + return 1; + } + + request->timeout=gras_msg_ctn(msg,1,0,SatExp_t).timeout; + request->msgSize=gras_msg_ctn(msg,1,0,SatExp_t).msgSize; + + if ((errcode=gras_msg_new_and_send(sock,GRASMSG_SAT_BEGIN, 1, + request,1))) { + fprintf(stderr,"cbSatStart(): Error %s encountered while sending the request.\n", + gras_error_name(errcode)); + grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1, + "cbSatStart: Severe error: Cannot send error status to requester!!\n", + errcode,"Cannot send request.\n"); + gras_sock_close(sock); + return 1; + } + + if ((errcode=gras_msg_wait(120,GRASMSG_SAT_BEGUN,&answer))) { + fprintf(stderr,"cbSatStart(): Error %s encountered while waiting for the ACK.\n", + gras_error_name(errcode)); + gras_sock_close(sock); + + grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1, + "cbSatStart: Severe error: Cannot send error status to requester!!\n", + errcode, + "Cannot receive the ACK.\n"); + return 1; + } + + if((errcode=gras_msg_ctn(answer,0,0,msgError_t).errcode)) { + fprintf(stderr,"cbSatStart(): Peer reported error %s (%s).\n", + gras_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg); + + grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1, + "cbSatStart: Severe error: Cannot send error status to requester!!\n", + errcode, + "Peer repported '%s'.\n",gras_msg_ctn(answer,0,0,msgError_t).errmsg); + gras_msg_free(answer); + gras_sock_close(sock); + return 1; + } + + raw_port=gras_msg_ctn(answer,1,0,SatExp_t).port; + + if ((errcode=gras_rawsock_client_open(to_name,raw_port,msgSize,&raw))) { + fprintf(stderr,"cbSatStart(): Error %s while opening raw socket to %s:%d.\n", + gras_error_name(errcode),to_name,gras_msg_ctn(answer,1,0,SatExp_t).port); + + grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1, + "cbSatStart: Severe error: Cannot send error status to requester!!\n", + errcode,"Cannot open raw socket.\n"); + gras_sock_close(sock); + return 1; + } + + /* send a train of data before repporting that XP is started */ + if ((errcode=gras_rawsock_send(raw,msgSize,msgSize))) { + fprintf(stderr,"cbSatStart: Failure %s during raw send\n",gras_error_name(errcode)); + grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1, + "cbSatStart: Severe error: Cannot send error status to requester!!\n", + errcode,"Cannot raw send.\n"); + gras_sock_close(sock); + gras_rawsock_close(raw); + return 1; + } + + grasRepportError(msg->sock,GRASMSG_SAT_STARTED,1, + "cbSatStart: Severe error: Cannot send error status to requester!!\n", + no_error,"Saturation started"); + gras_msg_free(answer); + gras_msg_free(msg); + + /* Do the saturation until we get a SAT_STOP message or until we timeout the whole XP*/ + start=gras_time(); + while (gras_msg_wait(0,GRASMSG_SAT_STOP,&msg)==timeout_error && + gras_time()-start < timeout) { + if ((errcode=gras_rawsock_send(raw,msgSize,msgSize))) { + fprintf(stderr,"cbSatStart: Failure %s during raw send\n",gras_error_name(errcode)); + /* our error message do not interess anyone. SAT_STOP will do nothing. */ + gras_sock_close(sock); + gras_rawsock_close(raw); + return 1; + } + } + if (gras_time()-start > timeout) { + fprintf(stderr,"The saturation experiment did timeout. Stop it NOW\n"); + gras_sock_close(sock); + gras_rawsock_close(raw); + return 1; + } + + /* Handle the SAT_STOP which broke the previous while */ + + if ((errcode=gras_msg_new_and_send(sock, GRASMSG_SAT_END,0))) { + fprintf(stderr,"cbSatStart(): Cannot tell peer to stop saturation\n"); + + grasRepportError(msg->sock,GRASMSG_SAT_STOPPED,1, + "cbSatStart: Severe error: Cannot send error status to requester!!\n", + errcode,"Sending SAT_END to peer failed.\n"); + gras_sock_close(sock); + gras_rawsock_close(raw); + return 1; + } + + if ((errcode=gras_msg_wait(60,GRASMSG_SAT_ENDED,&answer))) { + fprintf(stderr,"cbSatStart(): Peer didn't ACK the end\n"); + + grasRepportError(msg->sock,GRASMSG_SAT_STOPPED,1, + "cbSatStart: Severe error: Cannot send error status to requester!!\n", + errcode,"Receiving SAT_ENDED from peer failed.\n"); + gras_sock_close(sock); + gras_rawsock_close(raw); + return 1; + } + grasRepportError(msg->sock,GRASMSG_SAT_STOPPED,1, + "cbSatStart: Severe error: Cannot send error status to requester!!\n", + no_error,""); + + gras_sock_close(sock); + gras_rawsock_close(raw); + gras_msg_free(answer); + gras_msg_free(msg); + + return 1; +} + +int grasbw_cbSatBegin(gras_msg_t *msg) { + gras_rawsock_t *raw; + gras_error_t errcode; + double start; /* timer */ + /* request */ + unsigned int msgSize=gras_msg_ctn(msg,0,0,SatExp_t).msgSize; + unsigned int timeout=gras_msg_ctn(msg,0,0,SatExp_t).timeout; + /* answer */ + SatExp_t *request; + msgError_t *error; + + if (!(request=(SatExp_t*)malloc(sizeof(SatExp_t))) || + !(error=(msgError_t *)malloc(sizeof(msgError_t)))) { + fprintf(stderr,"cbSatBegin(): Malloc error\n"); + grasRepportError(msg->sock,GRASMSG_SAT_BEGUN,2, + "cbSatBegin: Severe error: Cannot send error status to requester!!\n", + malloc_error,"Malloc error"); + return 1; + } + + if ((errcode=gras_rawsock_server_open(6666,8000,msgSize,&raw))) { + fprintf(stderr,"cbSatBegin(): Error %s encountered while opening a raw socket\n", + gras_error_name(errcode)); + grasRepportError(msg->sock,GRASMSG_SAT_BEGUN,2, + "cbSatBegin: Severe error: Cannot send error status to requester!!\n", + errcode,"Cannot open raw socket"); + return 1; + } + request->port=gras_rawsock_get_peer_port(raw); + request->msgSize=msgSize; + error->errcode=no_error; + error->errmsg[0]='\0'; + if ((errcode=gras_msg_new_and_send(msg->sock,GRASMSG_SAT_BEGUN,2, + error,1, + request,1))) { + fprintf(stderr,"cbSatBegin(): Error %s encountered while send ACK to peer\n", + gras_error_name(errcode)); + return 1; + } + gras_msg_free(msg); + + start=gras_time(); + while (gras_msg_wait(0,GRASMSG_SAT_END,&msg)==timeout_error && + gras_time() - start < timeout) { + errcode=gras_rawsock_recv(raw,msgSize,msgSize,1); + if (errcode != timeout_error && errcode != no_error) { + fprintf(stderr,"cbSatBegin: Failure %s during raw receive\n",gras_error_name(errcode)); + /* our error message do not interess anyone. SAT_END will do nothing. */ + /* (if timeout'ed, it may be because the sender stopped emission. so survive it) */ + return 1; + } + } + if (gras_time()-start > timeout) { + fprintf(stderr,"The saturation experiment did timeout. Stop it NOW.\n"); + gras_rawsock_close(raw); + return 1; + } + + grasRepportError(msg->sock,GRASMSG_SAT_ENDED,1, + "cbSatBegin: Cannot send SAT_ENDED.\n", + no_error,""); + gras_rawsock_close(raw); + gras_msg_free(msg); + return 1; +} + +gras_error_t grasbw_saturate_stop(const char* from_name,unsigned int from_port, + const char* to_name,unsigned int to_port) { + gras_error_t errcode; + gras_sock_t *sock; + gras_msg_t *answer; + + if((errcode=gras_sock_client_open(from_name,from_port,&sock))) { + fprintf(stderr,"saturate_stop(): Error %s encountered while contacting peer\n", + gras_error_name(errcode)); + return errcode; + } + + if ((errcode=gras_msg_new_and_send(sock,GRASMSG_SAT_STOP,0))) { + fprintf(stderr,"saturate_stop(): Error %s encountered while sending request\n", + gras_error_name(errcode)); + gras_sock_close(sock); + return errcode; + } + + if ((errcode=gras_msg_wait(120,GRASMSG_SAT_STOPPED,&answer))) { + fprintf(stderr,"saturate_stop(): Error %s encountered while receiving ACK\n", + gras_error_name(errcode)); + gras_sock_close(sock); + return errcode; + } + + if((errcode=gras_msg_ctn(answer,0,0,msgError_t).errcode)) { + fprintf(stderr,"saturate_stop(): Peer reported error %s (%s).\n", + gras_error_name(errcode),gras_msg_ctn(answer,0,0,msgError_t).errmsg); + gras_msg_free(answer); + gras_sock_close(sock); + return errcode; + } + + gras_msg_free(answer); + gras_sock_close(sock); + + return no_error; +} diff --git a/src/amok/base.c b/src/amok/base.c new file mode 100644 index 0000000000..8278bb62b5 --- /dev/null +++ b/src/amok/base.c @@ -0,0 +1,38 @@ +/* $Id$ */ + +/* gras_addons - several addons to do specific stuff not in GRAS itself */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#include +#include + +#include + +void +grasRepportError (gras_sock_t *sock, gras_msgid_t id, int SeqCount, + const char *severeError, + gras_error_t errcode, const char* format,...) { + msgError_t *error; + va_list ap; + + if (!(error=(msgError_t*)malloc(sizeof(msgError_t)))) { + fprintf(stderr,severeError); + return; + } + + error->errcode=errcode; + va_start(ap,format); + vsprintf(error->errmsg,format,ap); + va_end(ap); + + /* FIXME: If message id have more than 17 sequences, the following won't work */ + if (gras_msg_new_and_send(sock,id,SeqCount, error,1,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0, + NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0,NULL,0)) { + fprintf(stderr,severeError); + } +} diff --git a/src/gras/.cvsignore b/src/gras/.cvsignore new file mode 100644 index 0000000000..155be66bd3 --- /dev/null +++ b/src/gras/.cvsignore @@ -0,0 +1 @@ +.deps .libs Makefile Makefile.in dict_usage dict_crash dynar_int dynar_double dynar_string diff --git a/src/gras/Common/gras.c b/src/gras/Common/gras.c new file mode 100644 index 0000000000..cfa9d34ecd --- /dev/null +++ b/src/gras/Common/gras.c @@ -0,0 +1,111 @@ +/* $Id$ */ + +/* gras.c - common parts for the Grid Reality And Simulation */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#include "gras_private.h" + +/**************************************************************************/ +/**************************************************************************/ +/* Lock handling */ +/**************************************************************************/ +/**************************************************************************/ + +#ifdef HAVE_LIBPTHREAD +#include + +/* this is the lock for this module. Every other module will use a void * + * as a variable as mutex. */ +pthread_mutex_t gras_thelock = PTHREAD_MUTEX_INITIALIZER; +#endif + +int +gras_lock() { + //fprintf(stderr,"Get Lock... "); +#ifdef HAVE_LIBPTHREAD + int ret; + + ret = pthread_mutex_lock((pthread_mutex_t *)(&gras_thelock)); + if (ret != 0) { + fprintf(stderr, "gras_lock: Unable to lock (errno = %d)!\n", ret); + return 0; + } +#endif + //fprintf(stderr,"ok\n"); + return 1; +} + +int +gras_unlock() { + + // fprintf(stderr,"Release Lock... "); +#ifdef HAVE_LIBPTHREAD + int ret; + + ret = pthread_mutex_unlock((pthread_mutex_t *)&gras_thelock); + if (ret != 0) { + fprintf(stderr, "grasReleaseLock: Unable to release lock (errno = %d)!\n", ret); + return 0; + } +#endif + //fprintf(stderr,"ok\n"); + return 1; +} + +/* ************************************************************************** + * Manipulating Callback list + * **************************************************************************/ +gras_cblist_t *gras_cb_get(gras_msgid_t id) { + grasProcessData_t *pd=grasProcessDataGet(); + int i; + + for (i=0 ; igrasCblListLen && pd->grasCblList[i].id != id ; i++); + return i==pd->grasCblListLen ? NULL : &(pd->grasCblList[i]); +} + +gras_error_t gras_cb_create(gras_msgid_t message) { + grasProcessData_t *pd=grasProcessDataGet(); + + if (pd->grasCblListLen++) { + pd->grasCblList = (gras_cblist_t *)realloc(pd->grasCblList, + sizeof(gras_cblist_t)*pd->grasCblListLen); + } else { + pd->grasCblList = (gras_cblist_t *)malloc(sizeof(gras_cblist_t)* + pd->grasCblListLen); + } + if (!pd->grasCblList) { + fprintf(stderr,"PANIC: Malloc error (All callbacks for all hosts are lost)\n"); + pd->grasCblListLen=0; + return malloc_error; + } + + pd->grasCblList[pd->grasCblListLen-1].id=message; + + pd->grasCblList[pd->grasCblListLen-1].cbCount=0; + pd->grasCblList[pd->grasCblListLen-1].cb=NULL; + pd->grasCblList[pd->grasCblListLen-1].cbTTL=NULL; + + return no_error; +} + +/* ************************************************************************** + * Manipulating User Data + * **************************************************************************/ +void *gras_userdata_get(void) { + grasProcessData_t *pd=grasProcessDataGet(); + + return pd ? pd->userdata : NULL; +} + +void *gras_userdata_set(void *ud) { + grasProcessData_t *pd=grasProcessDataGet(); + + ASSERT(pd,"ProcessData==NULL => This process did not run grasInit()\n"); + return pd->userdata=ud; +} + diff --git a/src/gras/Common/gras_datadesc.c b/src/gras/Common/gras_datadesc.c new file mode 100644 index 0000000000..18e13a8627 --- /dev/null +++ b/src/gras/Common/gras_datadesc.c @@ -0,0 +1,82 @@ +/* $Id$ */ + +/* gras_datadesc.c - manipulating datadescriptors */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#include "gras_private.h" + +void *gras_datadesc_copy_data(const DataDescriptor *dd, unsigned int c, + void *data) { + size_t s=DataSize(dd,c,HOST_FORMAT); + void *res=malloc(s); + + if (!res) { + fprintf(stderr,"grasDataDescCpyData: malloc of %d bytes failed.\n",s); + return NULL; + } + + memcpy(res,data,s); + + return data; +} + +int gras_datadesc_cmp(const DataDescriptor *dd1, unsigned int c1, + const DataDescriptor *dd2, unsigned int c2) { + unsigned int i; + int subcmp; + + if (c1 != c2) + return c1 < c2; + + if (!dd1 && !dd2) return 0; + if (!dd1 || !dd2) return 1; + + for (i=0;i + +/*@null@*/static gras_msgentry_t *grasMsgList = NULL; +static unsigned int grasMsgCount = 0; + +/** + * Register a new message type to the system + */ + +gras_error_t +gras_msgtype_register(gras_msgid_t message, + const char *name, + int sequence_count, + ...) { + gras_msgentry_t *entry=grasMsgEntryGet(message); + gras_cblist_t *cbl=gras_cb_get(message); + int i; + DataDescriptor *dd; + size_t ddCount; + va_list ap; + + // fprintf(stderr,"Register message '%s' under ID %d. Sequence count=%d\n", + //name,(int)message,sequence_count); + + if (entry) { /* Check that it's the same entry re-registered */ + if (strcmp(name,entry->name)) { + fprintf(stderr,"Second registration of message %d with another name. (old=%s,new=%s)\n", + (int)message,entry->name,name); + return malloc_error; + } + if (sequence_count != entry->seqCount) { + fprintf(stderr, + "Second registration of message %s with another sequence count. (old=%d,new=%d)\n", + entry->name,entry->seqCount,sequence_count); + return mismatch_error; + } + + va_start(ap, sequence_count); + for (i=0;iddCount[i]) { + fprintf(stderr, + "Different re-registration of message %s: DataDescriptor count is different in sequence %d (is %d, was %d)\n", + entry->name, i, ddCount, entry->ddCount[i]); + return sanity_error; + } + if (gras_datadesc_cmp(dd,ddCount, entry->dd[i],ddCount)) { + fprintf(stderr, + "Different re-registration of message %s: DataDescriptor of sequence %d is different\n", + entry->name, i); + return sanity_error; + } + } + va_end(ap); + + } else { /* build a new entry */ + if (grasMsgCount++) { + grasMsgList = (gras_msgentry_t *)realloc(grasMsgList,sizeof(gras_msgentry_t)*grasMsgCount); + } else { + grasMsgList = (gras_msgentry_t *)malloc(sizeof(gras_msgentry_t)*grasMsgCount); + } + if (!grasMsgList) { + fprintf(stderr, "PANIC: memory allocation of %d bytes in gras_msgtype_register() failed (Message table LOST).\n", + sizeof(gras_msgentry_t)*grasMsgCount); + grasMsgCount=0; + return malloc_error; + } + entry = &(grasMsgList[grasMsgCount-1]); + + entry->id = message; + if (!(entry->name = strdup(name))) { + fprintf(stderr, "gras_msgtype_register: memory allocation failed.\n"); + grasMsgCount--; + return malloc_error; + } + entry->seqCount = sequence_count; + if (sequence_count) { + if (!(entry->dd = (DataDescriptor**)malloc(sizeof(DataDescriptor*)*sequence_count))) { + fprintf(stderr, "gras_msgtype_register: memory allocation of %d bytes failed.\n", + sizeof(DataDescriptor*)*sequence_count); + free(entry->name); + grasMsgCount--; + return malloc_error; + } + if (!(entry->ddCount = (size_t*)malloc(sizeof(size_t)*sequence_count))) { + fprintf(stderr, "gras_msgtype_register: memory allocation of %d bytes failed.\n", + sizeof(size_t)*sequence_count); + free(entry->dd); + free(entry->name); + grasMsgCount--; + return malloc_error; + } + } else { + entry->dd=NULL; + entry->ddCount=NULL; + } + va_start(ap, sequence_count); + for (i=0;iddCount[i]=ddCount; + if (ddCount) { + if (!(entry->dd[i] = (DataDescriptor*)malloc(sizeof(DataDescriptor)*ddCount))) { + fprintf(stderr, "gras_msgtype_register: memory allocation of %d bytes failed.\n", + sizeof(DataDescriptor)*ddCount); + for (i--;i>=0;i--) free(entry->dd[i]); + free(entry->ddCount); + free(entry->dd); + free(entry->name); + grasMsgCount--; + return malloc_error; + } + } else { + entry->dd[i]=NULL; + } + memcpy(entry->dd[i],dd,sizeof(DataDescriptor)*ddCount); + } + va_end(ap); + } + if (cbl) { + fprintf(stderr,"Warning, message type %s registered twice on this host\n", + entry->name); + } else { + return gras_cb_create(entry->id); + } + + return no_error; +} + +/* + * Retrieve the entry associated with a message id + */ +gras_msgentry_t * +grasMsgEntryGet(gras_msgid_t id) { + int i; + + for (i=0 ; iversion,0,sizeof(res->version)); + strcpy(res->version,GRASVERSION); + res->message = msgId; + res->dataSize = dataSize; + res->seqCount = seqCount; + + return res; +} + +gras_msg_t *gras_msg_new_va(gras_msgid_t msgId, + e_gras_free_directive_t free_data, + int seqCount, + va_list ap) { + gras_msg_t *res; + int i; + unsigned int networkSize=0; + + /* malloc the needed room, and sanity check */ + if (!(res=(gras_msg_t*)malloc(sizeof(gras_msg_t)))) { + fprintf(stderr,"gras_msg_new(): Malloc error (wanted %d bytes)\n",sizeof(gras_msg_t)); + return NULL; + } + res->freeDirective=free_data; + + if (!(res->entry=grasMsgEntryGet(msgId))) { + fprintf(stderr,"gras_msg_new(): unknown msg id %d\n",msgId); + free(res); + return NULL; + } + if (res->entry->seqCount != seqCount) { + fprintf(stderr,"Damnit: you passed %d sequences to build a %s msg, where %d were expected\n", + seqCount,res->entry->name,res->entry->seqCount); + free(res); + return NULL; + } + if (seqCount) { + if (!(res->dataCount=(unsigned int*)malloc(sizeof(unsigned int)*seqCount))) { + fprintf(stderr,"gras_msg_new(): Malloc error (wanted %d bytes)\n", + (sizeof(unsigned int)*seqCount)); + free(res); + return NULL; + } + if (!(res->data=(void**)malloc(sizeof(void*)*seqCount))) { + fprintf(stderr,"gras_msg_new(): Malloc error (wanted %d bytes)\n", + (sizeof(void*)*seqCount)); + free(res->dataCount); + free(res); + return NULL; + } + } else { + res->dataCount = NULL; + res->data = NULL; + } + + /* populate the message */ + networkSize += DataSize(headerDescriptor,headerDescriptorCount,NETWORK_FORMAT); + networkSize += DataSize(countDescriptor,countDescriptorCount,NETWORK_FORMAT) * seqCount; + + for (i=0; idata[i]=va_arg(ap, void*); + res->dataCount[i]=va_arg(ap, int); + if (res->dataCount[i] > 1000) { + fprintf(stderr,"GRAS WARNING: datacount>1000 in a message. You may want to check the arguments passed to gras_msg_new().\n"); + } + if (res->dataCount[i] < 0) { + fprintf(stderr,"GRAS ERROR: datacount<0 in a message. Check the arguments passed to gras_msg_new().\n"); + free(res->dataCount); + free(res->data); + free(res); + return NULL; + } + + networkSize += res->dataCount[i] * + DataSize(res->entry->dd[i],res->entry->ddCount[i],NETWORK_FORMAT); + } + + /* finish filling the fields */ + if (!(res->header=grasMsgHeaderNew(msgId,networkSize,seqCount))) { + free(res->data); + free(res->dataCount); + free(res); + return NULL; + } + res->sock=NULL; + return res; +} + +gras_msg_t *gras_msg_new(gras_msgid_t msgId, + e_gras_free_directive_t free_data, + int seqCount, + ...) { + gras_msg_t *res; + va_list ap; + + va_start(ap, seqCount); + res=gras_msg_new_va(msgId,free_data,seqCount,ap); + va_end(ap); + + return res; +} + +gras_error_t +gras_msg_new_and_send(gras_sock_t *sd, + gras_msgid_t msgId, + int seqCount, + ...) { + + gras_msg_t *msg; + va_list ap; + + va_start(ap, seqCount); + msg=gras_msg_new_va(msgId,free_after_use,seqCount,ap); + va_end(ap); + if (!msg) return unknown_error; + + return gras_msg_send(sd,msg,free_after_use); +} + + +gras_msg_t *gras_msg_copy(gras_msg_t *msg) { + gras_msg_t *res; + int i; + + fprintf(stderr,"gras_msg_copy: \n"); + + /* malloc the needed room, and sanity check */ + if (!(res=(gras_msg_t*)malloc(sizeof(gras_msg_t)))) { + fprintf(stderr,"gras_msg_new(): Malloc error (wanted %d bytes)\n",sizeof(gras_msg_t)); + return NULL; + } + res->freeDirective=free_after_use; + res->entry=msg->entry; + + if (!(res->dataCount=(unsigned int*)malloc(sizeof(unsigned int)*res->entry->seqCount))) { + fprintf(stderr,"gras_msg_new(): Malloc error (wanted %d bytes)\n", + (sizeof(unsigned int)*res->entry->seqCount)); + free(res); + return NULL; + } + if (!(res->data=(void**)malloc(sizeof(void*)*res->entry->seqCount))) { + fprintf(stderr,"gras_msg_new(): Malloc error (wanted %d bytes)\n", + (sizeof(void*)*res->entry->seqCount)); + free(res->dataCount); + free(res); + return NULL; + } + + /* populate the message */ + for (i=0; ientry->seqCount; i++) { + res->data[i]= gras_datadesc_copy_data(msg->entry->dd[i],msg->entry->ddCount[i],res->data[i]); + res->dataCount[i]=msg->dataCount[i]; + } + + /* finish filling the fields */ + if (!(res->header=grasMsgHeaderNew(msg->header->message, + msg->header->dataSize, + msg->header->seqCount))) { + free(res->data); + free(res->dataCount); + free(res); + return NULL; + } + res->sock=msg->sock; + + return res; +} + + +void gras_msg_free(gras_msg_t *msg) { + int i; + + if (!msg) return; + if (msg->freeDirective == free_after_use) + for (i=0; ientry->seqCount; i++) + free(msg->data[i]); + gras_sock_close(msg->sock); + free(msg->header); + // data isn't copied by MsgNew + free (msg->data); + free (msg->dataCount); + free (msg); +} + +gras_error_t gras_msg_handle(double timeOut) { + grasProcessData_t *pd=grasProcessDataGet(); + int i; + gras_error_t errcode; + gras_msg_t *msg; + gras_cblist_t *cbl; + + if (pd->grasMsgQueueLen) { + /* handle queued message */ + + msg = pd->grasMsgQueue[0]; + memmove(pd->grasMsgQueue[0],pd->grasMsgQueue[1],(pd->grasMsgQueueLen-1)*sizeof(gras_msg_t)); + pd->grasMsgQueueLen--; + if (pd->grasMsgQueueLen == 0) { + /* size reached 0. Free the queue so that the next enlargement (with malloc) don't leak*/ + free(pd->grasMsgQueue); + /* if size!=0 don't loose the time to realloc to only gain 4 bytes */ + } + fprintf(stderr,"%s:%d: gras_msg_handle: The message was queued\n",__FILE__,__LINE__); + return no_error; + } else { + /* receive a message from the net */ + if ((errcode=grasMsgRecv(&msg,timeOut))) { + if (errcode == timeout_error) { + return no_error; + } else { + fprintf(stderr,"gras_msg_handle: error '%s' while receiving\n",gras_error_name(errcode)); + return errcode; + } + } + } + + /* + fprintf(stderr,"GRAS: Handle an incomming message '%s' (datasize=%d, sd=%p)\n", + msg->entry->name,msg->header->dataSize,msg->sock); + */ + + if (!(cbl=gras_cb_get(msg->entry->id))) { + fprintf(stderr,"Message %s is not registered on this host.\n", + msg->entry->name); + gras_msg_free(msg); + return mismatch_error; + } + + for (i = cbl->cbCount - 1; i>=0 ; i--) { + if ((*(cbl->cb[i]))(msg)) { + // if (cbl->cbTTL[i] > 0 && (!--(cbl->cbTTL[i]))) { + //fprintf(stderr,"GRAS FIXME: Remove the callback from the queue after use if needed.\n"); + //} + break; + } + } + + if (i<0) { + fprintf(stderr, + "No callback of msg type %s accepts this message. Discarding it\n", + msg->entry->name); + gras_msg_free(msg); + return mismatch_error; + } + return no_error; +} + +gras_error_t +gras_msg_wait(double timeOut, + gras_msgid_t id, + gras_msg_t **message) { + int i; + gras_error_t errcode; + double start,now; + gras_msgentry_t *entry=grasMsgEntryGet(id); + grasProcessData_t *pd=grasProcessDataGet(); + + if (!entry) { + fprintf(stderr,"gras_msg_wait: message id %d is not registered\n",id); + return mismatch_error; + } + + *message = NULL; + start=now=gras_time(); + + for (i=0;igrasMsgQueueLen;i++) { + if (pd->grasMsgQueue[i]->header->message == id) { + *message = pd->grasMsgQueue[i]; + memmove(pd->grasMsgQueue[i],pd->grasMsgQueue[i+1],(pd->grasMsgQueueLen-i-1)*sizeof(gras_msg_t)); + pd->grasMsgQueueLen--; + if (pd->grasMsgQueueLen == 0) { + /* size reached 0. Free the queue so that the next enlargement (with malloc) don't leak*/ + free(pd->grasMsgQueue); + /* if size!=0 don't loose the time to realloc to only gain 4 bytes */ + } + fprintf(stderr,"%s:%d: gras_msg_wait: The message was queued\n",__FILE__,__LINE__); + return no_error; + } + } + + while (1) { + if ((errcode=grasMsgRecv(message,timeOut))) { + if (errcode != timeout_error) + fprintf(stderr,"gras_msg_wait: error '%s' while receiving\n",gras_error_name(errcode)); + return errcode; + } + + if ((*message)->header->message != id) { + fprintf(stderr,"gras_msg_wait: Got message %s while waiting for message %s. Queue it.\n", + (*message)->entry->name,entry->name); + if (pd->grasMsgQueueLen++) { + pd->grasMsgQueue = (gras_msg_t **)realloc(pd->grasMsgQueue, + sizeof(gras_msg_t)*pd->grasMsgQueueLen); + } else { + pd->grasMsgQueue = (gras_msg_t **)malloc(sizeof(gras_msg_t)*pd->grasMsgQueueLen); + } + if (!pd->grasMsgQueue) { + fprintf(stderr, "PANIC: memory allocation of %d bytes in gras_msg_wait() failed (Queued messages are LOST).\n", + sizeof(gras_msg_t)*pd->grasMsgQueueLen); + pd->grasMsgQueueLen=0; + return malloc_error; + } + pd->grasMsgQueue[pd->grasMsgQueueLen - 1] = *message; + *message=NULL; + } else { + // fprintf(stderr,"Waited for %s successfully\n",(*message)->entry->name); + return no_error; + } + now=gras_time(); + if (now - start + 0.001 < timeOut) + return timeout_error; + } +} + + +gras_error_t +gras_cb_register(gras_msgid_t message, + int TTL, + gras_cb_t cb) { + + gras_cblist_t *cbl=gras_cb_get(message); + + if (!cbl) { + fprintf(stderr,"Try to register a callback for an unregistered message id %d\n",message); + return sanity_error; + } + if (cbl->cbCount++) { + cbl->cb = (gras_cb_t *)realloc(cbl->cb, + sizeof(gras_cb_t)*cbl->cbCount); + cbl->cbTTL = (int *)realloc(cbl->cbTTL, sizeof(int)*cbl->cbCount); + } else { + cbl->cb = (gras_cb_t *)malloc(sizeof(gras_cb_t)*cbl->cbCount); + cbl->cbTTL = (int *)malloc( sizeof(int)*cbl->cbCount); + } + if (!cbl->cb || !cbl->cbTTL) { + fprintf(stderr,"gras_cb_register(): Malloc error (All callbacks for msg %d lost)\n", + message); + cbl->cb=NULL; + cbl->cbTTL=NULL; /* Yes, leaking here, but we're dead anyway */ + cbl->cbCount=0; + return malloc_error; + } + cbl->cb [ cbl->cbCount-1 ]=cb; + cbl->cbTTL[ cbl->cbCount-1 ]=TTL; + + return no_error; +} diff --git a/src/gras/Makefile.am b/src/gras/Makefile.am new file mode 100644 index 0000000000..40418e42f0 --- /dev/null +++ b/src/gras/Makefile.am @@ -0,0 +1,62 @@ +SUBDIRS=. Tests +DISTCLEANFILES=Makefile.in +INCLUDES= -I$(top_srcdir)/src/include -I../nws_portability/Include \ + @CFLAGS_XML@ @CFLAGS_SimGrid@ +EXTRA_DIST=gs/parse.yy.l + + +lib_LIBRARIES= libgrasrl.a libgrassg.a + +noinst_LIBRARIES=libgrasutils.a + +# core/dict_multi.c + +COMMON_S=\ + Common/gras.c Common/gras_datadesc.c Common/gras_msg.c \ + \ + core/log.c core/log_default_appender.c core/error.c \ + core/dynar.c \ + core/dict.c core/dict_elm.c core/dict_cursor.c \ + \ + core/config.c \ + \ + gs/datadesc.c \ + gs/tools.c \ + gs/categories.h \ + gs/connection.h \ + gs/sequence.h \ + gs/net_driver.c gs/net_driver.h \ + gs/net_driver_fd.c gs/net_interface_fd.h \ + gs/type_driver_rl.c gs/type_interface_rl.h \ + gs/type_driver.c gs/type_driver.h \ + gs/message.c gs/message.h \ + gs/type.c gs/type.h \ + gs/parse.c gs/parse.h gs/parse.yy.c \ + gs/vars.c + +gs/parse.yy.c: gs/parse.yy.l + flex -o$@ -Pgs_parse_ $^ + +COMMON_L=\ + $(foreach file,\ + diagnostic formatutil strutil osutil, \ + $(top_srcdir)/src/nws_portability/build-@host@/obj/$(file).o) + +libgrasutils_a_SOURCES = $(COMMON_S) Tests/gras_dummy.c +libgrasutils_a_LIBADD = $(COMMON_L) + + +libgrasrl_a_SOURCES= $(COMMON_S) RL/gras_rl.c RL/gras_rl.h +libgrasrl_a_LIBADD= \ + $(foreach file,\ + exp_smooth forc median mse_forc protocol \ + dnsutil fbuff forecast_api last_value run_mean timeouts, \ + $(top_srcdir)/src/nws_portability/build-@host@/obj/$(file).o) \ + $(COMMON_L) + + +libgrassg_a_SOURCES= $(COMMON_S) SG/gras_sg.c SG/gras_sg.h +libgrassg_a_LIBADD= \ + $(COMMON_L) + + diff --git a/src/gras/RL/gras_rl.c b/src/gras/RL/gras_rl.c new file mode 100644 index 0000000000..bb3729a0f6 --- /dev/null +++ b/src/gras/RL/gras_rl.c @@ -0,0 +1,753 @@ +/* $Id$ */ + +/* gras_rl - implementation of GRAS on real life */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#include "gras_rl.h" + +#include +#include + +#include /* sleep() */ + +#include +#include +#include /* struct in_addr */ +#include + + +/* NWS headers */ +#include "osutil.h" +#include "timeouts.h" +#include "protocol.h" + +GRAS_LOG_NEW_DEFAULT_CATEGORY(rl); + +/* globals */ +static grasProcessData_t *_grasProcessData; + +/* Prototypes of internal functions */ +static int grasConversionRequired(const DataDescriptor *description, size_t howMany); +static gras_error_t +_gras_rawsock_exchange(gras_rawsock_t *sd, int sender, unsigned int timeout, + unsigned int expSize, unsigned int msgSize); + + +gras_error_t gras_process_init() { + if (!(_grasProcessData=(grasProcessData_t *)malloc(sizeof(grasProcessData_t)))) { + fprintf(stderr,"gras_process_init: cannot malloc %d bytes\n",sizeof(grasProcessData_t)); + return malloc_error; + } + _grasProcessData->grasMsgQueueLen=0; + _grasProcessData->grasMsgQueue = NULL; + + _grasProcessData->grasCblListLen = 0; + _grasProcessData->grasCblList = NULL; + + _grasProcessData->userdata = NULL; + return no_error; +} +gras_error_t gras_process_finalize() { + fprintf(stderr,"FIXME: %s not implemented (=> leaking on exit :)\n",__FUNCTION__); + return no_error; +} + +/* ************************************************************************** + * Openning/Maintaining/Closing connexions + * **************************************************************************/ +gras_error_t +gras_sock_client_open(const char *host, short port, + /* OUT */ gras_sock_t **sock) { + + int addrCount; + IPAddress addresses[10]; + int i; + int sd; + + if (!(*sock=malloc(sizeof(gras_sock_t)))) { + fprintf(stderr,"Malloc error\n"); + return malloc_error; + } + (*sock)->peer_addr=NULL; + + if (!(addrCount = IPAddressValues(host, addresses, 10))) { + fprintf(stderr,"grasOpenClientSocket: address retrieval of '%s' failed\n",host); + return system_error; + } + + for(i = 0; i < addrCount && i<10 ; i++) { + if(CallAddr(addresses[i], port, &sd, -1)) { + (*sock)->sock = sd; + (*sock)->port = port; + return no_error; + } + } + free(*sock); + fprintf(stderr,"grasOpenClientSocket: something wicked happenned while connecting to %s:%d", + host,port); + return system_error; +} + + +gras_error_t +gras_sock_server_open(unsigned short startingPort, unsigned short endingPort, + /* OUT */ gras_sock_t **sock) { + + unsigned short port; + + if (!(*sock=malloc(sizeof(gras_sock_t)))) { + fprintf(stderr,"Malloc error\n"); + return malloc_error; + } + + if (!EstablishAnEar(startingPort,endingPort,&((*sock)->sock),&port)) { + free(*sock); + return unknown_error; + } + (*sock)->peer_addr=NULL; + (*sock)->port=port; + + return no_error; +} + +gras_error_t gras_sock_close(gras_sock_t *sock) { + if (sock) { + DROP_SOCKET(&(sock->sock)); + if (sock->peer_addr) free(sock->peer_addr); + free(sock); + } + return no_error; +} + +unsigned short +gras_sock_get_my_port(gras_sock_t *sd) { + if (!sd) return -1; + return sd->port; +} + +unsigned short +gras_sock_get_peer_port(gras_sock_t *sd) { + if (!sd) return -1; + return PeerNamePort(sd->sock); +} + +char * +gras_sock_get_peer_name(gras_sock_t *sd) { + char *tmp; + + if (!sd) return NULL; + tmp=PeerName_r(sd->sock); + if (tmp) { + strcpy(sd->peer_name,tmp); + free(tmp); + } else { + strcpy(sd->peer_name,"unknown"); + } + + return sd->peer_name; +} + + +/* ************************************************************************** + * format handling + * **************************************************************************/ + +/* + * Returns 1 or 0 depending on whether or not format conversion is required for + * data with the format described by the #howMany#-long array #description#. + */ +int grasConversionRequired(const DataDescriptor *description, size_t howMany){ + int i; + + if(DataSize(description, howMany, HOST_FORMAT) != + DataSize(description, howMany, NETWORK_FORMAT)) { + return 1; + } + + for(i = 0; i < howMany; i++) { + if(description[i].type == STRUCT_TYPE) { + if(grasConversionRequired(description[i].members, description[i].length)) { + return 1; + } + } else if(DifferentFormat(description[i].type)) + return 1; + } + + return DifferentOrder(); +} + +/* ************************************************************************** + * Actually exchanging messages + * **************************************************************************/ + +/* + * Discard data on the socket because of failure on our side + */ +void +gras_msg_discard(gras_sock_t *sd, size_t size) { + char garbage[2048]; + int s=size; + + while(s > 0) { + (void)RecvBytes(sd->sock, + garbage, + (s > sizeof(garbage)) ? sizeof(garbage) : s, + GetTimeOut(RECV, Peer(sd->sock), 2048)); + s -= sizeof(garbage); + } +} + +int grasDataRecv( gras_sock_t *sd, + void **data, + const DataDescriptor *description, + size_t description_length, + unsigned int repetition) { + + void *converted=NULL; + int convertIt; + void *destination; /* where to receive the data from the net (*data or converted)*/ + int recvResult; + size_t netSize,hostSize; + double start; /* for timeouts */ + char *net,*host; /* iterators */ + int i; + + gras_lock(); + + netSize = DataSize(description, description_length, NETWORK_FORMAT); + hostSize = DataSize(description, description_length, HOST_FORMAT); + + if (!(*data=malloc(hostSize*repetition))) { + gras_unlock(); + ERROR1("grasDataRecv: memory allocation of %d bytes failed\n", hostSize*repetition); + return 0; + } + + convertIt = grasConversionRequired(description, description_length); + + if(convertIt) { + if (!(converted = malloc(netSize*repetition))) { + free(*data); + gras_unlock(); + ERROR1("RecvData: memory allocation of %d bytes failed\n", netSize*repetition); + return 0; + } + destination = converted; + } else { + destination = *data; + } + + /* adaptive timeout */ + start = CurrentTime(); + + recvResult = RecvBytes(sd->sock, destination, netSize*repetition, + GetTimeOut(RECV, Peer(sd->sock), netSize*repetition)); + /* we assume a failure is a timeout ... Shouldn't hurt + * too much getting a bigger timeout anyway */ + SetTimeOut(RECV, sd->sock, CurrentTime()-start, netSize*repetition, !recvResult); + + fprintf(stderr,"RECV [seqLen=%d;netsize=%d;hostsize=%d] : (", + repetition,netSize,hostSize); + for (i=0; isock, source, netSize * repetition, + GetTimeOut(SEND, Peer(sd->sock),netSize*repetition)); + /* we assume a failure is a timeout ... Shouldn't hurt + * too much getting a bigger timeout anyway */ + SetTimeOut(SEND, sd->sock, CurrentTime()-start, netSize * repetition, !sendResult); + if(converted != NULL) + free((void *)converted); + + gras_unlock(); + return no_error; +} + +gras_error_t +grasMsgRecv(gras_msg_t **msg, + double timeOut) { + int dummyldap; + gras_msg_t *res; + size_t recvd; /* num of bytes received */ + int i; + gras_sock_t *sd; + + if (!(sd = (gras_sock_t*)malloc(sizeof(gras_sock_t)))) { + fprintf(stderr,"grasMsgRecv: Malloc error\n"); + return malloc_error; + } + + if(!IncomingRequest(timeOut, &(sd->sock), &dummyldap)) { + free(sd); + return timeout_error; + } + + if (!gras_lock()) { + free (sd); + return thread_error; + } + if (!(res = malloc(sizeof(gras_msg_t)))) { + gras_unlock(); + *msg=NULL; + free(sd); + return malloc_error; + } + *msg=res; + res->sock=sd; + res->freeDirective=free_after_use; + + if (!gras_unlock()) return thread_error; + + if(!(recvd=grasDataRecv( sd, + (void **)&(res->header), + headerDescriptor,headerDescriptorCount,1))) { + fprintf(stderr,"grasMsgRecv: no message received\n"); + return network_error; + } + res->header->dataSize -= recvd; + + fprintf(stderr,"Received header=ver:'%s' msg:%d size:%d seqCount:%d\n", + res->header->version, res->header->message, + res->header->dataSize, res->header->seqCount); + if (strncmp(res->header->version,GRASVERSION,strlen(GRASVERSION))) { + /* The other side do not use the same version than us. Let's panic */ + char junk[2046]; + int junkint; + while ((junkint=recv(sd->sock,junk,2046,0)) == 2046); + fprintf(stderr,"PANIC: Got a message from a peer (%s:%d) using GRAS version '%10s' while this side use version '%s'.\n", + gras_sock_get_peer_name(sd),gras_sock_get_peer_port(sd), + res->header->version,GRASVERSION); + return mismatch_error; + } + if (!(res->entry=grasMsgEntryGet(res->header->message))) { + /* This message is not registered on our side, discard it */ + gras_msg_discard(sd,res->header->dataSize); + + i= res->header->message; + free(res->header); + free(res); + *msg=NULL; + + fprintf(stderr,"grasMsgRecv: unregistered message %d received from %s\n", + i,gras_sock_get_peer_name(sd)); + return mismatch_error; + } + + if (!(recvd=grasDataRecv( sd, + (void **)&(res->dataCount), + countDescriptor,res->entry->seqCount,1))) { + gras_msg_discard(sd,res->header->dataSize); + i = res->header->message; + free(res->header); + free(res); + *msg=NULL; + fprintf(stderr, "grasMsgRecv: Error while getting elemCounts in message %d received from %s\n", + i,gras_sock_get_peer_name(sd)); + return network_error; + } + res->header->dataSize -= recvd; + + if (!gras_lock()) return thread_error; + if (!(res->data=(void**)malloc(sizeof(void*)*res->entry->seqCount))) { + gras_msg_discard(sd,res->header->dataSize); + + i= res->header->message; + free(res->header); + free(res->dataCount); + free(res); + *msg=NULL; + + gras_unlock(); + fprintf(stderr,"grasMsgRecv: Out of memory while receiving message %d received from %s\n", + i,gras_sock_get_peer_name(sd)); + return malloc_error; + } + if (!gras_unlock()) return thread_error; + + for (i=0;ientry->seqCount;i++) { + + if(!(recvd=grasDataRecv( sd, + &(res->data[i]), + (const DataDescriptor*)res->entry->dd[i], + res->entry->ddCount[i], + res->dataCount[i]) )) { + gras_msg_discard(sd,res->header->dataSize); + for (i--;i>=0;i--) free(res->data[i]); + free(res->dataCount); + free(res->data); + free(res); + *msg=NULL; + fprintf(stderr,"grasDataRecv: Transmision error while receiving message %d received from %s\n", + i,gras_sock_get_peer_name(sd)); + return network_error; + } + res->header->dataSize -= recvd; + } + + if (res->header->dataSize) { + fprintf(stderr,"Damnit dataSize = %d != 0 after receiving message %d received from %s\n", + res->header->dataSize,i,gras_sock_get_peer_name(sd)); + return unknown_error; + } + return no_error; +} + +/* + * Send a message to the network + */ + +gras_error_t +gras_msg_send(gras_sock_t *sd, + gras_msg_t *msg, + e_gras_free_directive_t freeDirective) { + + gras_error_t errcode; + int i; + + /* arg validity checks */ + gras_assert0(msg,"Trying to send NULL message"); + gras_assert0(sd, "Trying to send over a NULL socket"); + + + fprintf(stderr,"Header to send=ver:'%s' msg:%d size:%d seqCount:%d\n", + msg->header->version, msg->header->message, + msg->header->dataSize, msg->header->seqCount); + + /* Send the message */ + if ((errcode=grasDataSend(sd, + msg->header, + headerDescriptor,headerDescriptorCount,1))) { + fprintf(stderr,"gras_msg_send: Error '%s' while sending header of message %s to %s:%d\n", + gras_error_name(errcode),msg->entry->name,gras_sock_get_peer_name(sd),gras_sock_get_peer_port(sd)); + return errcode; + } + + if ((errcode=grasDataSend(sd, + msg->dataCount,countDescriptor,countDescriptorCount, + msg->entry->seqCount))) { + fprintf(stderr,"gras_msg_send: Error '%s' while sending sequence counts of message %s to %s\n", + gras_error_name(errcode),msg->entry->name,gras_sock_get_peer_name(sd)); + return errcode; + } + + for (i=0; ientry->seqCount; i++) { + if ((errcode=grasDataSend(sd, + msg->data[i], + (const DataDescriptor*)msg->entry->dd[i],msg->entry->ddCount[i], + msg->dataCount[i]))) { + fprintf(stderr,"gras_msg_send: Error '%s' while sending sequence %d of message %s to %s\n", + gras_error_name(errcode),i,msg->entry->name,gras_sock_get_peer_name(sd)); + return errcode; + } + } + + if (freeDirective == free_after_use) gras_msg_free(msg); + return no_error; +} + +gras_sock_t *gras_sock_new(void) { + return malloc(sizeof(gras_sock_t)); +} + +void grasSockFree(gras_sock_t *s) { + if (s) free (s); +} + +/* ************************************************************************** + * Creating/Using raw sockets + * **************************************************************************/ +gras_error_t gras_rawsock_server_open(unsigned short startingPort, + unsigned short endingPort, + unsigned int bufSize, gras_rawsock_t **sock) { + struct sockaddr_in sockaddr; + + + if (!(*sock=malloc(sizeof(gras_rawsock_t)))) { + fprintf(stderr,"Malloc error\n"); + return malloc_error; + } + + + for((*sock)->port = startingPort; + (*sock)->port <= endingPort; + (*sock)->port++) { + if(((*sock)->sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { + ERROR0("gras_rawsock_server_open: socket creation failed\n"); + free(*sock); + return system_error; + } + + setsockopt((*sock)->sock, SOL_SOCKET, SO_RCVBUF, (char *)&bufSize, sizeof(bufSize)); + setsockopt((*sock)->sock, SOL_SOCKET, SO_SNDBUF, (char *)&bufSize, sizeof(bufSize)); + + memset(&sockaddr, 0, sizeof(sockaddr)); + sockaddr.sin_port = htons((unsigned short)(*sock)->port); + sockaddr.sin_addr.s_addr = INADDR_ANY; + sockaddr.sin_family = AF_INET; + + if (bind((*sock)->sock, + (struct sockaddr *)&sockaddr, sizeof(sockaddr)) != -1 && + listen((*sock)->sock, 1) != -1) { + break; + } + close((*sock)->sock); + } + + if((*sock)->port > endingPort) { + fprintf(stderr,"gras_rawsock_server_open: couldn't find a port between %d and %d\n", + startingPort, endingPort); + free(*sock); + return mismatch_error; + } + + return no_error; +} + +void Dummy(int); +void Dummy(int sig) { + return; +} + +gras_error_t gras_rawsock_client_open(const char *host, short port, + unsigned int bufSize, gras_rawsock_t **sock) { + int i,addrCount; + IPAddress addresses[10]; + void (*was)(int); + struct sockaddr_in sockaddr; + + if (!(*sock=malloc(sizeof(gras_rawsock_t)))) { + fprintf(stderr,"Malloc error\n"); + return malloc_error; + } + (*sock)->port=-1; + + if (!(addrCount = IPAddressValues(host, addresses, 10))) { + fprintf(stderr,"grasOpenClientSocket: address retrieval of '%s' failed\n",host); + free(*sock); + return system_error; + } + (*sock)->port = port; + memset(&sockaddr, 0, sizeof(sockaddr)); + sockaddr.sin_port = htons((unsigned short)(*sock)->port); + sockaddr.sin_family = AF_INET; + + for(i = 0; i < addrCount && i<10 ; i++) { + if(((*sock)->sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { + fprintf(stderr,"gras_rawsock_client_open: socket creation failed\n"); + free(*sock); + return system_error; + } + + setsockopt((*sock)->sock, SOL_SOCKET, SO_RCVBUF, + (char *)&bufSize, sizeof(bufSize)); + setsockopt((*sock)->sock, SOL_SOCKET, SO_SNDBUF, + (char *)&bufSize, sizeof(bufSize)); + + sockaddr.sin_addr.s_addr = addresses[i]; + + was = signal(SIGALRM,Dummy); + SetRealTimer(GetTimeOut(CONN, addresses[i], 0)); + if(connect((*sock)->sock, + (struct sockaddr *)&sockaddr, sizeof(sockaddr)) == 0) { + SetRealTimer(0); + signal(SIGALRM,was); + break; + + } + SetRealTimer(0); + close((*sock)->sock); + signal(SIGALRM,was); + } + + if (i>=10) { + free(*sock); + fprintf(stderr, + "grasOpenClientRawSocket: Unable to contact %s:%d\n", + host,port); + return network_error; + } + + return no_error; +} + +gras_error_t gras_rawsock_close(gras_rawsock_t *sd) { + if (sd) { + CloseSocket(&(sd->sock), 0); + free(sd); + } + return no_error; +} + +unsigned short gras_rawsock_get_peer_port(gras_rawsock_t *sd) { + if (!sd) return -1; + return sd->port; +} + +/* FIXME: RL ignores the provided timeout and compute an appropriate one */ +static gras_error_t +_gras_rawsock_exchange(gras_rawsock_t *sd, int sender, unsigned int timeout, + unsigned int expSize, unsigned int msgSize){ + char *expData; + int bytesThisCall; + int bytesThisMessage; + int bytesTotal; + + fd_set rd_set; + int rv; + + char *name; + IPAddress addr; + + int ltimeout; + struct timeval timeOut; + + if((expData = (char *)malloc(msgSize)) == NULL) { + fprintf(stderr,"gras_rawsock_send: malloc %d failed\n", msgSize); + return malloc_error; + } + + /* let's get information on the caller (needed later on) */ + name = PeerName_r(sd->sock); + IPAddressValue(name, &addr); + free(name); + + ltimeout = (int)GetTimeOut((sender ? SEND : RECV), addr, expSize/msgSize +1); + + if (sender) + SetRealTimer(ltimeout); + + + for(bytesTotal = 0; + bytesTotal < expSize; + bytesTotal += bytesThisMessage) { + for(bytesThisMessage = 0; + bytesThisMessage < msgSize; + bytesThisMessage += bytesThisCall) { + + + if(sender) { + bytesThisCall = send(sd->sock, expData, msgSize - bytesThisMessage, 0); + } else { + bytesThisCall = 0; + FD_ZERO(&rd_set); + FD_SET(sd->sock,&rd_set); + timeOut.tv_sec = ltimeout; + timeOut.tv_usec = 0; + /* + * YUK! The timeout can get to be REALLY large if the + * amount of data gets big -- fence it at 60 secs + */ + if ((ltimeout <= 0) || (ltimeout > 60)) { + ltimeout = 60; + } + rv = select(sd->sock+1,&rd_set,NULL,NULL,&timeOut); + if(rv > 0) { + bytesThisCall = recv(sd->sock, expData, msgSize-bytesThisMessage, 0); + } + } + } + } + free(expData); + return no_error; +} + +gras_error_t +gras_rawsock_recv(gras_rawsock_t *sd, unsigned int expSize, unsigned int msgSize, + unsigned int timeout) { + return _gras_rawsock_exchange(sd,0,timeout,expSize,msgSize); +} +gras_error_t +gras_rawsock_send(gras_rawsock_t *sd, unsigned int expSize, unsigned int msgSize){ + return _gras_rawsock_exchange(sd,1,0,expSize,msgSize); +} + + + + +/* ************************************************************************** + * Process data + * **************************************************************************/ +grasProcessData_t *grasProcessDataGet() { + return _grasProcessData; +} + +/* ************************************************************************** + * Wrappers over OS functions + * **************************************************************************/ +double gras_time() { + return MicroTime(); +} + +void gras_sleep(unsigned long sec,unsigned long usec) { + sleep(sec); + if (usec/1000000) sleep(usec/1000000); + (void)usleep(usec % 1000000); +} diff --git a/src/gras/RL/gras_rl.h b/src/gras/RL/gras_rl.h new file mode 100644 index 0000000000..34d27af879 --- /dev/null +++ b/src/gras/RL/gras_rl.h @@ -0,0 +1,125 @@ +/* $Id$ */ + +/* gras_rl.h - private interface for GRAS when on real life */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef GRAS_RL_H +#define GRAS_RL_H + +#ifdef GRAS_SG_H +#error Impossible to load gras_sg.h and gras_rl.h at the same time +#endif + +#include "gras_private.h" +//#include "diagnostic.h" + +BEGIN_DECL + +/****************************************************************************/ +/****************************************************************************/ +/* Openning/Maintaining/Closing connexions */ +/****************************************************************************/ +/****************************************************************************/ + +/* Declaration of the socket type */ +#define PEER_NAME_LEN 200 +struct gras_sock_s { + int sock; + int port; /* port on this side */ + char peer_name[PEER_NAME_LEN]; /* buffer to use PeerName_r */ + char *peer_addr; +}; + +struct gras_rawsock_s { + int sock; + int port; +}; + +/****************************************************************************/ +/****************************************************************************/ +/* Format convertion stuff (copied verbatim from formatutil.h because I need*/ +/* to put datadescriptor in gras.h and the functions only in RL) */ +/****************************************************************************/ +/****************************************************************************/ + +void ConvertData(void *destination, + const void *source, + const DataDescriptor *description, + size_t length, + FormatTypes sourceFormat); + + +int DifferentFormat(DataTypes whatType); +int DifferentOrder(void); +int DifferentSize(DataTypes whatType); +void HomogenousConvertData(void *destination, + const void *source, + DataTypes whatType, + size_t repetitions, + FormatTypes sourceFormat); +size_t HomogenousDataSize(DataTypes whatType, + size_t repetitions, + FormatTypes format); +void ReverseData(void *destination, + const void *source, + DataTypes whatType, + int repetitions, + FormatTypes format); + + +/****************************************************************************/ +/****************************************************************************/ +/* Messaging stuff (reimplementation of message.h) */ +/****************************************************************************/ +/****************************************************************************/ +/** + * gras_msg_discard: + * @sd: Socket on which this message arrives + * @size: Size of the message to discard. + * + * Discard data on the socket because of failure on our side (out of mem or msg + * type unknown). + */ +void +gras_msg_discard(gras_sock_t *sd, size_t size); + +/** + * grasRecvData: + * @sd: Socket to listen on + * @data: Where to store the data (allocated by this function) + * @description: What data to expect. + * @Returns: the number of bytes read for that. + * + * Receive data from the network on a buffer allocated by this function for that + */ +int +grasDataRecv( gras_sock_t *sd, + void **data, + const DataDescriptor *description, + size_t description_length, + unsigned int repetition); + +/** + * grasRecvData: + * @sd: Socket to write on + * @data: What to send + * @description: Format of the data + * @Returns: the number of bytes written + * + * Send a sequence of data across the network + */ +gras_error_t +grasDataSend(gras_sock_t *sd, + const void *data, + const DataDescriptor *description, + size_t description_length, + int repetition); + +END_DECL + +#endif /* GRAS_SG_H */ diff --git a/src/gras/SG/gras_sg.c b/src/gras/SG/gras_sg.c new file mode 100644 index 0000000000..4159c9c3a8 --- /dev/null +++ b/src/gras/SG/gras_sg.c @@ -0,0 +1,576 @@ +/* $Id$ */ + +/* gras_rl - implementation of GRAS on top of the SimGrid simulator */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#include +#include + +#include "gras_sg.h" + +GRAS_LOG_DEFAULT_CATEGORY(GRAS); + +gras_error_t +gras_process_init() { + gras_hostdata_t *hd=(gras_hostdata_t *)MSG_host_get_data(MSG_host_self()); + grasProcessData_t *pd; + int i; + + if (!(pd=(grasProcessData_t *)malloc(sizeof(grasProcessData_t)))) { + fprintf(stderr,"grasInit: out of memory\n"); + return malloc_error; + } + pd->grasMsgQueueLen=0; + pd->grasMsgQueue = NULL; + + pd->grasCblListLen = 0; + pd->grasCblList = NULL; + + if (MSG_process_set_data(MSG_process_self(),(void*)pd) != MSG_OK) { + return unknown_error; + } + + if (!hd) { + if (!(hd=(gras_hostdata_t *)malloc(sizeof(gras_hostdata_t)))) { + fprintf(stderr,"grasInit: out of memory\n"); + return malloc_error; + } + hd->portLen = 0; + hd->port=NULL; + hd->port2chan=NULL; + for (i=0; iproc[i]=0; + } + + if (MSG_host_set_data(MSG_host_self(),(void*)hd) != MSG_OK) { + return unknown_error; + } + } + + /* take a free channel for this process */ + for (i=0; iproc[i]; i++); + if (i == MAX_CHANNEL) { + fprintf(stderr, + "GRAS: Can't add a new process on %s, because all channel are already in use. Please increase MAX CHANNEL (which is %d for now) and recompile GRAS\n.", + MSG_host_get_name(MSG_host_self()),MAX_CHANNEL); + return system_error; + } + pd->chan = i; + hd->proc[ i ] = MSG_process_self_PID(); + + /* take a free channel for this process */ + for (i=0; iproc[i]; i++); + if (i == MAX_CHANNEL) { + fprintf(stderr, + "GRAS: Can't add a new process on %s, because all channel are already in use. Please increase MAX CHANNEL (which is %d for now) and recompile GRAS\n.", + MSG_host_get_name(MSG_host_self()),MAX_CHANNEL); + return system_error; + } + pd->rawChan = i; + hd->proc[ i ] = MSG_process_self_PID(); + + /* + fprintf(stderr,"GRAS: Creating process '%s' (%d)\n", + MSG_process_get_name(MSG_process_self()),MSG_process_self_PID()); + */ + return no_error; +} + +gras_error_t +gras_process_finalize() { + gras_hostdata_t *hd=(gras_hostdata_t *)MSG_host_get_data(MSG_host_self()); + grasProcessData_t *pd=(grasProcessData_t *)MSG_process_get_data(MSG_process_self()); + int myPID=MSG_process_self_PID(); + int i; + + gras_assert0(hd && pd,"Run gras_process_init!!\n"); + + + fprintf(stderr,"GRAS: Finalizing process '%s' (%d)\n", + MSG_process_get_name(MSG_process_self()),MSG_process_self_PID()); + if (pd->grasMsgQueueLen) { + fprintf(stderr,"GRAS: Warning: process %d terminated, but some queued messages where not handled\n",MSG_process_self_PID()); + } + + for (i=0; i< MAX_CHANNEL; i++) + if (myPID == hd->proc[i]) + hd->proc[i] = 0; + + for (i=0; iportLen; i++) { + if (hd->port2chan[ i ] == pd->chan) { + memmove(&(hd->port[i]), &(hd->port[i+1]), (hd->portLen -i -1) * sizeof(int)); + memmove(&(hd->port2chan[i]), &(hd->port2chan[i+1]), (hd->portLen -i -1) * sizeof(int)); + hd->portLen--; + i--; /* counter the effect of the i++ at the end of the iteration */ + } + } + + return no_error; +} +/* ************************************************************************** + * Openning/Maintaining/Closing connexions (private functions for both raw + * and regular sockets) + * **************************************************************************/ +gras_error_t +_gras_sock_server_open(unsigned short startingPort, unsigned short endingPort, + int raw, unsigned int bufSize, /* OUT */ gras_sock_t **sock) { + + gras_hostdata_t *hd=hd=(gras_hostdata_t *)MSG_host_get_data(MSG_host_self()); + grasProcessData_t *pd=(grasProcessData_t *)MSG_process_get_data(MSG_process_self()); + int port,i; + const char *host=MSG_host_get_name(MSG_host_self()); + + gras_assert0(hd,"HostData=NULL !! Please run grasInit on each process\n"); + gras_assert0(pd,"ProcessData=NULL !! Please run grasInit on each process\n"); + + for (port=startingPort ; port <= endingPort ; port++) { + for (i=0; iportLen && hd->port[i] != port; i++); + if (iportLen && hd->port[i] == port) + continue; + + /* port not used so far. Do it */ + if (i == hd->portLen) { + /* need to enlarge the tables */ + if (hd->portLen++) { + hd->port2chan=(int*)realloc(hd->port2chan,hd->portLen*sizeof(int)); + hd->port =(int*)realloc(hd->port ,hd->portLen*sizeof(int)); + hd->raw =(int*)realloc(hd->raw ,hd->portLen*sizeof(int)); + } else { + hd->port2chan=(int*)malloc(hd->portLen*sizeof(int)); + hd->port =(int*)malloc(hd->portLen*sizeof(int)); + hd->raw =(int*)malloc(hd->portLen*sizeof(int)); + } + if (!hd->port2chan || !hd->port || !hd->raw) { + fprintf(stderr,"GRAS: PANIC: A malloc error did lose all ports attribution on this host\n"); + hd->portLen = 0; + return malloc_error; + } + } + hd->port2chan[ i ]=raw ? pd->rawChan : pd->chan; + hd->port[ i ]=port; + hd->raw[ i ]=raw; + + /* Create the socket */ + if (!(*sock=(gras_sock_t*)malloc(sizeof(gras_sock_t)))) { + fprintf(stderr,"GRAS: openServerSocket: out of memory\n"); + return malloc_error; + } + + (*sock)->server_sock = 1; + (*sock)->raw_sock = raw; + (*sock)->from_PID = -1; + (*sock)->to_PID = MSG_process_self_PID(); + (*sock)->to_host = MSG_host_self(); + (*sock)->to_port = port; + (*sock)->to_chan = pd->chan; + + /* + fprintf(stderr,"GRAS: '%s' (%d) ears on %s:%d%s (%p).\n", + MSG_process_get_name(MSG_process_self()), MSG_process_self_PID(), + host,port,raw? " (mode RAW)":"",*sock); + */ + return no_error; + } + /* if we go out of the previous for loop, that's that we didn't find any + suited port number */ + + fprintf(stderr, + "GRAS: can't find an empty port between %d and %d to open a socket on host %s\n.", + startingPort,endingPort,host); + return mismatch_error; +} + +gras_error_t +_gras_sock_client_open(const char *host, short port, int raw, unsigned int bufSize, + /* OUT */ gras_sock_t **sock) { + m_host_t peer; + gras_hostdata_t *hd; + int i; + + /* make sure this socket will reach someone */ + if (!(peer=MSG_get_host_by_name(host))) { + fprintf(stderr,"GRAS: can't connect to %s: no such host.\n",host); + return mismatch_error; + } + if (!(hd=(gras_hostdata_t *)MSG_host_get_data(peer))) { + fprintf(stderr,"GRAS: can't connect to %s: no process on this host.\n",host); + return mismatch_error; + } + for (i=0; iportLen && port != hd->port[i]; i++); + if (i == hd->portLen) { + fprintf(stderr,"GRAS: can't connect to %s:%d, no process listen on this port.\n",host,port); + return mismatch_error; + } + + if (hd->raw[i] && !raw) { + fprintf(stderr,"GRAS: can't connect to %s:%d in regular mode, the process listen in raw mode on this port.\n",host,port); + return mismatch_error; + } + if (!hd->raw[i] && raw) { + fprintf(stderr,"GRAS: can't connect to %s:%d in raw mode, the process listen in regular mode on this port.\n",host,port); + return mismatch_error; + } + + + /* Create the socket */ + if (!(*sock=(gras_sock_t*)malloc(sizeof(gras_sock_t)))) { + fprintf(stderr,"GRAS: openClientSocket: out of memory\n"); + return malloc_error; + } + + (*sock)->server_sock = 0; + (*sock)->raw_sock = raw; + (*sock)->from_PID = MSG_process_self_PID(); + (*sock)->to_PID = hd->proc[ hd->port2chan[i] ]; + (*sock)->to_host = peer; + (*sock)->to_port = port; + (*sock)->to_chan = hd->port2chan[i]; + + /* + fprintf(stderr,"GRAS: %s (PID %d) connects in %s mode to %s:%d (to_PID=%d).\n", + MSG_process_get_name(MSG_process_self()), MSG_process_self_PID(), + raw?"RAW":"regular",host,port,(*sock)->to_PID); + */ + return no_error; +} + +gras_error_t _gras_sock_close(int raw, gras_sock_t *sd) { + gras_hostdata_t *hd=(gras_hostdata_t *)MSG_host_get_data(MSG_host_self()); + int i; + + gras_assert0(hd,"HostData=NULL !! Please run grasInit on each process\n"); + + if (!sd) return no_error; + if (raw && !sd->raw_sock) { + fprintf(stderr,"GRAS: gras_rawsock_close: Was passed a regular socket. Please use gras_sock_close()\n"); + } + if (!raw && sd->raw_sock) { + fprintf(stderr,"GRAS: grasSockClose: Was passed a raw socket. Please use gras_rawsock_close()\n"); + } + if (sd->server_sock) { + /* server mode socket. Un register it from 'OS' tables */ + for (i=0; + iportLen && sd->to_port != hd->port[i]; + i++); + + if (i==hd->portLen) { + fprintf(stderr,"GRAS: closeSocket: The host does not know this server socket.\n"); + } else { + memmove(&(hd->port[i]), &(hd->port[i+1]), (hd->portLen -i -1) * sizeof(int)); + memmove(&(hd->raw[i]), &(hd->raw[i+1]), (hd->portLen -i -1) * sizeof(int)); + memmove(&(hd->port2chan[i]), &(hd->port2chan[i+1]), (hd->portLen -i -1) * sizeof(int)); + hd->portLen--; + } + } + free(sd); + return no_error; +} + +/* ************************************************************************** + * Creating/Using regular sockets + * **************************************************************************/ +gras_error_t +gras_sock_server_open(unsigned short startingPort, unsigned short endingPort, + /* OUT */ gras_sock_t **sock) { + return _gras_sock_server_open(startingPort,endingPort,0,0,sock); +} + +gras_error_t +gras_sock_client_open(const char *host, short port, + /* OUT */ gras_sock_t **sock) { + return _gras_sock_client_open(host,port,0,0,sock); +} + +gras_error_t gras_sock_close(gras_sock_t *sd) { + return _gras_sock_close(0,sd); +} + +unsigned short +gras_sock_get_my_port(gras_sock_t *sd) { + if (!sd || !sd->server_sock) return -1; + return sd->to_port; +} + +unsigned short +gras_sock_get_peer_port(gras_sock_t *sd) { + if (!sd || sd->server_sock) return -1; + return sd->to_port; +} + +char * +gras_sock_get_peer_name(gras_sock_t *sd) { + m_process_t proc; + + if (!sd) return NULL; + if ((proc=MSG_process_from_PID(sd->to_PID))) { + return (char*) MSG_host_get_name(MSG_process_get_host(proc)); + } else { + fprintf(stderr,"GRAS: try to access hostname of unknown process %d\n",sd->to_PID); + return (char*) "(dead or unknown host)"; + } +} +/* ************************************************************************** + * Creating/Using raw sockets + * **************************************************************************/ +gras_error_t gras_rawsock_server_open(unsigned short startingPort, unsigned short endingPort, + unsigned int bufSize, gras_rawsock_t **sock) { + return _gras_sock_server_open(startingPort,endingPort,1,bufSize,(gras_sock_t**)sock); +} + +gras_error_t gras_rawsock_client_open(const char *host, short port, + unsigned int bufSize, gras_rawsock_t **sock) { + return _gras_sock_client_open(host,port,1,bufSize,(gras_sock_t**)sock); +} + +gras_error_t gras_rawsock_close(gras_rawsock_t *sd) { + return _gras_sock_close(1,(gras_sock_t*)sd); +} + +unsigned short +gras_rawsock_get_peer_port(gras_rawsock_t *sd) { + if (!sd || !sd->server_sock) return -1; + return sd->to_port; +} + +gras_error_t +gras_rawsock_send(gras_rawsock_t *sock, unsigned int expSize, unsigned int msgSize) { + unsigned int bytesTotal; + static unsigned int count=0; + m_task_t task=NULL; + char name[256]; + + gras_assert0(sock->raw_sock,"Asked to send raw data on a regular socket\n"); + + for(bytesTotal = 0; + bytesTotal < expSize; + bytesTotal += msgSize) { + + sprintf(name,"Raw data[%d]",count++); + + task=MSG_task_create(name,0,((double)msgSize)/(1024.0*1024.0),NULL); + /* + fprintf(stderr, "%f:%s: gras_rawsock_send(%f %s -> %s) BEGIN\n", + gras_time(), + MSG_process_get_name(MSG_process_self()), + ((double)msgSize)/(1024.0*1024.0), + MSG_host_get_name( MSG_host_self()), + MSG_host_get_name( sock->to_host)); + */ + if (MSG_task_put(task, sock->to_host,sock->to_chan) != MSG_OK) { + fprintf(stderr,"GRAS: msgSend: Problem during the MSG_task_put()\n"); + return unknown_error; + } + /*fprintf(stderr, "%f:%s: gras_rawsock_send(%f -> %s) END\n", + gras_time(), + MSG_process_get_name(MSG_process_self()), + ((double)msgSize)/(1024.0*1024.0), + MSG_host_get_name( sock->to_host));*/ + } + return no_error; +} + +gras_error_t +gras_rawsock_recv(gras_rawsock_t *sock, unsigned int expSize, unsigned int msgSize, + unsigned int timeout) { + grasProcessData_t *pd=(grasProcessData_t *)MSG_process_get_data(MSG_process_self()); + unsigned int bytesTotal; + m_task_t task=NULL; + double startTime; + + gras_assert0(sock->raw_sock,"Asked to receive raw data on a regular socket\n"); + + startTime=gras_time(); + for(bytesTotal = 0; + bytesTotal < expSize; + bytesTotal += msgSize) { + + task=NULL; + /* + fprintf(stderr, "%f:%s: gras_rawsock_recv() BEGIN\n", + gras_time(), + MSG_process_get_name(MSG_process_self())); + */ + do { + if (MSG_task_Iprobe((m_channel_t) pd->rawChan)) { + if (MSG_task_get(&task, (m_channel_t) pd->rawChan) != MSG_OK) { + fprintf(stderr,"GRAS: Error in MSG_task_get()\n"); + return unknown_error; + } + if (MSG_task_destroy(task) != MSG_OK) { + fprintf(stderr,"GRAS: Error in MSG_task_destroy()\n"); + return unknown_error; + } + /* + fprintf(stderr, "%f:%s: gras_rawsock_recv() END\n", + gras_time(), + MSG_process_get_name(MSG_process_self())); + */ + break; + } else { + MSG_process_sleep(0.0001); + } + } while (gras_time() - startTime < timeout); + + if (gras_time() - startTime > timeout) + return timeout_error; + } + return no_error; +} + + +/* ************************************************************************** + * Actually exchanging messages + * **************************************************************************/ + +gras_error_t +grasMsgRecv(gras_msg_t **msg, + double timeOut) { + + double startTime=gras_time(); + grasProcessData_t *pd=grasProcessDataGet(); + m_task_t task=NULL; + + do { + if (MSG_task_Iprobe((m_channel_t) pd->chan)) { + if (MSG_task_get(&task, (m_channel_t) pd->chan) != MSG_OK) { + fprintf(stderr,"GRAS: Error in MSG_task_get()\n"); + return unknown_error; + } + + *msg=(gras_msg_t*)MSG_task_get_data(task); + /* + { + int i,j; + gras_msg_t *__dm_=*msg; + + fprintf(stderr, "grasMsgRecv(%s) = %d seq (", + __dm_->entry->name, __dm_->entry->seqCount ); + + for (i=0; i<__dm_->entry->seqCount; i++) { + fprintf(stderr,"%d elem {",__dm_->dataCount[i]); + for (j=0; j<__dm_->dataCount[i]; j++) { + fprintf(stderr,"%p; ",__dm_->data[i]); + } + fprintf(stderr,"},"); + } + fprintf(stderr, ")\n"); + } + */ + + if (MSG_task_destroy(task) != MSG_OK) { + fprintf(stderr,"GRAS: Error in MSG_task_destroy()\n"); + return unknown_error; + } + return no_error; + + } else { + MSG_process_sleep(1); + } + } while (gras_time()-startTime < timeOut || MSG_task_Iprobe((m_channel_t) pd->chan)); + return timeout_error; +} + +gras_error_t +gras_msg_send(gras_sock_t *sd, + gras_msg_t *_msg, + e_gras_free_directive_t freeDirective) { + + grasProcessData_t *pd=grasProcessDataGet(); + m_task_t task; + static int count=0; + char name[256]; + gras_msg_t *msg; + gras_sock_t *answer; + + /* arg validity checks */ + gras_assert0(msg,"Trying to send NULL message"); + gras_assert0(sd ,"Trying to send over a NULL socket"); + + if (!(answer=(gras_sock_t*)malloc(sizeof(gras_sock_t)))) { + RAISE_MALLOC; + } + answer->server_sock=0; + answer->raw_sock =0; + answer->from_PID = sd->to_PID; + answer->to_PID = MSG_process_self_PID(); + answer->to_host = MSG_host_self(); + answer->to_port = 0; + answer->to_chan = pd->chan; + + sprintf(name,"%s[%d]",_msg->entry->name,count++); + /* if freeDirective == free_never, we have to build a copy of the message */ + if (freeDirective == free_never) { + msg=gras_msg_copy(_msg); + } else { + msg=_msg; + } + msg->sock = answer; + + /* + fprintf(stderr,"Send %s with answer(%p)=",msg->entry->name,msg->sock); + fprintf(stderr,"(server=%d,raw=%d,fromPID=%d,toPID=%d,toHost=%p,toPort=%d,toChan=%d)\n", + msg->sock->server_sock,msg->sock->raw_sock,msg->sock->from_PID, + msg->sock->to_PID,msg->sock->to_host,msg->sock->to_port,msg->sock->to_chan); + fprintf(stderr,"Send over %p=(server=%d,raw=%d,fromPID=%d,toPID=%d,toHost=%p,toPort=%d,toChan=%d)\n", + sd,sd->server_sock,sd->raw_sock,sd->from_PID,sd->to_PID,sd->to_host,sd->to_port,sd->to_chan); + */ + + /* + { + int i,j; + gras_msg_t *__dm_=msg; + + fprintf(stderr, "gras_msg_send(%s) = %d seq (", + __dm_->entry->name, __dm_->entry->seqCount ); + + for (i=0; i<__dm_->entry->seqCount; i++) { + fprintf(stderr,"%d elem {",__dm_->dataCount[i]); + for (j=0; j<__dm_->dataCount[i]; j++) { + fprintf(stderr,"%p; ",__dm_->data[i]); + } + fprintf(stderr,"},"); + } + fprintf(stderr, ")\n"); + } + */ + + /* Send it */ + task=MSG_task_create(name,0,((double)msg->header->dataSize)/(1024.0*1024.0),msg); + if (MSG_task_put(task, sd->to_host,sd->to_chan) != MSG_OK) { + fprintf(stderr,"GRAS: msgSend: Problem during the MSG_task_put()\n"); + return unknown_error; + } + return no_error; +} + +gras_sock_t *gras_sock_new(void) { + return malloc(sizeof(gras_sock_t)); +} + +void grasSockFree(gras_sock_t *s) { + if (s) free (s); +} + +/* ************************************************************************** + * Process data + * **************************************************************************/ +grasProcessData_t *grasProcessDataGet() { + return (grasProcessData_t *)MSG_process_get_data(MSG_process_self()); +} + +/* ************************************************************************** + * Wrappers over OS functions + * **************************************************************************/ +double gras_time() { + return MSG_getClock(); +} + +void gras_sleep(unsigned long sec, unsigned long usec) { + MSG_process_sleep((double)sec + ((double)usec)/1000000); +} + diff --git a/src/gras/SG/gras_sg.h b/src/gras/SG/gras_sg.h new file mode 100644 index 0000000000..c36dc36baf --- /dev/null +++ b/src/gras/SG/gras_sg.h @@ -0,0 +1,93 @@ +/* $Id$ */ + +/* gras_sg.h - private interface for GRAS when using the simulator */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef GRAS_SG_H +#define GRAS_SG_H + +#ifdef GRAS_RL_H +#error Impossible to load gras_sg.h and gras_rl.h at the same time +#endif + +#include "gras_private.h" +#include + +BEGIN_DECL + +/* Declaration of the socket type */ +struct gras_sock_s { + int server_sock; /* boolean */ + int raw_sock; /* boolean. If true, socket for raw send/recv. + If false. socket for formated messages */ + + int from_PID; /* process which sent this message */ + int to_PID; /* process to which this message is destinated */ + + m_host_t to_host; /* Who's on other side */ + int to_port; /* port on which the server is earing */ + m_channel_t to_chan;/* Channel on which the other side is earing */ +}; +struct gras_rawsock_s { + int server_sock; /* boolean */ + int raw_sock; /* boolean. If true, socket for raw send/recv. + If false. socket for formated messages */ + + int from_PID; /* process which sent this message */ + int to_PID; /* process to which this message is destinated */ + + m_host_t to_host; /* Who's on other side */ + int to_port; /* port on which the server is earing */ + m_channel_t to_chan;/* Channel on which the other side is earing */ +}; + +/* Data for each host */ +typedef struct { + int proc[MAX_CHANNEL]; /* who's connected to each channel (its PID). If =0, then free */ + + int portLen; + int *port; /* list of ports used by a server socket */ + int *port2chan; /* the channel it points to */ + int *raw; /* (boolean) the channel is in raw mode or for formatted messages */ + +} gras_hostdata_t; + +/* prototype of private functions */ +/** + * _gras_sock_server_open: + * + * Open a server socket either in raw or regular mode, depending on the @raw argument. + * In SG, bufSize is ignored. + */ +gras_error_t +_gras_sock_server_open(unsigned short startingPort, unsigned short endingPort, + int raw, unsigned int bufSize, /* OUT */ gras_sock_t **sock); + +/** + * _gras_sock_client_open: + * + * Open a client socket either in raw or regular mode, depending on the @raw argument. + * In SG, bufSize is ignored. + */ +gras_error_t +_gras_sock_client_open(const char *host, short port, int raw, unsigned int bufSize, + /* OUT */ gras_sock_t **sock); + + +/** + * _gras_sock_close: + * + * Close a socket which were opened either in raw or regular mode, depending on the + * @raw argument. + */ +gras_error_t _gras_sock_close(int raw, gras_sock_t *sd); + + +END_DECL + +#endif /* GRAS_SG_H */ diff --git a/src/gras/config.h b/src/gras/config.h new file mode 100644 index 0000000000..ff51051260 --- /dev/null +++ b/src/gras/config.h @@ -0,0 +1,56 @@ +/* src/config.h. Generated by configure. */ +/* src/config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Name of package */ +#define PACKAGE "gras" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "martin.quinson@ens-lyon.fr" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "GRAS" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "GRAS 0.1" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "gras" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "0.1" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "0.1" diff --git a/src/gras/gras_private.h b/src/gras/gras_private.h new file mode 100644 index 0000000000..c3a11412e4 --- /dev/null +++ b/src/gras/gras_private.h @@ -0,0 +1,261 @@ +/* $Id$ */ + +/* gras_private.h - GRAS private definitions */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef GRAS_PRIVATE_H +#define GRAS_PRIVATE_H + +#include +#include +#include +#include + +/* Oli's macro */ +#ifndef GS_FAILURE_CONTEXT +# define GS_FAILURE_CONTEXT +#endif /* FAILURE_CONTEXT */ + +#define GS_FAILURE(str) \ + (fprintf(stderr, "FAILURE: %s(%s:%d)" GS_FAILURE_CONTEXT "%s\n", __func__, __FILE__, __LINE__, (str)), \ + abort()) + +#define aligned(v, a) (((v) + (a - 1)) & ~(a - 1)) +#define max(a, b) (((a) > (b))?(a):(b)) +#define min(a, b) (((a) < (b))?(a):(b)) + +/* end of Oli's cruft */ + +#include "gras_config.h" + +#include "gras/error.h" +#include "gras/log.h" +#include "gras/dynar.h" +#include "gras/dict.h" +#include "gras/config.h" + +#include "gras/data_description.h" +#include "gras/dd_type_bag.h" + +#include "gras/core.h" +#include "gras/datadesc.h" +#include "gras/socket.h" +#include "gras/messages.h" + +#define TRUE 1 +#define FALSE 0 + +#define ASSERT(cond,msg) do {if (!(cond)) { fprintf(stderr,msg); abort(); }} while(0) + +/* ************************************************************************** + * Locking system + ****************************************************************************/ +/** + * gras_lock: + * @Returns: 1 if succesfull 0 otherwise. + * + * Get the GRAS lock. + */ +int +gras_lock(void); + +/** + * gras_unlock: + * @Returns: 1 if succesfull 0 otherwise. + * + * release the GRAS general lock. + */ +int +gras_unlock(void); + +/* ************************************************************************** + * Messaging stuff + * **************************************************************************/ + +/** + * gras_cblist_t: + * + * The list of callbacks for a given message type on a given host + */ +typedef struct { + gras_msgid_t id; /** identificator of this message */ + + int cbCount; /** number of registered callbacks */ + gras_cb_t *cb; /** callbacks */ + int *cbTTL; /** TTL of each callback (in number of use)*/ +} gras_cblist_t; + +/** + * gras_msgentry_t: + * + * An entry in the registered message list. + */ + +struct gras_msgentry_s { + gras_msgid_t id; /** identificator of this message */ + char *name; /** printable name of this message */ + + int seqCount; /** number of sequence for this message */ + DataDescriptor **dd; /** list of datadescriptor for each sequence */ + size_t *ddCount; /** list of datadescriptor for each sequence */ + unsigned int *networkSize;/** network size of one element in each sequence */ + unsigned int *hostSize; /** host size of one element in each sequence */ +}; +/* ************************************************************************** + * GRAS globals + * **************************************************************************/ + +/** + * gras_hostglobal_t: + * + * Globals for a given host. + */ +typedef struct { + gras_cblist_t *grasCbList; /** callbacks for registered messages */ + unsigned int grasCbListCount; /** length of previous array */ +} gras_hostglobal_t; + +/** + * gras_msgheader_t: + * + * A header sent with messages. #version# is the NWS version and is presently + * ignored, but it could be used for compatibility. #message# is the actual + * message. #seqCount# is the number of sequence accompagning this message. + */ +struct gras_msgheader_s { + char version[10]; + gras_msgid_t message; + unsigned int dataSize; + unsigned int seqCount; +}; + +/** + * grasProcessData_t: + * + * Data for each process + */ +typedef struct { + /* queue of messages which where received but not wanted in msgWait, and therefore + temporarly queued until the next msgHandle */ + int grasMsgQueueLen; + gras_msg_t **grasMsgQueue; + + /* registered callbacks for each message */ + int grasCblListLen; + gras_cblist_t *grasCblList; + + /* The channel we are listening to in SG for formated messages */ + int chan; + /* The channel we are listening to in SG for raw send/recv */ + int rawChan; + + /* globals of the process */ + void *userdata; +} grasProcessData_t; + + +/*@unused@*/static const DataDescriptor headerDescriptor[] = + {SIMPLE_MEMBER(CHAR_TYPE, 10, offsetof(gras_msgheader_t, version)), + SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(gras_msgheader_t, message)), + SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(gras_msgheader_t, dataSize)), + SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(gras_msgheader_t, seqCount))}; +#define headerDescriptorCount 4 + +/*@unused@*/static const DataDescriptor countDescriptor[] = + {SIMPLE_DATA(UNSIGNED_INT_TYPE,1)}; +#define countDescriptorCount 1 + +/** + * GRASVERSION + * + * This string is sent in each message to identify the version of the + * communication protocol used. This may be paranoid, but I feel so right now. + */ +#define GRASVERSION "0.0.020504" + +/** + * grasMsgEntryGet: + * @id: msg id to look for + * @Returns: the entry if found, NULL otherwise + * + * Get the entry corresponding to this message id; + */ /*@observer@*/ +gras_msgentry_t * grasMsgEntryGet(gras_msgid_t id); + +/** + * grasProcessDataGet: + * + * Get the GRAS globals for this host + */ /*@observer@*/ +grasProcessData_t *grasProcessDataGet(void); + +/** + * gras_cb_get: + * @id: msg id to look for + * + * Get the callback list corresponding to this message id; + */ /*@observer@*/ +gras_cblist_t * gras_cb_get(gras_msgid_t id); + +/** + * gras_cb_create: + * @id: the id of the new msg + * + * Create a new callback list for a new message id. + */ +gras_error_t gras_cb_create(gras_msgid_t message); + +/** + * grasMsgHeaderNew: + * @msgId: + * @dataSize: total size in network format, including headers and seqcount + * @seqCount: Number of sequences in this message (to check that everything goes well) + * @Returns: the created header + * + * Create a new header containing the passed values. + */ +gras_msgheader_t *grasMsgHeaderNew(gras_msgid_t msgId, + unsigned int dataSize, + unsigned int seqCount); + +/** + * grasMsgRecv: + * + * Receive the next message arriving within the given timeout + */ +gras_error_t grasMsgRecv(gras_msg_t **msg, double timeout); + +/** + * gras_sock_new: + * + * Create an empty socket + */ +gras_sock_t *gras_sock_new(void); + +/** + * grasSockFree: + * + * Frees an old socket + */ +void grasSockFree(gras_sock_t *s); + + + +/* ************************************************************************** + * Handling DataDescriptors + * **************************************************************************/ +typedef enum {HOST_FORMAT, NETWORK_FORMAT} FormatTypes; +size_t DataSize(const DataDescriptor *description, + size_t length, + FormatTypes format); +void *gras_datadesc_copy_data(const DataDescriptor *dd, unsigned int c, void *data); +int gras_datadesc_cmp(/*@null@*/const DataDescriptor *dd1, unsigned int c1, + /*@null@*/const DataDescriptor *dd2, unsigned int c2); +void gras_datadesc_dump(/*@null@*/const DataDescriptor *dd, unsigned int c); + +#endif /* GRAS_PRIVATE_H */ diff --git a/src/gras/gs/.cvsignore b/src/gras/gs/.cvsignore new file mode 100644 index 0000000000..6179e0dbd5 --- /dev/null +++ b/src/gras/gs/.cvsignore @@ -0,0 +1 @@ +Makefile Makefile.in diff --git a/src/gras/gs/categories.h b/src/gras/gs/categories.h new file mode 100644 index 0000000000..61cce34205 --- /dev/null +++ b/src/gras/gs/categories.h @@ -0,0 +1,154 @@ +/* gs_categories.h */ +#ifndef GS_CATEGORIES_H +#define GS_CATEGORIES_H + +/* + * Avoid some strange warnings with callback defs. + */ +struct s_gs_type; + +/* + * categories of types + */ +enum e_gs_type_category { + e_gs_type_cat_undefined = 0, + + e_gs_type_cat_elemental, + e_gs_type_cat_struct, + e_gs_type_cat_union, + e_gs_type_cat_ref, + e_gs_type_cat_array, + e_gs_type_cat_ignored, + + e_gs_type_cat_invalid +}; + + +/* + * Elemental category + */ +enum e_gs_elemental_encoding { + e_gs_elemental_encoding_undefined = 0, + + e_gs_elemental_encoding_unsigned_integer, + e_gs_elemental_encoding_signed_integer, + e_gs_elemental_encoding_floating_point, + + e_gs_elemental_encoding_invalid +}; + +struct s_gs_cat_elemental { + int encoding; +}; + + +/* + * Structure category + */ +struct s_gs_cat_struct_field { + + char *name; + long int offset; + int code; + + void (*before_callback)(void *vars, + struct s_gs_type *p_type, + void *data); + + void (*after_callback)(void *vars, + struct s_gs_type *p_type, + void *data); +}; + +struct s_gs_cat_struct { + + int nb_fields; + struct s_gs_cat_struct_field **field_array; +}; + + +/* + * Union category + */ +struct s_gs_cat_union_field { + + char *name; + int code; + + void (*before_callback)(void *vars, + struct s_gs_type *p_type, + void *data); + + void (*after_callback)(void *vars, + struct s_gs_type *p_type, + void *data); +}; + +struct s_gs_cat_union { + + int nb_fields; + struct s_gs_cat_union_field **field_array; + + /* callback used to return the field number */ + int (*callback)(void *vars, + struct s_gs_type *p_type, + void *data); +}; + + +/* + * Ref category + */ +struct s_gs_cat_ref { + int code; + + /* callback used to return the referenced type number */ + int (*callback)(void *vars, + struct s_gs_type *p_type, + void *data); +}; + + +/* + * Array_categorie + */ +struct s_gs_cat_array { + int code; + + /* element_count < 0 means dynamically defined */ + long int element_count; + + /* callback used to return the dynamic length */ + long int (*callback)(void *vars, + struct s_gs_type *p_type, + void *data); +}; + +/* + * Ignored category + */ +struct s_gs_cat_ignored { + void *default_value; +}; + +gras_type_t * +gs_type_new_elemental(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + const char *name, + enum e_gs_elemental_encoding encoding, + long int size); + +gras_type_t * +gs_type_new_elemental_with_callback(gras_type_bag_t *p_bag, + gras_connection_t *p_connection, + const char *name, + enum e_gs_elemental_encoding encoding, + long int size, + + void (*callback)(void *vars, + gras_type_t *p_type, + void *data)); + + + +#endif /* GS_CATEGORIES_H */ diff --git a/src/gras/gs/connection.h b/src/gras/gs/connection.h new file mode 100644 index 0000000000..5a39ea0007 --- /dev/null +++ b/src/gras/gs/connection.h @@ -0,0 +1,47 @@ +/* gs_connection.h */ +#ifndef GS_CONNECTION_H +#define GS_CONNECTION_H + +/* used structs */ +struct s_gs_connection; +struct s_gs_net_driver; +struct s_gs_type_bag; + +enum e_gs_connection_direction { + e_gs_connection_direction_unknown = 0, + e_gs_connection_direction_outgoing, + e_gs_connection_direction_incoming +}; + +struct s_gs_connection_ops { + + void + (*_init) (struct s_gs_connection *p_connection, + void *arg); + + void + (*_exit) (struct s_gs_connection *p_connection); + + void + (*write) (struct s_gs_connection *p_connection, + void *ptr, + long int length); + + void + (*read) (struct s_gs_connection *p_connection, + void *ptr, + long int length); + + void + (*flush) (struct s_gs_connection *p_connection); +}; + +struct s_gs_connection { + struct s_gs_connection_ops *connection_ops; + struct s_gs_net_driver *p_net_driver; + enum e_gs_connection_direction direction; + void *specific; +}; + + +#endif /* GS_CONNECTION_H */ diff --git a/src/gras/gs/datadesc.c b/src/gras/gs/datadesc.c new file mode 100644 index 0000000000..1ee1fb1e9d --- /dev/null +++ b/src/gras/gs/datadesc.c @@ -0,0 +1,31 @@ +/* gs.c */ + +#include "gs/gs_private.h" + +GRAS_LOG_NEW_DEFAULT_CATEGORY(NDR); + +void +gs_init(int argc, + char **argv) { + + (void)argc; + (void)argv; + + DEBUG0("Init"); + gs_net_drivers_init(); + gs_type_drivers_init(); +} + +void +gs_purge_cmd_line(int *argc, + char **argv) { + (void)argc; + (void)argv; + + /**/ +} + +void +gs_exit() { + /**/ +} diff --git a/src/gras/gs/gs_private.h b/src/gras/gs/gs_private.h new file mode 100644 index 0000000000..14e778759c --- /dev/null +++ b/src/gras/gs/gs_private.h @@ -0,0 +1,22 @@ +/* $Id$ */ + +/* gs_private.h -- stuff internal to grassouillet, the data desc stuff */ + + + +#ifndef _GS_PRIVATE_H +#define _GS_PRIVATE_H + +#include "gras_private.h" +#include "gs/categories.h" +#include "gs/connection.h" +#include "gs/sequence.h" +#include "gs/net_driver.h" +#include "gs/net_interface_fd.h" +#include "gs/type_interface_rl.h" +#include "gs/type_driver.h" +#include "gs/message.h" +#include "gs/type.h" + + +#endif /* _GS_PRIVATE_H */ diff --git a/src/gras/gs/message.c b/src/gras/gs/message.c new file mode 100644 index 0000000000..1fb1b00b72 --- /dev/null +++ b/src/gras/gs/message.c @@ -0,0 +1,935 @@ +/* gs_message.c */ + +#include "gs/gs_private.h" + +/* + * Sequences + */ +static +struct s_gs_sequence * +_gs_sequence_alloc(void) { + struct s_gs_sequence *p_sequence = NULL; + p_sequence = malloc(sizeof(struct s_gs_sequence)); + return p_sequence; +} + +static +struct s_gs_sequence * +_gs_sequence_new(void) { + struct s_gs_sequence *p_sequence = NULL; + + p_sequence = _gs_sequence_alloc(); + + p_sequence->message = NULL; + p_sequence->code = -1; + p_sequence->next = NULL; + + return p_sequence; +} + +/* + * Messages + */ +static +struct s_gs_message * +_gs_message_alloc(void) { + struct s_gs_message *p_message = NULL; + + p_message = malloc(sizeof(struct s_gs_message)); + + return p_message; +} + +struct s_gs_message * +gs_message_new(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name) { + + struct s_gs_type_bag_ops *bag_ops = p_bag->bag_ops; + struct s_gs_message *p_message = NULL; + + p_message = _gs_message_alloc(); + + p_message->code = -1; + p_message->name = strdup(name); + + p_message->first = NULL; + p_message->last = NULL; + + bag_ops->store_message(p_bag, p_connection, p_message); + + return p_message; +} + + +void +gs_message_append_new_sequence(struct s_gs_message *p_message, + struct s_gs_type *p_type) { + + struct s_gs_sequence *p_sequence = NULL; + + p_sequence = _gs_sequence_new(); + + p_sequence->message = p_message; + p_sequence->code = p_type->code; + p_sequence->next = NULL; + + if (p_message->first) { + p_message->last ->next = p_sequence; + } else { + p_message->first = p_sequence; + } + + p_message->last = p_sequence; +} + + +/* + * Send/receive + */ +static +struct s_gs_message_instance * +_gs_message_instance_alloc(void) { + struct s_gs_message_instance *p_message_instance = NULL; + p_message_instance = malloc(sizeof (struct s_gs_message_instance)); + return p_message_instance; +} + +static +struct s_gs_message_instance * +_gs_message_instance_new(void) { + struct s_gs_message_instance *p_message_instance = NULL; + + p_message_instance = _gs_message_instance_alloc(); + + p_message_instance->p_message = NULL; + p_message_instance->current = NULL; + p_message_instance->p_bag = NULL; + p_message_instance->p_connection = NULL; + + return p_message_instance; +} + +/* Send */ +static +void +_gs_message_send_type(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx, + void *vars, + gras_dict_t **p_refs, + struct s_gs_type *p_type, + void *data); + +static +struct s_gs_type * +_sg_message_send_get_type_by_code(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx, + void *vars, + int code) { + struct s_gs_type_bag_ops *bops = p_bag->bag_ops; + struct s_gs_type *p_type = NULL; + + p_type = bops->get_type_by_code(p_bag, NULL, code); + + if (!bops->check_type_mark(p_bag, p_cnx, p_type->name)) { + struct s_gs_type *p_type_type = NULL; + gras_dict_t *_refs = NULL; + + p_type_type = bops->get_type_by_name(p_bag, NULL, "_s_gs_type"); + if (!p_type_type) + GS_FAILURE("_s_gs_type default type missing"); + + bops->mark_type(p_bag, p_cnx, p_type->name); + + fprintf(stderr, "sending type with code = %d\n", code); + gs_vars_enter(vars); + _gs_message_send_type(p_bag, p_cnx, vars, &_refs, p_type_type, p_type); + gs_vars_leave(vars); + fprintf(stderr, "type with code = %d, name = %s sent\n", code, p_type->name); + } else { + fprintf(stderr, "no need to send type with code = %d, name = %s\n", code, p_type->name); + } + + return p_type; +} + +static +void +_gs_message_send_type(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx, + void *vars, + gras_dict_t **p_refs, + struct s_gs_type *p_type, + void *data) { + + struct s_gs_type_bag_ops *bops = p_bag->bag_ops; + struct s_gs_connection_ops *cops = p_cnx->connection_ops; + + if (p_type->category_code > 1) + fprintf(stderr, "\n"); + fprintf(stderr, "sending a %s\n", p_type->name); + + switch (p_type->category_code) { + + case e_gs_type_cat_elemental: + { + if (p_type->before_callback) { + p_type->before_callback(vars, p_type, data); + } + + cops->write (p_cnx, data, p_type->size); + } + break; + + case e_gs_type_cat_struct : + { + struct s_gs_cat_struct *p_struct = NULL; + + if (p_type->before_callback) { + p_type->before_callback(vars, p_type, data); + } + + p_struct = p_type->category.struct_data; + + { + int nb_fields = 0; + int i = 0; + + nb_fields = p_struct->nb_fields; + + while (i < nb_fields) { + struct s_gs_cat_struct_field *p_field = NULL; + struct s_gs_type *p_field_type = NULL; + void *ref = NULL; + + p_field = p_struct->field_array[i]; + p_field_type = _sg_message_send_get_type_by_code(p_bag, p_cnx, vars, p_field->code); + ref = ((char *)data) + p_field->offset; + + if (p_field->before_callback) { + p_field->before_callback(vars, p_field_type, ref); + } + + _gs_message_send_type(p_bag, + p_cnx, + vars, + p_refs, + p_field_type, + ref); + + if (p_field->after_callback) { + p_field->after_callback(vars, p_field_type, ref); + } + + i++; + } + } + + if (p_type->after_callback) { + p_type->after_callback(vars, p_type, data); + } + } + break; + + case e_gs_type_cat_union : + { + struct s_gs_cat_union *p_union = NULL; + + p_union = p_type->category.union_data; + + { + int field_num = 0; + struct s_gs_cat_union_field *p_field = NULL; + struct s_gs_type *p_field_type = NULL; + + field_num = p_union->callback(vars, p_type, data); + + if ((field_num < 0) || (field_num >= p_union->nb_fields)) + GS_FAILURE("invalid field index"); + + _gs_message_send_type(p_bag, + p_cnx, + vars, + p_refs, + bops->get_type_by_name(p_bag, NULL, "signed int"), + &field_num); + + p_field = p_union->field_array[field_num]; + p_field_type = _sg_message_send_get_type_by_code(p_bag, p_cnx, vars, p_field->code); + + if (p_field->before_callback) { + p_field->before_callback(vars, p_field_type, data); + } + + _gs_message_send_type(p_bag, + p_cnx, + vars, + p_refs, + p_field_type, + data); + + if (p_field->after_callback) { + p_field->after_callback(vars, p_field_type, data); + } + } + + if (p_type->after_callback) { + p_type->after_callback(vars, p_type, data); + } + } + break; + + case e_gs_type_cat_ref : + { + void *dummy = NULL; + void **p_ref = (void **)data; + struct s_gs_cat_ref *p_ref_data = NULL; + int code = 0; + + p_ref_data = p_type->category.ref_data; + + if (p_ref_data->callback) { + code = p_ref_data->callback(vars, p_type, data); + } + + if (p_ref_data->code >= 0) { + code = p_ref_data->code; + } else { + _gs_message_send_type(p_bag, + p_cnx, + vars, + p_refs, + bops->get_type_by_name(p_bag, NULL, "signed int"), + &code); + } + + cops->write (p_cnx, data, p_type->size); + + if (*p_ref && !(gras_dict_retrieve_ext(*p_refs, (char *)p_ref, sizeof(void *), &dummy), dummy)) { + struct s_gs_type *p_ref_type = NULL; + + fprintf(stderr, "sending data referenced at %p\n", *p_ref); + gras_dict_insert_ext(*p_refs, (char *)p_ref, sizeof(void *), p_ref, NULL); + + p_ref_type = _sg_message_send_get_type_by_code(p_bag, p_cnx, vars, code); + + _gs_message_send_type(p_bag, + p_cnx, + vars, + p_refs, + p_ref_type, + *p_ref); + + } else { + /**/ + fprintf(stderr, "not sending data referenced at %p\n", *p_ref); + } + + if (p_type->after_callback) { + p_type->after_callback(vars, p_type, data); + } + } + break; + + case e_gs_type_cat_array : + { + struct s_gs_cat_array *p_array = NULL; + long int count = 0; + struct s_gs_type *p_element_type = NULL; + long int element_size = 0; + char *ptr = data; + + p_array = p_type->category.array_data; + count = p_array->element_count; + + if (count < 0) { + count = p_array->callback(vars, p_type, data); + if (count < 0) + GS_FAILURE("invalid array element count"); + } else if (p_array->callback) { + (void)p_array->callback(vars, p_type, data); + } + + _gs_message_send_type(p_bag, + p_cnx, + vars, + p_refs, + bops->get_type_by_name(p_bag, NULL, "signed long int"), + &count); + + p_element_type = _sg_message_send_get_type_by_code(p_bag, p_cnx, vars, p_array->code); + element_size = p_element_type->aligned_size; + + if (count == 0) + goto empty_array; + + while (count --) { + _gs_message_send_type(p_bag, + p_cnx, + vars, + p_refs, + p_element_type, + ptr); + + ptr += element_size; + } + + empty_array: + if (p_type->after_callback) { + p_type->after_callback(vars, p_type, data); + } + } + break; + + + case e_gs_type_cat_ignored : + { + if (p_type->before_callback) { + p_type->before_callback(vars, p_type, data); + } + } + break; + + default: + GS_FAILURE("invalid type"); + } +} + +struct s_gs_message_instance * +gs_message_init_send_by_ref(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx, + struct s_gs_message *p_message) { + struct s_gs_type_bag_ops *bops = p_bag->bag_ops; + struct s_gs_message_instance *p_message_instance = NULL; + void *vars = NULL; + + vars = gs_vars_alloc(); + + if (!bops->check_message_mark(p_bag, p_cnx, p_message->name)) { + struct s_gs_type *p_message_type = NULL; + gras_dict_t *_refs = NULL; + struct s_gs_type *signed_int = NULL; + + signed_int = bops->get_type_by_name(p_bag, NULL, "signed int"); + p_message_type = bops->get_type_by_name(p_bag, NULL, "_s_gs_message"); + + if (!p_message_type) + GS_FAILURE("_s_gs_message default type missing"); + + bops->mark_message(p_bag, p_cnx, p_message->name); + + _gs_message_send_type(p_bag, p_cnx, vars, &_refs, signed_int, &p_message->code); + _gs_message_send_type(p_bag, p_cnx, vars, &_refs, p_message_type, p_message); + } else { + gras_dict_t *_refs = NULL; + struct s_gs_type *signed_int = NULL; + + _gs_message_send_type(p_bag, p_cnx, vars, &_refs, signed_int, &p_message->code); + } + + gs_vars_free(vars); + + p_message_instance = _gs_message_instance_new(); + + p_message_instance->p_message = p_message; + p_message_instance->current = p_message->first; + p_message_instance->p_bag = p_bag; + p_message_instance->p_connection = p_cnx; + + + return p_message_instance; +} + +struct s_gs_message_instance * +gs_message_init_send_by_name(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name) { + struct s_gs_type_bag_ops *bag_ops = p_bag->bag_ops; + struct s_gs_message *p_message = NULL; + struct s_gs_message_instance *p_message_instance = NULL; + + p_message = bag_ops->get_message_by_name(p_bag, NULL, name); + p_message_instance = gs_message_init_send_by_ref(p_bag, p_connection, p_message); + + return p_message_instance; +} + +struct s_gs_message_instance * +gs_message_init_send_by_code(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + int code) { + struct s_gs_type_bag_ops *bag_ops = p_bag->bag_ops; + struct s_gs_message *p_message = NULL; + struct s_gs_message_instance *p_message_instance = NULL; + + p_message = bag_ops->get_message_by_code(p_bag, NULL, code); + p_message_instance = gs_message_init_send_by_ref(p_bag, p_connection, p_message); + + return p_message_instance; +} + +void +gs_message_send_next_sequence_ext(void *vars, + struct s_gs_message_instance *p_message_instance, + void *data) { + struct s_gs_type_bag *p_bag = p_message_instance->p_bag; + struct s_gs_connection *p_cnx = p_message_instance->p_connection; + struct s_gs_sequence *p_sequence = NULL; + struct s_gs_type *p_type = NULL; + gras_dict_t *refs = NULL; + + p_sequence = p_message_instance->current; + if (!p_sequence) + GS_FAILURE("message type has no more sequences"); + + p_type = _sg_message_send_get_type_by_code(p_bag, p_cnx, vars, p_sequence->code); + _gs_message_send_type(p_message_instance->p_bag, + p_message_instance->p_connection, + vars, + &refs, + p_type, + data); + gras_dict_free(&refs); + p_message_instance->current = p_sequence->next; +} + +void +gs_message_send_next_sequence(struct s_gs_message_instance *p_message_instance, + void *data) { + void *vars = NULL; + + vars = gs_vars_alloc(); + gs_message_send_next_sequence_ext(vars, p_message_instance, data); + gs_vars_free(vars); +} + + +/* recv */ + + +/* + * Note: here we suppose that the remote NULL is a sequence of 'length' bytes set to 0. + */ +static +int +_gs_is_null(void **p_ptr, + long int length) { + int i; + + for (i = 0; i < length; i++) { + if (((unsigned char *)p_ptr)[i]) { + return 0; + } + } + + return 1; +} + + +static +void +_gs_alloc_ref(gras_dict_t **p_refs, + long int size, + void **p_old_ref, + long int length, + void **p_new_ref) { + void *new_ref = NULL; + + new_ref = malloc((size_t)size); + *p_new_ref = new_ref; + + if (p_old_ref && !_gs_is_null(p_old_ref, length)) { + p_old_ref = gs_memdup(p_old_ref, (size_t)length); + p_new_ref = gs_memdup(&new_ref, sizeof(void *)); + + gras_dict_insert_ext(*p_refs,(char *) p_old_ref, length, p_new_ref, NULL); + } +} + +static +void +_gs_convert_elemental(void *local, + struct s_gs_type *p_local_type, + void *remote, + struct s_gs_type *p_remote_type) { + struct s_gs_cat_elemental *p_local_elemental = p_local_type->category.elemental_data; + struct s_gs_cat_elemental *p_remote_elemental = p_remote_type->category.elemental_data; + + (void)local; + (void)remote; + + if (p_local_elemental->encoding == p_remote_elemental->encoding) { + if (p_local_type->size != p_remote_type->size) { + GS_FAILURE("size conversion unimplemented"); + } + } else { + GS_FAILURE("encoding conversion unimplemented"); + } +} + +static +void +_gs_message_receive_type(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx, + gras_dict_t **p_refs, + struct s_gs_type *p_type, + void **p_old_data, + long int old_data_length, + void **p_new_data); + +static +struct s_gs_type * +_sg_message_receive_get_type_by_code(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx, + int code) { + struct s_gs_type_bag_ops *bops = p_bag->bag_ops; + struct s_gs_type *p_type = NULL; + + p_type = bops->get_type_by_code(p_bag, p_cnx, code); + + if (!p_type) { + struct s_gs_type *p_type_type = NULL; + gras_dict_t *_refs = NULL; + + p_type_type = bops->get_type_by_name(p_bag, p_cnx, "_s_gs_type"); + if (!p_type_type) + GS_FAILURE("_s_gs_type default type missing"); + + fprintf(stderr, "need type with code = %d\n", code); + _gs_message_receive_type(p_bag, p_cnx, &_refs, p_type_type, NULL, 0, (void **)&p_type); + fprintf(stderr, "got type with code = %d, name = %s\n", code, p_type->name); + + bops->store_incoming_type(p_bag, p_cnx, p_type); + } else { + fprintf(stderr, "already seen type with code = %d, name = %s\n", code, p_type->name); + } + + + return p_type; +} + +static +void +_gs_message_receive_type(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx, + gras_dict_t **p_refs, + struct s_gs_type *p_remote_type, + void **p_old_ptr, + long int old_ptr_length, + void **p_new_ptr) { + struct s_gs_type_bag_ops *bops = p_bag->bag_ops; + struct s_gs_connection_ops *cops = p_cnx->connection_ops; + struct s_gs_type *p_local_type = NULL; + void *new_data = *p_new_ptr; + + p_local_type = bops->get_type_by_name(p_bag, NULL, p_remote_type->name); + if (p_local_type->category_code > 1) + fprintf(stderr, "\n"); + fprintf(stderr, "receiving a %s\n", p_local_type->name); + + switch (p_remote_type->category_code) { + + case e_gs_type_cat_elemental: + { + if (!new_data) { + _gs_alloc_ref(p_refs, p_local_type->size, p_old_ptr, old_ptr_length, p_new_ptr); + new_data = *p_new_ptr; + } + + if (p_remote_type->size <= p_local_type->size) { + cops->read (p_cnx, new_data, p_remote_type->size); + _gs_convert_elemental(new_data, p_local_type, new_data, p_remote_type); + } else { + void *ptr = NULL; + + ptr = malloc((size_t)p_remote_type->size); + cops->read (p_cnx, ptr, p_remote_type->size); + _gs_convert_elemental(new_data, p_local_type, ptr, p_remote_type); + free(ptr); + } + } + break; + + case e_gs_type_cat_struct : + { + struct s_gs_cat_struct *p_struct = NULL; + + p_struct = p_remote_type->category.struct_data; + + if (!new_data) { + _gs_alloc_ref(p_refs, p_local_type->size, p_old_ptr, old_ptr_length, p_new_ptr); + new_data = *p_new_ptr; + } + + { + int nb_fields = 0; + int i = 0; + + nb_fields = p_struct->nb_fields; + + while (i < nb_fields) { + struct s_gs_cat_struct_field *p_field = NULL; + struct s_gs_type *p_field_type = NULL; + void *ref = NULL; + + p_field = p_struct->field_array[i]; + p_field_type = _sg_message_receive_get_type_by_code(p_bag, p_cnx, p_field->code); + ref = ((char *)new_data) + p_field->offset; + + _gs_message_receive_type(p_bag, + p_cnx, + p_refs, + p_field_type, + NULL, + 0, + &ref); + i++; + } + } + } + break; + + case e_gs_type_cat_union : + { + struct s_gs_cat_union *p_union = NULL; + + p_union = p_remote_type->category.union_data; + + if (!new_data) { + _gs_alloc_ref(p_refs, p_local_type->size, p_old_ptr, old_ptr_length, p_new_ptr); + new_data = *p_new_ptr; + } + + { + int field_num = 0; + struct s_gs_cat_union_field *p_field = NULL; + struct s_gs_type *p_field_type = NULL; + + { + int *p_field_num = &field_num; + + _gs_message_receive_type(p_bag, + p_cnx, + p_refs, + bops->get_type_by_name(p_bag, p_cnx, "signed int"), + NULL, + 0, + (void**)&p_field_num); + } + + p_field = p_union->field_array[field_num]; + p_field_type = _sg_message_receive_get_type_by_code(p_bag, p_cnx, p_field->code); + + _gs_message_receive_type(p_bag, + p_cnx, + p_refs, + p_field_type, + NULL, + 0, + &new_data); + } + } + break; + + case e_gs_type_cat_ref : + { + void **p_old_ref = NULL; + void **p_new_ref = NULL; + struct s_gs_cat_ref *p_ref_data = NULL; + int code = 0; + + p_ref_data = p_remote_type->category.ref_data; + code = p_ref_data->code; + + if (code < 0) { + int *p_code = &code; + + _gs_message_receive_type(p_bag, + p_cnx, + p_refs, + bops->get_type_by_name(p_bag, p_cnx, "signed int"), + NULL, + 0, + (void**)&p_code); + } + + p_old_ref = malloc((size_t)p_remote_type->size); + cops->read (p_cnx, p_old_ref, p_remote_type->size); + + if (!new_data) { + _gs_alloc_ref(p_refs, p_local_type->size, p_old_ptr, old_ptr_length, p_new_ptr); + new_data = *p_new_ptr; + } + + if (!_gs_is_null(p_old_ref, p_remote_type->size)) { + if (!(gras_dict_retrieve_ext(*p_refs, (char *)p_old_ref, p_remote_type->size, (void **)&p_new_ref), p_new_ref)) { + void *new_ref = NULL; + struct s_gs_type *p_ref_type = NULL; + + fprintf(stderr, "receiving data referenced at %p\n", *(void **)p_old_ref); + p_ref_type = _sg_message_receive_get_type_by_code(p_bag, p_cnx, code); + + _gs_message_receive_type(p_bag, + p_cnx, + p_refs, + p_ref_type, + p_old_ref, + p_remote_type->size, + &new_ref); + + *(void **)new_data = new_ref; + } else { + fprintf(stderr, "not receiving data referenced at %p\n", *(void **)p_old_ref); + *(void **)new_data = *p_new_ref; + } + } else { + fprintf(stderr, "not receiving data referenced at %p\n", *(void **)p_old_ref); + *(void **)new_data = NULL; + } + } + break; + + case e_gs_type_cat_array : + { + struct s_gs_cat_array *p_array = NULL; + long int count = 0; + struct s_gs_type *p_element_type = NULL; + struct s_gs_type *p_local_element_type = NULL; + long int element_size = 0; + char *ptr = NULL; + + p_array = p_remote_type->category.array_data; + + { + long int *p_count = &count; + + _gs_message_receive_type(p_bag, + p_cnx, + p_refs, + bops->get_type_by_name(p_bag, p_cnx, "signed long int"), + NULL, + 0, + (void**)&p_count); + } + + p_element_type = _sg_message_receive_get_type_by_code(p_bag, p_cnx, p_array->code); + p_local_element_type = bops->get_type_by_name(p_bag, NULL, p_element_type->name); + element_size = p_local_element_type->aligned_size; + + if (!new_data) { + _gs_alloc_ref(p_refs, count*element_size, p_old_ptr, old_ptr_length, p_new_ptr); + new_data = *p_new_ptr; + } + + ptr = new_data; + + if (!count) + return; + + while (count --) { + _gs_message_receive_type(p_bag, + p_cnx, + p_refs, + p_element_type, + NULL, + 0, + (void**)&ptr); + + ptr += element_size; + } + } + break; + + case e_gs_type_cat_ignored: + { + struct s_gs_cat_ignored *p_ignored = NULL; + + if (!new_data) { + _gs_alloc_ref(p_refs, p_local_type->size, p_old_ptr, old_ptr_length, p_new_ptr); + new_data = *p_new_ptr; + } + + p_ignored = p_local_type->category.ignored_data; + + if (p_ignored->default_value) { + memcpy(new_data, p_ignored->default_value, (size_t)p_local_type->size); + } + } + break; + + + default: + GS_FAILURE("invalid type"); + } +} + +struct s_gs_message_instance * +gs_message_init_receive(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx) { + + struct s_gs_type_bag_ops *bops = p_bag->bag_ops; + struct s_gs_message_instance *p_message_instance = NULL; + int *p_code = NULL; + struct s_gs_message *p_message = NULL; + + { + gras_dict_t *_refs = NULL; + struct s_gs_type *signed_int = NULL; + + signed_int = bops->get_type_by_name(p_bag, p_cnx, "signed int"); + _gs_message_receive_type(p_bag, p_cnx, &_refs, signed_int, NULL, 0, (void**)&p_code); + + p_message = bops->get_message_by_code(p_bag, p_cnx, *p_code); + + if (!p_message) { + struct s_gs_type *p_message_type = NULL; + p_message_type = bops->get_type_by_name(p_bag, p_cnx, "_s_gs_message"); + + if (!p_message_type) + GS_FAILURE("_s_gs_message default type missing"); + + _gs_message_receive_type(p_bag, p_cnx, &_refs, p_message_type, NULL, 0, (void **)&p_message); + + bops->store_incoming_message(p_bag, p_cnx, p_message); + } + } + + p_message_instance = _gs_message_instance_new(); + + p_message_instance->p_message = p_message; + p_message_instance->current = p_message->first; + p_message_instance->p_bag = p_bag; + p_message_instance->p_connection = p_cnx; + + return p_message_instance; +} + +void * +gs_message_receive_next_sequence(struct s_gs_message_instance *p_message_instance) { + struct s_gs_type_bag *p_bag = p_message_instance->p_bag; + struct s_gs_connection *p_cnx = p_message_instance->p_connection; + struct s_gs_sequence *p_sequence = NULL; + struct s_gs_type *p_remote_type = NULL; + gras_dict_t *refs = NULL; + void *data = NULL; + + p_sequence = p_message_instance->current; + if (!p_sequence) + GS_FAILURE("message type has no more sequences"); + + p_remote_type = _sg_message_receive_get_type_by_code(p_bag, p_cnx, p_sequence->code); + _gs_message_receive_type(p_bag, + p_cnx, + &refs, + p_remote_type, + NULL, + 0, + &data); + + gras_dict_free(&refs); + + p_message_instance->current = p_sequence->next; + + return data; +} + diff --git a/src/gras/gs/message.h b/src/gras/gs/message.h new file mode 100644 index 0000000000..ba32599831 --- /dev/null +++ b/src/gras/gs/message.h @@ -0,0 +1,20 @@ +/* gs_message.h */ +#ifndef GS_MESSAGE_H +#define GS_MESSAGE_H + +struct s_gs_message { + int code; + char *name; + + struct s_gs_sequence *first; + struct s_gs_sequence *last; +}; + +struct s_gs_message_instance { + struct s_gs_message *p_message; + struct s_gs_sequence *current; + struct s_gs_type_bag *p_bag; + struct s_gs_connection *p_connection; +}; + +#endif /* GS_MESSAGE_H */ diff --git a/src/gras/gs/net_driver.c b/src/gras/gs/net_driver.c new file mode 100644 index 0000000000..ba7adad0b1 --- /dev/null +++ b/src/gras/gs/net_driver.c @@ -0,0 +1,108 @@ +/* gs_net_driver.c */ + +#include "gs/gs_private.h" + +static +gras_dict_t *p_net_driver_dict = NULL; + +void +gs_net_drivers_init(void) { + gras_dict_insert(p_net_driver_dict, "fd", gs_fd_net_driver(), NULL); +} + + +struct s_gs_net_driver * +gs_net_driver_init(const char *name) { + + struct s_gs_net_driver_ops *net_driver_ops = NULL; + struct s_gs_net_driver *p_net_driver = NULL; + + gras_dict_retrieve(p_net_driver_dict, name, (void **)&net_driver_ops); + if (!net_driver_ops) + GS_FAILURE("net driver not found"); + + p_net_driver = calloc(1, sizeof (struct s_gs_net_driver)); + p_net_driver->net_ops = net_driver_ops; + p_net_driver->connection_ops = NULL; + p_net_driver->specific = NULL; + + if (net_driver_ops->_init) { + net_driver_ops->_init(p_net_driver); + } + + return p_net_driver; +} + + + +void +gs_net_driver_exit(struct s_gs_net_driver *p_net_driver){ + + struct s_gs_net_driver_ops *net_driver_ops = NULL; + + net_driver_ops = p_net_driver->net_ops; + if (net_driver_ops->_exit) { + net_driver_ops->_exit(p_net_driver); + } + + p_net_driver->net_ops = NULL; + + if (p_net_driver->specific) { + free(p_net_driver->specific); + p_net_driver->specific = NULL; + } + + free(p_net_driver); +} + +struct s_gs_connection * +gs_net_connection_connect(struct s_gs_net_driver *p_net_driver, + void *arg) { + + struct s_gs_connection_ops *connection_ops = p_net_driver->connection_ops; + struct s_gs_connection *p_connection = NULL; + + p_connection = malloc(sizeof (struct s_gs_connection)); + p_connection->connection_ops = connection_ops; + p_connection->p_net_driver = p_net_driver; + p_connection->direction = e_gs_connection_direction_outgoing; + + if (connection_ops->_init) { + connection_ops->_init(p_connection, arg); + } + + return p_connection; +} + +struct s_gs_connection * +gs_net_connection_accept(struct s_gs_net_driver *p_net_driver, + void *arg) { + + struct s_gs_connection_ops *connection_ops = p_net_driver->connection_ops; + struct s_gs_connection *p_connection = NULL; + + p_connection = malloc(sizeof (struct s_gs_connection)); + p_connection->connection_ops = connection_ops; + p_connection->p_net_driver = p_net_driver; + p_connection->direction = e_gs_connection_direction_incoming; + + if (connection_ops->_init) { + connection_ops->_init(p_connection, arg); + } + + return p_connection; +} + +void +gs_net_connection_close(struct s_gs_connection *p_connection) { + if (p_connection->connection_ops->_exit) { + p_connection->connection_ops->_exit(p_connection); + } + + if (p_connection->specific) { + free(p_connection->specific); + p_connection->specific = NULL; + } + + free(p_connection); +} diff --git a/src/gras/gs/net_driver.h b/src/gras/gs/net_driver.h new file mode 100644 index 0000000000..0a74bbd61b --- /dev/null +++ b/src/gras/gs/net_driver.h @@ -0,0 +1,25 @@ +/* gs_net_driver.h */ +#ifndef GS_NET_DRIVER_H +#define GS_NET_DRIVER_H + +/* used structs */ +struct s_gs_connection; +struct s_gs_net_driver; + +struct s_gs_net_driver_ops { + + void + (*_init) (struct s_gs_net_driver *p_net_driver); + + void + (*_exit) (struct s_gs_net_driver *p_net_driver); +}; + +struct s_gs_net_driver { + struct s_gs_net_driver_ops *net_ops; + struct s_gs_connection_ops *connection_ops; + void *specific; +}; + + +#endif /* GS_NET_DRIVER_H */ diff --git a/src/gras/gs/net_driver_fd.c b/src/gras/gs/net_driver_fd.c new file mode 100644 index 0000000000..fe36c0f9da --- /dev/null +++ b/src/gras/gs/net_driver_fd.c @@ -0,0 +1,149 @@ +/* gs_fd_net_driver.c */ + +#include "gs/gs_private.h" + +struct s_gs_fd_net_driver { + /**/ + int dummy; +}; + +struct s_gs_fd_connection { + int fd; +}; + +static +struct s_gs_net_driver_ops *net_driver_ops = NULL; + +static +struct s_gs_connection_ops *connection_ops = NULL; + +struct s_gs_net_driver_ops * +gs_fd_net_driver(void) { + if (!connection_ops) { + connection_ops = calloc(1, sizeof(struct s_gs_connection_ops)); + + connection_ops->_init = gs_fd_connection__init; + connection_ops->_exit = gs_fd_connection__exit; + connection_ops->write = gs_fd_connection_write; + connection_ops->read = gs_fd_connection_read; + connection_ops->flush = gs_fd_connection_flush; + } + + if (!net_driver_ops) { + net_driver_ops = calloc(1, sizeof(struct s_gs_net_driver_ops)); + + net_driver_ops->_init = gs_fd__init; + net_driver_ops->_exit = gs_fd__exit; + } + + return net_driver_ops; +} + +void +gs_fd__init(struct s_gs_net_driver *p_net_driver) { + + struct s_gs_fd_net_driver *p_fd = NULL; + + p_fd = calloc(1, sizeof(struct s_gs_fd_net_driver)); + p_net_driver->connection_ops = connection_ops; + p_net_driver->specific = p_fd; +} + +void +gs_fd__exit(struct s_gs_net_driver *p_net_driver) { + + struct s_gs_fd_net_driver *p_fd = p_net_driver->specific; + + free(p_fd); + + p_net_driver->specific = NULL; +} + + +void +gs_fd_connection__init(struct s_gs_connection *p_connection, + void *arg) { + + struct s_gs_fd_net_connection_arg *p_fd_arg = arg; + struct s_gs_fd_connection *p_fd_cnx = NULL; + + p_fd_cnx = calloc(1, sizeof(struct s_gs_fd_connection)); + p_fd_cnx->fd = p_fd_arg->fd; + p_connection->specific = p_fd_cnx; +} + +void +gs_fd_connection__exit(struct s_gs_connection *p_connection) { + struct s_gs_fd_connection *p_fd_cnx = p_connection->specific; + + free(p_fd_cnx); + + p_connection->specific = NULL; +} + +void +gs_fd_connection_write(struct s_gs_connection *p_connection, + void *_ptr, + long int length) { + struct s_gs_fd_connection *p_fd_cnx = p_connection->specific; + unsigned char *ptr = _ptr; + + if (p_connection->direction != e_gs_connection_direction_outgoing) + GS_FAILURE("invalid operation"); + + while (length) { + int status = 0; + + status = write(p_fd_cnx->fd, ptr, (size_t)length); + fprintf(stderr, "write(%d, %p, %ld);\n", p_fd_cnx->fd, ptr, length); + + if (status == -1) { + perror("write"); + GS_FAILURE("system call failed"); + } + + if (status) { + length -= status; + ptr += status; + } else { + GS_FAILURE("file descriptor closed"); + } + } +} + +void +gs_fd_connection_read(struct s_gs_connection *p_connection, + void *_ptr, + long int length) { + struct s_gs_fd_connection *p_fd_cnx = p_connection->specific; + unsigned char *ptr = _ptr; + + if (p_connection->direction != e_gs_connection_direction_incoming) + GS_FAILURE("invalid operation"); + + while (length) { + int status = 0; + + status = read(p_fd_cnx->fd, ptr, (size_t)length); + fprintf(stderr, "read(%d, %p, %ld);\n", p_fd_cnx->fd, ptr, length); + + if (status == -1) { + perror("write"); + GS_FAILURE("system call failed"); + } + + if (status) { + length -= status; + ptr += status; + } else { + GS_FAILURE("file descriptor closed"); + } + } +} +void +gs_fd_connection_flush(struct s_gs_connection *p_connection) { + (void)p_connection; + + /* */ +} + diff --git a/src/gras/gs/net_interface_fd.h b/src/gras/gs/net_interface_fd.h new file mode 100644 index 0000000000..2dea2b645e --- /dev/null +++ b/src/gras/gs/net_interface_fd.h @@ -0,0 +1,40 @@ +/* gs_fd_net_interface.h */ +#ifndef GS_FD_NET_INTERFACE_H +#define GS_FD_NET_INTERFACE_H + + +struct s_gs_fd_net_connection_arg { + int fd; +}; + +struct s_gs_net_driver_ops * +gs_fd_net_driver(void); + + +void +gs_fd__init(struct s_gs_net_driver *p_driver); + + +void +gs_fd__exit(struct s_gs_net_driver *p_driver); + + +void +gs_fd_connection__init(struct s_gs_connection *p_connection, + void *arg); + +void +gs_fd_connection__exit(struct s_gs_connection *p_connection); + +void +gs_fd_connection_write(struct s_gs_connection *p_connection, + void *ptr, + long int length); + +void +gs_fd_connection_read(struct s_gs_connection *p_connection, + void *ptr, + long int length); +void +gs_fd_connection_flush(struct s_gs_connection *p_connection); +#endif /* GS_FD_NET_INTERFACE_H */ diff --git a/src/gras/gs/parse.c b/src/gras/gs/parse.c new file mode 100644 index 0000000000..20b9cb5f14 --- /dev/null +++ b/src/gras/gs/parse.c @@ -0,0 +1,459 @@ +/* $Id$ */ + +/* gs/parse.c -- automatic parsing of data structures */ + +/* Authors: Arnaud Legrand, Martin Quinson */ + +#include "gs/gs_private.h" +#include "gs/parse.yy.h" + +GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(NDR_parse,NDR); + +typedef struct s_type_modifier{ + short is_unsigned; + short is_short; + short is_long; + + short is_struct; + short is_union; + short is_enum; + + short is_ref; +} type_modifier_t; + +extern char *gs_parse_text; + +/* prototypes */ +static void parse_type_modifier(type_modifier_t *type_modifier); +static void print_type_modifier(type_modifier_t type_modifier); + +static gras_error_t parse_statement(gras_type_bag_t *p_bag, + const char *definition, + gras_dynar_t **dynar); +static gras_type_t * parse_struct(gras_type_bag_t *p_bag, + const char *definition); +static gras_type_t * parse_typedef(gras_type_bag_t *p_bag, + const char *definition); + +/* local functions */ +static void parse_type_modifier(type_modifier_t *type_modifier) { + do { + if (gs_parse_tok_num == GS_PARSE_TOKEN_STAR) { + DEBUG0("This is a reference"); + type_modifier->is_ref++; + + } else if (!strcmp(gs_parse_text,"unsigned")) { + DEBUG0("This is an unsigned"); + type_modifier->is_unsigned = 1; + + } else if (!strcmp(gs_parse_text,"short")) { + DEBUG0("This is short"); + type_modifier->is_short = 1; + + } else if (!strcmp(gs_parse_text,"long")) { + DEBUG0("This is long"); + type_modifier->is_long++; /* "long long" needs love */ + + } else if (!strcmp(gs_parse_text,"struct")) { + DEBUG0("This is a struct"); + type_modifier->is_struct = 1; + + } else if (!strcmp(gs_parse_text,"union")) { + DEBUG0("This is an union"); + type_modifier->is_union = 1; + + } else if (!strcmp(gs_parse_text,"enum")) { + DEBUG0("This is an enum"); + type_modifier->is_enum = 1; + + } else { + break; + } + + + gs_parse_tok_num = gs_parse_lex_n_dump(); + if((gs_parse_tok_num != GS_PARSE_TOKEN_WORD) && + (gs_parse_tok_num != GS_PARSE_TOKEN_STAR)) + break; + } while(1); +} + +static void print_type_modifier(type_modifier_t tm) { + int i; + + if (tm.is_unsigned) printf("(unsigned) "); + if (tm.is_short) printf("(short) "); + for (i=0 ; ibag_ops->get_type_by_name(bag, NULL, buffname); + if (!res) { + res = gs_type_new_union(bag,NULL,buffname); + } + */ + + } else if (tm.is_enum) { + fprintf(stderr, + "Cannot handle enum yet (need grassouillet's love), sorry. Definition was:\n%s\n", + definition); + abort(); + /* FIXME + sprintf(buffname,"enum %s",base_type); + res = bag->bag_ops->get_type_by_name(bag, NULL, bufname); + if (!res) { + res = gs_type_new_enum(bag,connection,buffname); + } + */ + + } else if (tm.is_struct) { + sprintf(buffname,"struct %s",base_type); + res = bag->bag_ops->get_type_by_name(bag, NULL, buffname); + if (!res) { + res = gs_type_new_struct(bag,NULL,buffname); + } + + /* Let's code like Alvin ;) */ +#define gs_parse_get_or_create(name,func) \ + (bag->bag_ops->get_type_by_name(bag, NULL, #name) ? \ + bag->bag_ops->get_type_by_name(bag, NULL, #name) : \ + gs_type_new_##func##_elemental(bag, NULL, \ + #name, sizeof(name)) \ + ) + + } else if (tm.is_unsigned) { + if (!strcmp(base_type,"int")) { + if (tm.is_long == 2) { + res = gs_parse_get_or_create(unsigned long long int,unsigned_integer); + } else if (tm.is_long) { + res = gs_parse_get_or_create(unsigned long int,unsigned_integer); + } else if (tm.is_short) { + res = gs_parse_get_or_create(unsigned short int,unsigned_integer); + } else { + res = gs_parse_get_or_create(unsigned int,unsigned_integer); + } + + } else if (!strcmp(base_type, "char")) { + res = gs_parse_get_or_create(unsigned char,unsigned_integer); + + } else { /* impossible, gcc parses this shit before us */ + abort(); + } + + } else if (!strcmp(base_type, "float")) { + /* no modificator allowed by gcc */ + res = gs_parse_get_or_create(float,floating_point); + + } else { /* signed integer elemental */ + if (!strcmp(base_type,"int")) { + if (tm.is_long == 2) { + res = gs_parse_get_or_create(signed long long int,signed_integer); + } else if (tm.is_long) { + res = gs_parse_get_or_create(signed long int,signed_integer); + } else if (tm.is_short) { + res = gs_parse_get_or_create(signed short int,signed_integer); + } else { + res = gs_parse_get_or_create(int,unsigned_integer); + } + + } else if (!strcmp(base_type, "char")) { + res = gs_parse_get_or_create(char,unsigned_integer); + + } else { /* impossible */ + abort(); + } + + } + + if (tm.is_ref) { + fprintf(stderr, + "Cannot handle references yet (need annotations), sorry. Definition was:\n%s\n", + definition); + abort(); + /* Should build ref on the current res (beware of int****) */ + } + + /**** look for the symbols of this type ****/ + expect_a_colon = 0; + for( /* no initialization */ ; + + ((gs_parse_tok_num != GS_PARSE_TOKEN_EMPTY) && + (gs_parse_tok_num != GS_PARSE_TOKEN_SEMI_COLON)) ; + + gs_parse_tok_num = gs_parse_lex_n_dump() ) { + + if(expect_a_colon) { + if(gs_parse_tok_num == GS_PARSE_TOKEN_COLON) { + expect_a_colon = 0; + continue; + } else { + fprintf(stderr, + "Unparsable symbol: Expected a comma (','), got '%s' instead. Definition was:\n%s\n", + gs_parse_text, definition); + abort(); + } + } else if(gs_parse_tok_num == GS_PARSE_TOKEN_COLON) { + fprintf(stderr, + "Unparsable symbol: Unexpected comma (','). Definition was:\n%s\n", + definition); + abort(); + } + + if(gs_parse_tok_num == GS_PARSE_TOKEN_STAR) { + starred = 1; + } + + /* found a symbol name. Build the type and push it to dynar */ + if(gs_parse_tok_num == GS_PARSE_TOKEN_WORD) { + if (starred) { + /* FIXME: Build a ref or array on the base type */ + fprintf(stderr, + "Cannot handle references yet (need annotations), sorry. Definition was:\n%s\n", + definition); + abort(); + } + DEBUG1("Encountered the variable (field?) %s",gs_parse_text); + + TRY(gras_dynar_push(*dynar, &gs_type_copy(base_type))); + starred = 0; + expect_a_colon = 1; + continue; + } + + fprintf(stderr, + "Unparasable symbol: Maybe a def struct in a def struct or so. The definition was:\n%s\n", + definition); + abort(); + } + + DEBUG0("End of this statement"); + return no_error; +} + +static gras_type_t *parse_struct(gras_type_bag_t *bag, + const char *definition) { + + gras_error_t errcode; + char buffname[32]; + static int anonymous_struct=0; + + gras_dynar_t *fields; + + gras_type_t *field; + int i; + + gras_type_t *struct_type; + + errcode=gras_dynar_new(&fields,sizeof(gras_type_t*),NULL); + if (errcode != no_error) + return NULL; + /* FIXME: the dynar content leaks because there is no gs_type_free. + But that's not a problem because each member are the same element since there is no gs_type_copy ;) + */ + + /* Create the struct descriptor */ + if (gs_parse_tok_num == GS_PARSE_TOKEN_WORD) { + struct_type = gs_type_new_struct(bag,NULL, gs_parse_text); + DEBUG1("Parse the struct '%s'", gs_parse_text); + gs_parse_tok_num = gs_parse_lex_n_dump(); + } else { + sprintf(buffname,"anonymous struct %d",anonymous_struct++); + DEBUG1("Parse the anonymous struct nb %d", anonymous_struct); + struct_type = gs_type_new_struct(bag,NULL,buffname); + } + + if (gs_parse_tok_num != GS_PARSE_TOKEN_LP) { + fprintf(stderr, + "Unparasable symbol: I looked for a struct definition, but got %s instead of '{'. The definition was:\n%s\n", + gs_parse_text,definition); + abort(); + } + + /* Parse the fields */ + for (errcode=parse_statement(bag,definition,&fields); + errcode == no_error ; + errcode=parse_statement(bag,definition,&fields)) { + + DEBUG1("This statement contained %d fields",gras_dynar_length(fields)); + gras_dynar_foreach(fields,i, field) { + char fname[128]; + static int field_count=0; + sprintf(fname,"%d",field_count++); + DEBUG0("Append a field"); + gs_type_struct_append_field(struct_type,fname,field); + } + } + if (errcode != mismatch_error) + return NULL; /* FIXME: LEAK! */ + + /* terminates */ + if (gs_parse_tok_num != GS_PARSE_TOKEN_RP) { + fprintf(stderr, + "Unparasable symbol: Expected '}' at the end of struct definition, got '%s'. The definition was:\n%s\n", + gs_parse_text,definition); + abort(); + } + + gs_parse_tok_num = gs_parse_lex_n_dump(); + + gras_dynar_free(fields); + return struct_type; +} + +static gras_type_t * parse_typedef(gras_type_bag_t *bag, + const char *definition) { + + type_modifier_t tm; + + gras_type_t *struct_desc=NULL; + gras_type_t *typedef_desc=NULL; + + memset(&tm,0,sizeof(tm)); + + /* get the aliased type */ + parse_type_modifier(&tm); + + if (tm.is_struct) { + struct_desc = parse_struct(bag,definition); + } + + parse_type_modifier(&tm); + + if (tm.is_ref) { + fprintf(stderr, + "Cannot handle reference without annotation. Definition was:\n%s\n", + definition); + abort(); + } + + /* get the aliasing name */ + if (gs_parse_tok_num != GS_PARSE_TOKEN_WORD) { + fprintf(stderr, + "Unparsable typedef: Expected the alias name, and got '%s'.\n%s\n", + gs_parse_text,definition); + abort(); + } + + /* (FIXME: should) build the alias */ + fprintf(stderr, "Cannot handle typedef yet (need love from grassouillet), sorry. Definition was: \n%s\n",definition); + abort(); + + // res=gs_type_new_typedef(bag, NULL, strdup(gs_parse_text) ); + + return typedef_desc; +} + +/* main function */ +gras_type_t * +_gs_type_parse(gras_type_bag_t *bag, + const char *definition) { + + gras_type_t * res=NULL; + + /* init */ + DEBUG1("_gs_type_parse(%s)",definition); + gs_parse_pointer_string_init(definition); + + /* Do I have a typedef, or a raw struct ?*/ + gs_parse_tok_num = gs_parse_lex_n_dump(); + + if ((gs_parse_tok_num == GS_PARSE_TOKEN_WORD) && (!strcmp(gs_parse_text,"struct"))) { + gs_parse_tok_num = gs_parse_lex_n_dump(); + res = parse_struct(bag,definition); + + } else if ((gs_parse_tok_num == GS_PARSE_TOKEN_WORD) && (!strcmp(gs_parse_text,"typedef"))) { + gs_parse_tok_num = gs_parse_lex_n_dump(); + res = parse_typedef(bag,definition); + + } else { + fprintf(stderr,"Failed to parse the following symbol (not a struct neither a typedef) :\n%s\n",definition); + abort(); + } + + gs_parse_pointer_string_close(); + DEBUG1("end of _gs_type_parse(%s)",definition); + + return res; +} + + diff --git a/src/gras/gs/parse.yy.c b/src/gras/gs/parse.yy.c new file mode 100644 index 0000000000..d7cadbdd34 --- /dev/null +++ b/src/gras/gs/parse.yy.c @@ -0,0 +1,1833 @@ +#define yy_create_buffer gs_parse__create_buffer +#define yy_delete_buffer gs_parse__delete_buffer +#define yy_scan_buffer gs_parse__scan_buffer +#define yy_scan_string gs_parse__scan_string +#define yy_scan_bytes gs_parse__scan_bytes +#define yy_flex_debug gs_parse__flex_debug +#define yy_init_buffer gs_parse__init_buffer +#define yy_flush_buffer gs_parse__flush_buffer +#define yy_load_buffer_state gs_parse__load_buffer_state +#define yy_switch_to_buffer gs_parse__switch_to_buffer +#define yyin gs_parse_in +#define yyleng gs_parse_leng +#define yylex gs_parse_lex +#define yyout gs_parse_out +#define yyrestart gs_parse_restart +#define yytext gs_parse_text + +#line 19 "gs/parse.yy.c" +/* A lexical scanner generated by flex */ + +/* Scanner skeleton version: + * + */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 + +#include +#include + +/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ +#ifdef c_plusplus +#ifndef __cplusplus +#define __cplusplus +#endif +#endif + + +#ifdef __cplusplus + +#include +#ifndef _WIN32 +#include +#endif + +/* Use prototypes in function declarations. */ +#define YY_USE_PROTOS + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +#if __STDC__ + +#define YY_USE_PROTOS +#define YY_USE_CONST + +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ + +#ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use +#include +#include +#define YY_USE_CONST +#define YY_USE_PROTOS +#endif + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + + +#ifdef YY_USE_PROTOS +#define YY_PROTO(proto) proto +#else +#define YY_PROTO(proto) () +#endif + + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#define YY_BUF_SIZE 16384 + +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +extern int yyleng; +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + +/* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + +/* Return all but the first 'n' matched characters back to the input stream. */ + +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yytext_ptr ) + +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ +typedef unsigned int yy_size_t; + + +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + }; + +static YY_BUFFER_STATE yy_current_buffer = 0; + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + */ +#define YY_CURRENT_BUFFER yy_current_buffer + + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; + +static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart YY_PROTO(( FILE *input_file )); + +void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); +void yy_load_buffer_state YY_PROTO(( void )); +YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); +void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); +void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); +void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); +#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) + +YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); +YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); +YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); + +static void *yy_flex_alloc YY_PROTO(( yy_size_t )); +static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); +static void yy_flex_free YY_PROTO(( void * )); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + + +#define yywrap() 1 +#define YY_SKIP_YYWRAP +typedef unsigned char YY_CHAR; +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; +typedef int yy_state_type; +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state YY_PROTO(( void )); +static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); +static int yy_get_next_buffer YY_PROTO(( void )); +static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 28 +#define YY_END_OF_BUFFER 29 +static yyconst short int yy_accept[51] = + { 0, + 20, 20, 4, 4, 0, 0, 0, 0, 29, 27, + 26, 8, 23, 25, 20, 27, 24, 21, 22, 4, + 6, 5, 28, 28, 19, 10, 9, 28, 20, 2, + 1, 4, 5, 5, 7, 3, 19, 18, 11, 12, + 16, 17, 13, 15, 14, 1, 11, 12, 11, 0 + } ; + +static yyconst int yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, + 1, 4, 1, 5, 6, 6, 7, 8, 8, 8, + 8, 8, 8, 8, 8, 9, 9, 1, 10, 1, + 1, 1, 1, 1, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 1, 11, 1, 1, 6, 1, 6, 12, 6, 6, + + 6, 13, 6, 6, 6, 6, 6, 6, 6, 14, + 6, 6, 6, 15, 6, 16, 6, 6, 6, 6, + 6, 6, 17, 1, 18, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst int yy_meta[19] = + { 0, + 1, 2, 3, 4, 1, 5, 1, 5, 5, 1, + 3, 5, 5, 5, 5, 5, 1, 1 + } ; + +static yyconst short int yy_base[59] = + { 0, + 0, 0, 17, 18, 81, 78, 21, 31, 83, 102, + 102, 102, 102, 102, 0, 21, 102, 102, 102, 0, + 102, 22, 102, 37, 0, 102, 102, 42, 0, 102, + 0, 0, 23, 31, 102, 102, 0, 102, 28, 31, + 102, 102, 102, 102, 102, 0, 53, 55, 57, 102, + 66, 71, 76, 26, 81, 86, 91, 96 + } ; + +static yyconst short int yy_def[59] = + { 0, + 50, 1, 51, 51, 52, 52, 53, 53, 50, 50, + 50, 50, 50, 50, 54, 50, 50, 50, 50, 55, + 50, 56, 50, 50, 57, 50, 50, 50, 54, 50, + 58, 55, 56, 56, 50, 50, 57, 50, 50, 50, + 50, 50, 50, 50, 50, 58, 50, 50, 50, 0, + 50, 50, 50, 50, 50, 50, 50, 50 + } ; + +static yyconst short int yy_nxt[121] = + { 0, + 10, 11, 12, 13, 14, 15, 16, 15, 15, 17, + 10, 15, 15, 15, 15, 15, 18, 19, 21, 21, + 22, 22, 26, 27, 30, 34, 50, 31, 35, 50, + 29, 28, 26, 27, 34, 47, 48, 35, 48, 48, + 36, 28, 38, 38, 38, 38, 38, 38, 38, 39, + 40, 38, 38, 41, 42, 43, 44, 45, 38, 38, + 49, 48, 48, 48, 48, 48, 20, 20, 20, 20, + 20, 23, 23, 23, 23, 23, 25, 25, 25, 25, + 25, 32, 50, 32, 24, 32, 33, 24, 33, 33, + 33, 37, 50, 50, 37, 37, 46, 50, 46, 46, + + 46, 9, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50 + } ; + +static yyconst short int yy_chk[121] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 4, + 3, 4, 7, 7, 16, 22, 33, 16, 22, 33, + 54, 7, 8, 8, 34, 39, 39, 34, 40, 40, + 24, 8, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 47, 47, 48, 48, 49, 49, 51, 51, 51, 51, + 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, + 53, 55, 9, 55, 6, 55, 56, 5, 56, 56, + 56, 57, 0, 0, 57, 57, 58, 0, 58, 58, + + 58, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "gs/parse.yy.l" +#define INITIAL 0 +/**** MSG_LICENCE DO NOT REMOVE ****/ +#line 5 "gs/parse.yy.l" +#include"gs/gs_private.h" +#include"gs/parse.yy.h" +#include + YY_BUFFER_STATE input_buffer; + FILE *file_to_parse; + + int gs_parse_line_pos = 1; + int gs_parse_char_pos = 0; + int gs_parse_tok_num = 0; +#define comment 1 +#define foo 2 +#define str 3 + +#line 441 "gs/parse.yy.c" + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap YY_PROTO(( void )); +#else +extern int yywrap YY_PROTO(( void )); +#endif +#endif + +#ifndef YY_NO_UNPUT +static void yyunput YY_PROTO(( int c, char *buf_ptr )); +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen YY_PROTO(( yyconst char * )); +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus +static int yyinput YY_PROTO(( void )); +#else +static int input YY_PROTO(( void )); +#endif +#endif + +#if YY_STACK_USED +static int yy_start_stack_ptr = 0; +static int yy_start_stack_depth = 0; +static int *yy_start_stack = 0; +#ifndef YY_NO_PUSH_STATE +static void yy_push_state YY_PROTO(( int new_state )); +#endif +#ifndef YY_NO_POP_STATE +static void yy_pop_state YY_PROTO(( void )); +#endif +#ifndef YY_NO_TOP_STATE +static int yy_top_state YY_PROTO(( void )); +#endif + +#else +#define YY_NO_PUSH_STATE 1 +#define YY_NO_POP_STATE 1 +#define YY_NO_TOP_STATE 1 +#endif + +#ifdef YY_MALLOC_DECL +YY_MALLOC_DECL +#else +#if __STDC__ +#ifndef __cplusplus +#include +#endif +#else +/* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ +#endif +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ + +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( yy_current_buffer->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + } +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL int yylex YY_PROTO(( void )) +#endif + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 21 "gs/parse.yy.l" + + int comment_caller=0; + + char string_buf[GS_PARSE_MAX_STR_CONST]; + char *string_buf_ptr = NULL; + +#line 610 "gs/parse.yy.c" + + if ( yy_init ) + { + yy_init = 0; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yy_start; +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 51 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 102 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + + +do_action: /* This label is used only to access EOF actions. */ + + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yy_hold_char; + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 27 "gs/parse.yy.l" + + YY_BREAK +case 2: +YY_RULE_SETUP +#line 28 "gs/parse.yy.l" +{ + comment_caller = INITIAL; + BEGIN(comment); + } + YY_BREAK +case 3: +YY_RULE_SETUP +#line 33 "gs/parse.yy.l" +{ + comment_caller = foo; + BEGIN(comment); + } + YY_BREAK +case 4: +YY_RULE_SETUP +#line 38 "gs/parse.yy.l" +/* eat anything that's not a '*' */ + YY_BREAK +case 5: +YY_RULE_SETUP +#line 39 "gs/parse.yy.l" +/* eat up '*'s not followed by '/'s */ + YY_BREAK +case 6: +YY_RULE_SETUP +#line 40 "gs/parse.yy.l" +{++gs_parse_line_pos;gs_parse_char_pos=0;} + YY_BREAK +case 7: +YY_RULE_SETUP +#line 41 "gs/parse.yy.l" +BEGIN(comment_caller); + YY_BREAK +case 8: +YY_RULE_SETUP +#line 43 "gs/parse.yy.l" +string_buf_ptr = string_buf; gs_parse_char_pos++; BEGIN(str); + YY_BREAK +case 9: +YY_RULE_SETUP +#line 45 "gs/parse.yy.l" +{ /* saw closing quote - all done */ + BEGIN(INITIAL); + *string_buf_ptr = '\0'; + yytext=string_buf; + gs_parse_char_pos++; + return GS_PARSE_TOKEN_WORD; + /* return string constant token type and + * value to parser + */ + } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 56 "gs/parse.yy.l" +{ + /* error - unterminated string constant */ + /* generate error message */ + } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 61 "gs/parse.yy.l" +{ + /* octal escape sequence */ + int result; + + (void) sscanf( yytext + 1, "%o", &result ); + + if ( result > 0xff ) + /* error, constant is out-of-bounds */ + + *string_buf_ptr++ = result; + gs_parse_char_pos++; + } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 74 "gs/parse.yy.l" +{ + /* generate error - bad escape sequence; something + * like '\48' or '\0777777' + */ + } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 80 "gs/parse.yy.l" +{*string_buf_ptr++ = '\n'; gs_parse_char_pos++;} + YY_BREAK +case 14: +YY_RULE_SETUP +#line 81 "gs/parse.yy.l" +{*string_buf_ptr++ = '\t'; gs_parse_char_pos++;} + YY_BREAK +case 15: +YY_RULE_SETUP +#line 82 "gs/parse.yy.l" +{*string_buf_ptr++ = '\r'; gs_parse_char_pos++;} + YY_BREAK +case 16: +YY_RULE_SETUP +#line 83 "gs/parse.yy.l" +{*string_buf_ptr++ = '\b'; gs_parse_char_pos++;} + YY_BREAK +case 17: +YY_RULE_SETUP +#line 84 "gs/parse.yy.l" +{*string_buf_ptr++ = '\f'; gs_parse_char_pos++;} + YY_BREAK +case 18: +YY_RULE_SETUP +#line 86 "gs/parse.yy.l" +{*string_buf_ptr++ = yytext[1]; + if(yytext[1]=='\n') { + ++gs_parse_line_pos;gs_parse_char_pos=0; + } else { gs_parse_char_pos++;} + } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 92 "gs/parse.yy.l" +{ + char *yptr = yytext; + + while ( *yptr ) + *string_buf_ptr++ = *yptr++; + gs_parse_char_pos++; + } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 100 "gs/parse.yy.l" +{ gs_parse_char_pos+= strlen(yytext); return(GS_PARSE_TOKEN_WORD);} + YY_BREAK +case 21: +YY_RULE_SETUP +#line 101 "gs/parse.yy.l" +{ gs_parse_char_pos++; return(GS_PARSE_TOKEN_LP);} + YY_BREAK +case 22: +YY_RULE_SETUP +#line 102 "gs/parse.yy.l" +{ gs_parse_char_pos++;return(GS_PARSE_TOKEN_RP);} + YY_BREAK +case 23: +YY_RULE_SETUP +#line 103 "gs/parse.yy.l" +{ gs_parse_char_pos++;return(GS_PARSE_TOKEN_STAR);} + YY_BREAK +case 24: +YY_RULE_SETUP +#line 104 "gs/parse.yy.l" +{ gs_parse_char_pos++;return(GS_PARSE_TOKEN_SEMI_COLON);} + YY_BREAK +case 25: +YY_RULE_SETUP +#line 105 "gs/parse.yy.l" +{ gs_parse_char_pos++;return(GS_PARSE_TOKEN_COLON);} + YY_BREAK +case 26: +YY_RULE_SETUP +#line 106 "gs/parse.yy.l" +{ gs_parse_line_pos++; gs_parse_char_pos=0;} + YY_BREAK +case 27: +YY_RULE_SETUP +#line 107 "gs/parse.yy.l" +{ gs_parse_char_pos++;} + YY_BREAK +case 28: +YY_RULE_SETUP +#line 108 "gs/parse.yy.l" +ECHO; + YY_BREAK +#line 876 "gs/parse.yy.c" +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(comment): +case YY_STATE_EOF(foo): +case YY_STATE_EOF(str): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ + + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ + +static int yy_get_next_buffer() + { + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_current_buffer->yy_n_chars = yy_n_chars = 0; + + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ +#ifdef YY_USES_REJECT + YY_FATAL_ERROR( +"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); +#else + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; + + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; +#endif + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + if ( yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + + return ret_val; + } + + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + +static yy_state_type yy_get_previous_state() + { + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = yy_start; + + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 51 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; + } + + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + +#ifdef YY_USE_PROTOS +static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) +#else +static yy_state_type yy_try_NUL_trans( yy_current_state ) +yy_state_type yy_current_state; +#endif + { + register int yy_is_jam; + register char *yy_cp = yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 51 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 50); + + return yy_is_jam ? 0 : yy_current_state; + } + + +#ifndef YY_NO_UNPUT +#ifdef YY_USE_PROTOS +static void yyunput( int c, register char *yy_bp ) +#else +static void yyunput( c, yy_bp ) +int c; +register char *yy_bp; +#endif + { + register char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_current_buffer->yy_n_chars = + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } +#endif /* ifndef YY_NO_UNPUT */ + + +#ifdef __cplusplus +static int yyinput() +#else +static int input() +#endif + { + int c; + + *yy_c_buf_p = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yy_c_buf_p - yytext_ptr; + ++yy_c_buf_p; + + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /* fall through */ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + return EOF; + + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; + + + return c; + } + + +#ifdef YY_USE_PROTOS +void yyrestart( FILE *input_file ) +#else +void yyrestart( input_file ) +FILE *input_file; +#endif + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + +#ifdef YY_USE_PROTOS +void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) +#else +void yy_switch_to_buffer( new_buffer ) +YY_BUFFER_STATE new_buffer; +#endif + { + if ( yy_current_buffer == new_buffer ) + return; + + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } + + +#ifdef YY_USE_PROTOS +void yy_load_buffer_state( void ) +#else +void yy_load_buffer_state() +#endif + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) +#else +YY_BUFFER_STATE yy_create_buffer( file, size ) +FILE *file; +int size; +#endif + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; + } + + +#ifdef YY_USE_PROTOS +void yy_delete_buffer( YY_BUFFER_STATE b ) +#else +void yy_delete_buffer( b ) +YY_BUFFER_STATE b; +#endif + { + if ( ! b ) + return; + + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + +#ifndef _WIN32 +#include +#else +#ifndef YY_ALWAYS_INTERACTIVE +#ifndef YY_NEVER_INTERACTIVE +extern int isatty YY_PROTO(( int )); +#endif +#endif +#endif + +#ifdef YY_USE_PROTOS +void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) +#else +void yy_init_buffer( b, file ) +YY_BUFFER_STATE b; +FILE *file; +#endif + + + { + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + +#if YY_ALWAYS_INTERACTIVE + b->yy_is_interactive = 1; +#else +#if YY_NEVER_INTERACTIVE + b->yy_is_interactive = 0; +#else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; +#endif +#endif + } + + +#ifdef YY_USE_PROTOS +void yy_flush_buffer( YY_BUFFER_STATE b ) +#else +void yy_flush_buffer( b ) +YY_BUFFER_STATE b; +#endif + + { + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == yy_current_buffer ) + yy_load_buffer_state(); + } + + +#ifndef YY_NO_SCAN_BUFFER +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) +#else +YY_BUFFER_STATE yy_scan_buffer( base, size ) +char *base; +yy_size_t size; +#endif + { + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; + } +#endif + + +#ifndef YY_NO_SCAN_STRING +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) +#else +YY_BUFFER_STATE yy_scan_string( yy_str ) +yyconst char *yy_str; +#endif + { + int len; + for ( len = 0; yy_str[len]; ++len ) + ; + + return yy_scan_bytes( yy_str, len ); + } +#endif + + +#ifndef YY_NO_SCAN_BYTES +#ifdef YY_USE_PROTOS +YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) +#else +YY_BUFFER_STATE yy_scan_bytes( bytes, len ) +yyconst char *bytes; +int len; +#endif + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; + } +#endif + + +#ifndef YY_NO_PUSH_STATE +#ifdef YY_USE_PROTOS +static void yy_push_state( int new_state ) +#else +static void yy_push_state( new_state ) +int new_state; +#endif + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } +#endif + + +#ifndef YY_NO_POP_STATE +static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } +#endif + + +#ifndef YY_NO_TOP_STATE +static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } +#endif + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +#ifdef YY_USE_PROTOS +static void yy_fatal_error( yyconst char msg[] ) +#else +static void yy_fatal_error( msg ) +char msg[]; +#endif + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } + + + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) + + +/* Internal utility routines. */ + +#ifndef yytext_ptr +#ifdef YY_USE_PROTOS +static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) +#else +static void yy_flex_strncpy( s1, s2, n ) +char *s1; +yyconst char *s2; +int n; +#endif + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } +#endif + +#ifdef YY_NEED_STRLEN +#ifdef YY_USE_PROTOS +static int yy_flex_strlen( yyconst char *s ) +#else +static int yy_flex_strlen( s ) +yyconst char *s; +#endif + { + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; + } +#endif + + +#ifdef YY_USE_PROTOS +static void *yy_flex_alloc( yy_size_t size ) +#else +static void *yy_flex_alloc( size ) +yy_size_t size; +#endif + { + return (void *) malloc( size ); + } + +#ifdef YY_USE_PROTOS +static void *yy_flex_realloc( void *ptr, yy_size_t size ) +#else +static void *yy_flex_realloc( ptr, size ) +void *ptr; +yy_size_t size; +#endif + { + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); + } + +#ifdef YY_USE_PROTOS +static void yy_flex_free( void *ptr ) +#else +static void yy_flex_free( ptr ) +void *ptr; +#endif + { + free( ptr ); + } + +#if YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif +#line 108 "gs/parse.yy.l" + +/* {space}+ { return(TOKEN_SPACE);} */ + +void gs_parse_dump(void) { + switch(gs_parse_tok_num) { + case GS_PARSE_TOKEN_LP : {printf("TOKEN_LP ");break;} + case GS_PARSE_TOKEN_RP : {printf("TOKEN_RP ");break;} + case GS_PARSE_TOKEN_WORD : {printf("TOKEN_WORD ");break;} + // case GS_PARSE_TOKEN_SPACE : {printf("TOKEN_SPACE ");break;} + // case GS_PARSE_TOKEN_COMMENT : {printf("TOKEN_COMMENT ");break;} + case GS_PARSE_TOKEN_NEWLINE : {printf("TOKEN_NEWLINE\n");return;} + case GS_PARSE_TOKEN_EMPTY : {printf("TOKEN_EMPTY\n");return;} + default : {printf("Unknown token %d\n", gs_parse_tok_num);return;} + } + printf("-->%s<-- [line %d, pos %d]\n",yytext,gs_parse_line_pos,gs_parse_char_pos); + return; +} + +int gs_parse_lex_n_dump(void) { + gs_parse_tok_num = gs_parse_lex(); + // voir_val(); + // gs_parse_char_pos += strlen(yytext); + return(gs_parse_tok_num); +} + +void gs_parse_pointer_init(const char *file) { + file_to_parse = fopen(file,"r"); + input_buffer = yy_create_buffer( file_to_parse, 10 ); + yy_switch_to_buffer(input_buffer); + + gs_parse_line_pos = 1; + gs_parse_char_pos = 0; + gs_parse_tok_num = 0; +} + +void gs_parse_pointer_close(void) { + yy_delete_buffer(input_buffer); + fclose(file_to_parse); + + gs_parse_line_pos = 1; + gs_parse_char_pos = 0; + gs_parse_tok_num = 0; +} + + +void gs_parse_pointer_string_init(const char *string_to_parse) { + input_buffer = yy_scan_string (string_to_parse); + yy_switch_to_buffer(input_buffer); + + gs_parse_line_pos = 1; + gs_parse_char_pos = 0; + gs_parse_tok_num = 0; +} + +void gs_parse_pointer_string_close(void) { + yy_delete_buffer(input_buffer); + + gs_parse_line_pos = 1; + gs_parse_char_pos = 0; + gs_parse_tok_num = 0; +} + +// Local variables: +// mode: c +// End: diff --git a/src/gras/gs/parse.yy.h b/src/gras/gs/parse.yy.h new file mode 100644 index 0000000000..be2d81a6ec --- /dev/null +++ b/src/gras/gs/parse.yy.h @@ -0,0 +1,34 @@ +/* $Id$ */ + +/* gs/parse.h -- automatic parsing of data structures */ + +/* Authors: Arnaud Legrand, Martin Quinson */ + +typedef enum { + GS_PARSE_TOKEN_EMPTY = 0, + GS_PARSE_TOKEN_LP = 512, + GS_PARSE_TOKEN_RP, + GS_PARSE_TOKEN_WORD, + GS_PARSE_TOKEN_SPACE, + GS_PARSE_TOKEN_QUOTE, + GS_PARSE_TOKEN_COMMENT, + GS_PARSE_TOKEN_NEWLINE, + GS_PARSE_TOKEN_STAR, + GS_PARSE_TOKEN_SEMI_COLON, + GS_PARSE_TOKEN_COLON, + GS_PARSE_TOKEN_ERROR +} gs_parse_token_t; + +#define GS_PARSE_MAX_STR_CONST 4048 + +extern int gs_parse_line_pos; +extern int gs_parse_char_pos; +extern int gs_parse_tok_num; + +void gs_parse_dump(void); +int gs_parse_lex(void); +int gs_parse_lex_n_dump(void); +void gs_parse_pointer_init(const char *file); +void gs_parse_pointer_close(void); +void gs_parse_pointer_string_init(const char *string_to_parse); +void gs_parse_pointer_string_close(void); diff --git a/src/gras/gs/parse.yy.l b/src/gras/gs/parse.yy.l new file mode 100644 index 0000000000..0238e1c85a --- /dev/null +++ b/src/gras/gs/parse.yy.l @@ -0,0 +1,172 @@ +/**** MSG_LICENCE DO NOT REMOVE ****/ + +%option noyywrap +%{ +#include"gs/gs_private.h" +#include"gs/parse.yy.h" +#include + YY_BUFFER_STATE input_buffer; + FILE *file_to_parse; + + int gs_parse_line_pos = 1; + int gs_parse_char_pos = 0; + int gs_parse_tok_num = 0; +%} + +%x comment foo str +space [ \t] +letter [A-Za-z._-] +digit [0-9] + +%% + int comment_caller=0; + + char string_buf[GS_PARSE_MAX_STR_CONST]; + char *string_buf_ptr = NULL; + +"//"[^\n]* +"/*" { + comment_caller = INITIAL; + BEGIN(comment); + } + +"/*" { + comment_caller = foo; + BEGIN(comment); + } + +[^*\n]* /* eat anything that's not a '*' */ +"*"+[^*/\n]* /* eat up '*'s not followed by '/'s */ +\n {++gs_parse_line_pos;gs_parse_char_pos=0;} +"*"+"/" BEGIN(comment_caller); + +\" string_buf_ptr = string_buf; gs_parse_char_pos++; BEGIN(str); + +\" { /* saw closing quote - all done */ + BEGIN(INITIAL); + *string_buf_ptr = '\0'; + yytext=string_buf; + gs_parse_char_pos++; + return GS_PARSE_TOKEN_WORD; + /* return string constant token type and + * value to parser + */ + } + +\n { + /* error - unterminated string constant */ + /* generate error message */ + } + +\\[0-7]{1,3} { + /* octal escape sequence */ + int result; + + (void) sscanf( yytext + 1, "%o", &result ); + + if ( result > 0xff ) + /* error, constant is out-of-bounds */ + + *string_buf_ptr++ = result; + gs_parse_char_pos++; + } + +\\[0-9]+ { + /* generate error - bad escape sequence; something + * like '\48' or '\0777777' + */ + } + +\\n {*string_buf_ptr++ = '\n'; gs_parse_char_pos++;} +\\t {*string_buf_ptr++ = '\t'; gs_parse_char_pos++;} +\\r {*string_buf_ptr++ = '\r'; gs_parse_char_pos++;} +\\b {*string_buf_ptr++ = '\b'; gs_parse_char_pos++;} +\\f {*string_buf_ptr++ = '\f'; gs_parse_char_pos++;} + +\\(.|\n) {*string_buf_ptr++ = yytext[1]; + if(yytext[1]=='\n') { + ++gs_parse_line_pos;gs_parse_char_pos=0; + } else { gs_parse_char_pos++;} + } + +[^\\\n\"]+ { + char *yptr = yytext; + + while ( *yptr ) + *string_buf_ptr++ = *yptr++; + gs_parse_char_pos++; + } + +({letter}|{digit})* { gs_parse_char_pos+= strlen(yytext); return(GS_PARSE_TOKEN_WORD);} +"{" { gs_parse_char_pos++; return(GS_PARSE_TOKEN_LP);} +"}" { gs_parse_char_pos++;return(GS_PARSE_TOKEN_RP);} +"*" { gs_parse_char_pos++;return(GS_PARSE_TOKEN_STAR);} +";" { gs_parse_char_pos++;return(GS_PARSE_TOKEN_SEMI_COLON);} +"," { gs_parse_char_pos++;return(GS_PARSE_TOKEN_COLON);} +"\n" { gs_parse_line_pos++; gs_parse_char_pos=0;} +. { gs_parse_char_pos++;} +%% +/* {space}+ { return(TOKEN_SPACE);} */ + +void gs_parse_dump(void) { + switch(gs_parse_tok_num) { + case GS_PARSE_TOKEN_LP : {printf("TOKEN_LP ");break;} + case GS_PARSE_TOKEN_RP : {printf("TOKEN_RP ");break;} + case GS_PARSE_TOKEN_WORD : {printf("TOKEN_WORD ");break;} + // case GS_PARSE_TOKEN_SPACE : {printf("TOKEN_SPACE ");break;} + // case GS_PARSE_TOKEN_COMMENT : {printf("TOKEN_COMMENT ");break;} + case GS_PARSE_TOKEN_NEWLINE : {printf("TOKEN_NEWLINE\n");return;} + case GS_PARSE_TOKEN_EMPTY : {printf("TOKEN_EMPTY\n");return;} + default : {printf("Unknown token %d\n", gs_parse_tok_num);return;} + } + printf("-->%s<-- [line %d, pos %d]\n",yytext,gs_parse_line_pos,gs_parse_char_pos); + return; +} + +int gs_parse_lex_n_dump(void) { + gs_parse_tok_num = gs_parse_lex(); + // voir_val(); + // gs_parse_char_pos += strlen(yytext); + return(gs_parse_tok_num); +} + +void gs_parse_pointer_init(const char *file) { + file_to_parse = fopen(file,"r"); + input_buffer = yy_create_buffer( file_to_parse, 10 ); + yy_switch_to_buffer(input_buffer); + + gs_parse_line_pos = 1; + gs_parse_char_pos = 0; + gs_parse_tok_num = 0; +} + +void gs_parse_pointer_close(void) { + yy_delete_buffer(input_buffer); + fclose(file_to_parse); + + gs_parse_line_pos = 1; + gs_parse_char_pos = 0; + gs_parse_tok_num = 0; +} + + +void gs_parse_pointer_string_init(const char *string_to_parse) { + input_buffer = yy_scan_string (string_to_parse); + yy_switch_to_buffer(input_buffer); + + gs_parse_line_pos = 1; + gs_parse_char_pos = 0; + gs_parse_tok_num = 0; +} + +void gs_parse_pointer_string_close(void) { + yy_delete_buffer(input_buffer); + + gs_parse_line_pos = 1; + gs_parse_char_pos = 0; + gs_parse_tok_num = 0; +} + +// Local variables: +// mode: c +// End: diff --git a/src/gras/gs/sequence.h b/src/gras/gs/sequence.h new file mode 100644 index 0000000000..33222e32d5 --- /dev/null +++ b/src/gras/gs/sequence.h @@ -0,0 +1,11 @@ +/* gs_sequence.h */ +#ifndef GS_SEQUENCE_H +#define GS_SEQUENCE_H + +struct s_gs_sequence { + struct s_gs_message *message; + int code; + struct s_gs_sequence *next; +}; + +#endif /* GS_SEQUENCE_H */ diff --git a/src/gras/gs/tools.c b/src/gras/gs/tools.c new file mode 100644 index 0000000000..105e532c28 --- /dev/null +++ b/src/gras/gs/tools.c @@ -0,0 +1,18 @@ +/* gs_tools.c */ + +#include "gs/gs_private.h" + +void * +gs_memdup(const void * const ptr, + const size_t length) { + void * new_ptr = NULL; + + new_ptr = malloc(length); + + if (new_ptr) { + memcpy(new_ptr, ptr, length); + } + + return new_ptr; +} + diff --git a/src/gras/gs/type.c b/src/gras/gs/type.c new file mode 100644 index 0000000000..7cc9fd2777 --- /dev/null +++ b/src/gras/gs/type.c @@ -0,0 +1,1184 @@ +/* gs_type.c */ + +#include "gs/gs_private.h" +GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(NDR_type_creation,NDR); + +/*...................................................................... + * Type + */ + +/* alloc/free */ +static +struct s_gs_type * +_gs_type_alloc(void) { + struct s_gs_type *p_type = NULL; + p_type = malloc(sizeof(struct s_gs_type)); + return p_type; +} + +static +struct s_gs_type * +_gs_type_new(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name) { + + struct s_gs_type_bag_ops *bag_ops = p_bag->bag_ops; + struct s_gs_type *p_type = NULL; + + p_type = _gs_type_alloc(); + + p_type->code = -1; + p_type->name = strdup(name); + + p_type->size = 0; + p_type->alignment = 0; + p_type->aligned_size = 0; + p_type->category_code = e_gs_type_cat_undefined; + p_type->category.undefined_data = NULL; + p_type->before_callback = NULL; + p_type->after_callback = NULL; + + bag_ops->store_type(p_bag, p_connection, p_type); + + return p_type; +} + + + + + +/*...................................................................... + * Elemental + */ +static +struct s_gs_cat_elemental * +_gs_elemental_cat_alloc(void) { + struct s_gs_cat_elemental *p_elemental = NULL; + + p_elemental = malloc(sizeof (struct s_gs_cat_elemental)); + + return p_elemental; +} + +static +struct s_gs_cat_elemental * +_gs_elemental_cat_new(void) { + struct s_gs_cat_elemental *p_elemental = NULL; + + p_elemental = _gs_elemental_cat_alloc(); + p_elemental->encoding = e_gs_elemental_encoding_undefined; + + return p_elemental; +} + +struct s_gs_type * +gs_type_new_elemental_with_callback(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name, + enum e_gs_elemental_encoding encoding, + long int size, + + void (*callback)(void *vars, + struct s_gs_type *p_type, + void *data)) { + + struct s_gs_type *p_type = NULL; + struct s_gs_cat_elemental *p_elemental = NULL; + + if (callback) + DEBUG1("%s",__FUNCTION__); + p_elemental = _gs_elemental_cat_new(); + p_elemental->encoding = encoding; + + p_type = _gs_type_new(p_bag, p_connection, name); + + p_type->size = size > 0?size:0; + + if (size > 0) { + long int sz = size; + long int mask = sz; + + while ((sz >>= 1)) { + mask |= sz; + } + + if (size & (mask >> 1)) { + long int alignment = 0; + long int aligned_size = 0; + + alignment = (size & ~(mask >> 1)) << 1; + if (alignment < 0) + GS_FAILURE("elemental type is too large"); + + aligned_size = aligned(size, alignment); + if (aligned_size < 0) + GS_FAILURE("elemental type is too large"); + + p_type->alignment = alignment; + p_type->aligned_size = aligned_size; + + } else { + long int alignment = size & ~(mask >> 1); + long int aligned_size = aligned(size, alignment); + + p_type->alignment = alignment; + p_type->aligned_size = aligned_size; + } + + } else { + p_type->alignment = 0; + p_type->aligned_size = 0; + } + + p_type->category_code = e_gs_type_cat_elemental; + p_type->category.elemental_data = p_elemental; + + p_type->before_callback = callback; + + return p_type; +} + +struct s_gs_type * +gs_type_new_elemental(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name, + enum e_gs_elemental_encoding encoding, + long int size) { + DEBUG1("%s",__FUNCTION__); + return gs_type_new_elemental_with_callback(p_bag, p_connection, name, encoding, size, NULL); +} + + +struct s_gs_type * +gs_type_new_unsigned_integer_elemental_with_callback(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name, + long int size, + + void (*callback)(void *vars, + struct s_gs_type *p_type, + void *data)) { + if (callback) + DEBUG1("%s",__FUNCTION__); + return gs_type_new_elemental_with_callback(p_bag, p_connection, name, + e_gs_elemental_encoding_unsigned_integer, + size, + callback); +} + +struct s_gs_type * +gs_type_new_unsigned_integer_elemental(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name, + long int size) { + DEBUG1("%s",__FUNCTION__); + return gs_type_new_unsigned_integer_elemental_with_callback(p_bag, p_connection, name, size, NULL); +} + + +struct s_gs_type * +gs_type_new_signed_integer_elemental_with_callback(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name, + long int size, + + void (*callback)(void *vars, + struct s_gs_type *p_type, + void *data)) { + if (callback) + DEBUG1("%s",__FUNCTION__); + return gs_type_new_elemental_with_callback(p_bag, p_connection, name, + e_gs_elemental_encoding_signed_integer, + size, + callback); +} + +struct s_gs_type * +gs_type_new_signed_integer_elemental(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name, + long int size) { + DEBUG1("%s",__FUNCTION__); + return gs_type_new_signed_integer_elemental_with_callback(p_bag, p_connection, name, size, NULL); +} + + +struct s_gs_type * +gs_type_new_floating_point_elemental_with_callback(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name, + long int size, + + void (*callback)(void *vars, + struct s_gs_type *p_type, + void *data)) { + DEBUG1("%s",__FUNCTION__); + return gs_type_new_elemental_with_callback(p_bag, p_connection, name, + e_gs_elemental_encoding_floating_point, + size, + callback); + +} + +struct s_gs_type * +gs_type_new_floating_point_elemental(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name, + long int size) { + DEBUG1("%s",__FUNCTION__); + return gs_type_new_floating_point_elemental_with_callback(p_bag, p_connection, name, size, NULL); +} + + + + + +/*...................................................................... + * Struct + */ +static +struct s_gs_cat_struct * +_gs_struct_cat_alloc(void) { + struct s_gs_cat_struct *p_struct = NULL; + p_struct = malloc(sizeof (struct s_gs_cat_struct)); + return p_struct; +} + +static +struct s_gs_cat_struct * +_gs_struct_cat_new(void) { + struct s_gs_cat_struct *p_struct = NULL; + + p_struct = _gs_struct_cat_alloc(); + + p_struct->nb_fields = 0; + p_struct->field_array = NULL; + + return p_struct; +} + +struct s_gs_type * +gs_type_new_struct_with_callback(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name, + + void (*before_callback)(void *vars, + struct s_gs_type *p_type, + void *data), + + void (*after_callback)(void *vars, + struct s_gs_type *p_type, + void *data)) { + struct s_gs_type *p_type = NULL; + struct s_gs_cat_struct *p_struct = NULL; + + if (before_callback || after_callback) + DEBUG1("%s",__FUNCTION__); + p_struct = _gs_struct_cat_new(); + + p_type = _gs_type_new(p_bag, p_connection, name); + + p_type->size = 0; + p_type->alignment = 0; + p_type->aligned_size = 0; + p_type->category_code = e_gs_type_cat_struct; + p_type->category.struct_data = p_struct; + p_type->before_callback = before_callback; + p_type->after_callback = after_callback; + + return p_type; +} + +struct s_gs_type * +gs_type_new_struct(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name) { + DEBUG2("%s(%s)",__FUNCTION__,name); + return gs_type_new_struct_with_callback(p_bag, p_connection, name, NULL, NULL); +} + + +static +struct s_gs_cat_struct_field * +_gs_struct_field_cat_alloc(void) { + struct s_gs_cat_struct_field *p_struct_field = NULL; + p_struct_field = malloc(sizeof (struct s_gs_cat_struct_field)); + return p_struct_field; +} + +static +struct s_gs_cat_struct_field * +_gs_struct_field_cat_new(const char *name, + long int offset, + struct s_gs_type *p_field_type, + + void (*before_callback)(void *vars, + struct s_gs_type *p_type, + void *data), + + void (*after_callback)(void *vars, + struct s_gs_type *p_type, + void *data)) { + + struct s_gs_cat_struct_field *p_struct_field = NULL; + + if (p_field_type->size < 0) + GS_FAILURE("variable length field not allowed in structure"); + + p_struct_field = _gs_struct_field_cat_alloc(); + + p_struct_field->name = strdup(name); + p_struct_field->offset = aligned(offset, p_field_type->alignment); + p_struct_field->code = p_field_type->code; + p_struct_field->before_callback = before_callback; + p_struct_field->after_callback = after_callback; + + return p_struct_field; +} + +void +gs_type_struct_append_field_with_callback(struct s_gs_type *p_struct_type, + const char *name, + struct s_gs_type *p_field_type, + + void (*before_callback)(void *vars, + struct s_gs_type *p_type, + void *data), + + void (*after_callback)(void *vars, + struct s_gs_type *p_type, + void *data)) { + + struct s_gs_cat_struct *p_struct = NULL; + int field_num = -1; + struct s_gs_cat_struct_field *p_field = NULL; + + if (before_callback || after_callback) + DEBUG1("%s",__FUNCTION__); + + if (p_field_type->size < 0) + GS_FAILURE("field size must be statically known"); + + p_struct = p_struct_type->category.struct_data; + + if ((field_num = p_struct->nb_fields++)) { + p_struct->field_array = realloc(p_struct->field_array, p_struct->nb_fields * sizeof (struct s_gs_cat_struct_field *)); + } else { + p_struct->field_array = malloc(sizeof (struct s_gs_cat_struct_field *)); + } + + p_field = _gs_struct_field_cat_new(name, p_struct_type->size, p_field_type, before_callback, after_callback); + p_struct->field_array[field_num] = p_field; + + p_struct_type->size = p_field->offset + p_field_type->size; + p_struct_type->alignment = max(p_struct_type->alignment, p_field_type->alignment); + p_struct_type->aligned_size = aligned(p_struct_type->size, p_struct_type->alignment); +} + +void +gs_type_struct_append_field(struct s_gs_type *p_struct_type, + const char *name, + struct s_gs_type *p_field_type) { + DEBUG1("%s",__FUNCTION__); + gs_type_struct_append_field_with_callback(p_struct_type, name, p_field_type, NULL, NULL); +} + + + + +/*...................................................................... + * Union + */ +static +struct s_gs_cat_union * +_gs_union_cat_alloc(void) { + struct s_gs_cat_union *p_union = NULL; + p_union = malloc(sizeof (struct s_gs_cat_union)); + return p_union; +} + +static +struct s_gs_cat_union * +_gs_union_cat_new(void) { + struct s_gs_cat_union *p_union = NULL; + + p_union = _gs_union_cat_alloc(); + + p_union->nb_fields = 0; + p_union->field_array = NULL; + + return p_union; +} + +struct s_gs_type * +gs_type_new_union_with_callback(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name, + + int (*field_callback)(void *vars, + struct s_gs_type *p_type, + void *data), + + void (*after_callback)(void *vars, + struct s_gs_type *p_type, + void *data)) { + struct s_gs_type *p_type = NULL; + struct s_gs_cat_union *p_union = NULL; + + if (!field_callback + && + (!p_connection||p_connection->direction != e_gs_connection_direction_incoming)) + GS_FAILURE("attempt to create a union type without discriminant"); + + p_union = _gs_union_cat_new(); + + p_type = _gs_type_new(p_bag, p_connection, name); + + p_type->size = 0; + p_type->alignment = 0; + p_type->aligned_size = 0; + p_type->category_code = e_gs_type_cat_union; + p_type->category.union_data = p_union; + p_type->before_callback = NULL; + + p_union->callback = field_callback; + p_type->after_callback = after_callback; + + return p_type; +} + +struct s_gs_type * +gs_type_new_union(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name, + + int (*field_callback)(void *vars, + struct s_gs_type *p_type, + void *data)) { + return gs_type_new_union_with_callback(p_bag, p_connection, name, field_callback, NULL); +} + + +static +struct s_gs_cat_union_field * +_gs_union_field_cat_alloc(void) { + struct s_gs_cat_union_field *p_union_field = NULL; + p_union_field = malloc(sizeof (struct s_gs_cat_union_field)); + return p_union_field; +} + +static +struct s_gs_cat_union_field * +_gs_union_field_cat_new(const char *name, + struct s_gs_type *p_field_type, + + void (*before_callback)(void *vars, + struct s_gs_type *p_type, + void *data), + + void (*after_callback)(void *vars, + struct s_gs_type *p_type, + void *data)) { + + struct s_gs_cat_union_field *p_union_field = NULL; + + if (p_field_type->size < 0) + GS_FAILURE("variable length field not allowed in structure"); + + p_union_field = _gs_union_field_cat_alloc(); + + p_union_field->name = strdup(name); + p_union_field->code = p_field_type->code; + p_union_field->before_callback = before_callback; + p_union_field->after_callback = after_callback; + + return p_union_field; +} + +void +gs_type_union_append_field_with_callback(struct s_gs_type *p_union_type, + const char *name, + struct s_gs_type *p_field_type, + + void (*before_callback)(void *vars, + struct s_gs_type *p_type, + void *data), + + void (*after_callback)(void *vars, + struct s_gs_type *p_type, + void *data)) { + + struct s_gs_cat_union *p_union = NULL; + int field_num = -1; + struct s_gs_cat_union_field *p_field = NULL; + + if (p_field_type->size < 0) + GS_FAILURE("field size must be statically known"); + + p_union = p_union_type->category.union_data; + + if ((field_num = p_union->nb_fields++)) { + p_union->field_array = realloc(p_union->field_array, p_union->nb_fields * sizeof (struct s_gs_cat_union_field *)); + } else { + p_union->field_array = malloc(sizeof (struct s_gs_cat_union_field *)); + } + + p_field = _gs_union_field_cat_new(name, p_field_type, before_callback, after_callback); + p_union->field_array[field_num] = p_field; + + p_union_type->size = max(p_union_type->size, p_field_type->size); + p_union_type->alignment = max(p_union_type->alignment, p_field_type->alignment); + p_union_type->aligned_size = aligned(p_union_type->size, p_union_type->alignment); +} + +void +gs_type_union_append_field(struct s_gs_type *p_union_type, + const char *name, + struct s_gs_type *p_field_type) { + gs_type_union_append_field_with_callback(p_union_type, name, p_field_type, NULL, NULL); +} + + + + +/*...................................................................... + * Ref + */ +static +struct s_gs_cat_ref * +_gs_ref_cat_alloc(void) { + struct s_gs_cat_ref *p_ref = NULL; + p_ref = malloc(sizeof (struct s_gs_cat_ref)); + return p_ref; +} + +static +struct s_gs_cat_ref * +_gs_ref_cat_new(void) { + struct s_gs_cat_ref *p_ref = NULL; + + p_ref = _gs_ref_cat_alloc(); + p_ref->code = 0; + p_ref->callback = NULL; + + return p_ref; +} + +struct s_gs_type * +gs_type_new_ref_with_callback(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name, + struct s_gs_type *p_referenced_type, + + int (*type_callback)(void *vars, + struct s_gs_type *p_type, + void *data), + + void (*after_callback)(void *vars, + struct s_gs_type *p_type, + void *data)) { + struct s_gs_type *p_type = NULL; + struct s_gs_cat_ref *p_ref = NULL; + + p_ref = _gs_ref_cat_new(); + + if (!p_referenced_type + && + !type_callback + && + (!p_connection||p_connection->direction != e_gs_connection_direction_incoming)) + GS_FAILURE("attempt to declare a generic ref without discriminant"); + + p_ref->code = p_referenced_type?p_referenced_type->code:-1; + p_ref->callback = type_callback; + + p_type = _gs_type_new(p_bag, p_connection, name); + + { + struct s_gs_type_bag_ops *bag_ops = p_bag->bag_ops; + struct s_gs_type *p_pointer_type = NULL; + + p_pointer_type = bag_ops->get_type_by_name(p_bag, p_connection, "data pointer"); + p_type->size = p_pointer_type->size; + p_type->alignment = p_pointer_type->alignment; + p_type->aligned_size = p_pointer_type->aligned_size; + } + + p_type->category_code = e_gs_type_cat_ref; + p_type->category.ref_data = p_ref; + + p_type->before_callback = NULL; + p_type->after_callback = after_callback; + + return p_type; +} + +struct s_gs_type * +gs_type_new_ref(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name, + struct s_gs_type *p_referenced_type) { + return gs_type_new_ref_with_callback(p_bag, p_connection, name, p_referenced_type, NULL, NULL); +} + + + + +/*...................................................................... + * Array + */ +static +struct s_gs_cat_array * +_gs_array_cat_alloc(void) { + struct s_gs_cat_array *p_array = NULL; + p_array = malloc(sizeof (struct s_gs_cat_array)); + return p_array; +} + +static +struct s_gs_cat_array * +_gs_array_cat_new(void) { + struct s_gs_cat_array *p_array = NULL; + + p_array = _gs_array_cat_alloc(); + p_array->code = 0; + p_array->element_count = 0; + + return p_array; +} + +struct s_gs_type * +gs_type_new_array_with_callback(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name, + long int size, + struct s_gs_type *p_array_element_type, + + long int (*size_callback)(void *vars, + struct s_gs_type *p_type, + void *data), + + void (*after_callback)(void *vars, + struct s_gs_type *p_type, + void *data)) { + + struct s_gs_type *p_type = NULL; + struct s_gs_cat_array *p_array = NULL; + + p_array = _gs_array_cat_new(); + p_array->code = p_array_element_type->code; + p_array->element_count = size; + + p_type = _gs_type_new(p_bag, p_connection, name); + + if (size <= 0) { + if (size < 0 && !size_callback + && + (!p_connection||p_connection->direction != e_gs_connection_direction_incoming)) + GS_FAILURE("attempt to construct a variable sized array with no callback"); + + p_type->size = size; + } else { + p_type->size = size * p_array_element_type->aligned_size; + } + + p_type->alignment = p_array_element_type->alignment; + p_type->aligned_size = size; + + p_type->category_code = e_gs_type_cat_array; + p_type->category.array_data = p_array; + + p_array->callback = size_callback; + + p_type->before_callback = NULL; + p_type->after_callback = after_callback; + + return p_type; +} + +struct s_gs_type * +gs_type_new_array(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name, + long int size, + struct s_gs_type *p_array_element_type) { + return gs_type_new_array_with_callback(p_bag, p_connection, name, size, p_array_element_type, NULL, NULL); +} + + + + + +/*...................................................................... + * Type structure bootstrap + */ +static +long int +_strlen_cb(void *p_vars, + struct s_gs_type *p_type, + void *data) { + + (void)p_vars; + (void)p_type; + + return 1+(long int)strlen(data); +} + +static +void +_category_code_push_cb(void *p_vars, + struct s_gs_type *p_type, + void *data) { + gs_vars_push(p_vars, p_type, "_category_code", data); +} + +static +int +_category_code_pop_cb(void *p_vars, + struct s_gs_type *p_type, + void *data) { + int *p_cat = NULL; + + (void)p_type; + (void)data; + + p_cat = gs_vars_pop(p_vars, "_category_code", NULL); + + if (!p_cat) + GS_FAILURE("categoy code not found"); + + return *p_cat; +} + +static +void +_field_count_push_cb(void *p_vars, + struct s_gs_type *p_type, + void *data) { + gs_vars_push(p_vars, p_type, "_field_count", data); +} + +static +long +int +_field_count_pop_cb(void *p_vars, + struct s_gs_type *p_type, + void *data) { + long int *p_cat = NULL; + + (void)p_type; + (void)data; + + p_cat = gs_vars_pop(p_vars, "_field_count", NULL); + + if (!p_cat) + GS_FAILURE("categoy code not found"); + + return *p_cat; +} + +void +gs_bootstrap_type_bag(struct s_gs_type_bag *p_bag) { + DEBUG0("###################### BEGIN OF TYPE BOOTSTRAPING"); + gs_bootstrap_incoming_connection(p_bag, NULL); + DEBUG0("###################### END OF TYPE BOOTSTRAPING"); +} + +void +gs_bootstrap_incoming_connection(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx) { + + /* basic types */ + struct s_gs_type *signed_char = NULL; + struct s_gs_type *unsigned_char = NULL; + struct s_gs_type *signed_short_int = NULL; + struct s_gs_type *unsigned_short_int = NULL; + struct s_gs_type *signed_int = NULL; + struct s_gs_type *unsigned_int = NULL; + struct s_gs_type *signed_long_int = NULL; + struct s_gs_type *unsigned_long_int = NULL; + struct s_gs_type *signed_long_long_int = NULL; + struct s_gs_type *unsigned_long_long_int = NULL; + struct s_gs_type *data_pointer = NULL; + struct s_gs_type *function_pointer = NULL; + struct s_gs_type *char_array = NULL; + struct s_gs_type *string = NULL; + + /* categories */ + struct s_gs_type *s_gs_cat_elemental = NULL; /* Elemental */ + + struct s_gs_type *s_gs_cat_struct_field = NULL; /* Struct */ + struct s_gs_type *ref_s_gs_cat_struct_field = NULL; + struct s_gs_type *tab_ref_s_gs_cat_struct_field = NULL; + struct s_gs_type *ref_tab_ref_s_gs_cat_struct_field = NULL; + struct s_gs_type *s_gs_cat_struct = NULL; + + struct s_gs_type *s_gs_cat_union_field = NULL; /* Union */ + struct s_gs_type *ref_s_gs_cat_union_field = NULL; + struct s_gs_type *tab_ref_s_gs_cat_union_field = NULL; + struct s_gs_type *ref_tab_ref_s_gs_cat_union_field = NULL; + struct s_gs_type *s_gs_cat_union = NULL; + + struct s_gs_type *s_gs_cat_ref = NULL; /* Ref */ + + struct s_gs_type *s_gs_cat_array = NULL; /* Array */ + + struct s_gs_type *s_gs_cat_ignored = NULL; /* Ignored */ + + /* type */ + struct s_gs_type *ref_s_gs_cat_elemental = NULL; + struct s_gs_type *ref_s_gs_cat_struct = NULL; + struct s_gs_type *ref_s_gs_cat_union = NULL; + struct s_gs_type *ref_s_gs_cat_ref = NULL; + struct s_gs_type *ref_s_gs_cat_array = NULL; + struct s_gs_type *ref_s_gs_cat_ignored = NULL; + + struct s_gs_type *u_gs_category = NULL; + struct s_gs_type *s_gs_type = NULL; + + /* message */ + struct s_gs_type *s_gs_sequence = NULL; + struct s_gs_type *s_gs_message = NULL; + + struct s_gs_type *ref_s_gs_sequence = NULL; + struct s_gs_type *ref_s_gs_message = NULL; + + + /* + * connection boostrap sequence + */ + + signed_char = gs_type_new_signed_integer_elemental (p_bag, p_cnx, "signed char", 1); + unsigned_char = gs_type_new_unsigned_integer_elemental(p_bag, p_cnx, "unsigned char", 1); + + + if (p_cnx) { + struct s_gs_connection_ops *cops = p_cnx->connection_ops; + unsigned char a = 0; + unsigned char b = 0; + + if (p_cnx->direction != e_gs_connection_direction_incoming) + GS_FAILURE("invalid connection"); + + cops->read(p_cnx, &b, 1); + signed_short_int = gs_type_new_signed_integer_elemental (p_bag, p_cnx, "signed short int", b); + + cops->read(p_cnx, &b, 1); + unsigned_short_int = gs_type_new_unsigned_integer_elemental(p_bag, p_cnx, "unsigned short int", b); + + + cops->read(p_cnx, &b, 1); + signed_int = gs_type_new_signed_integer_elemental (p_bag, p_cnx, "signed int", b); + + cops->read(p_cnx, &b, 1); + unsigned_int = gs_type_new_unsigned_integer_elemental(p_bag, p_cnx, "unsigned int", b); + + + cops->read(p_cnx, &b, 1); + signed_long_int = gs_type_new_signed_integer_elemental (p_bag, p_cnx, "signed long int", b); + + cops->read(p_cnx, &b, 1); + unsigned_long_int = gs_type_new_unsigned_integer_elemental(p_bag, p_cnx, "unsigned long int", b); + + + cops->read(p_cnx, &b, 1); + signed_long_long_int = gs_type_new_signed_integer_elemental (p_bag, p_cnx, "signed long long int", b); + + cops->read(p_cnx, &b, 1); + unsigned_long_long_int = gs_type_new_unsigned_integer_elemental(p_bag, p_cnx, "unsigned long long int", b); + + cops->read(p_cnx, &b, 1); + cops->read(p_cnx, &a, 1); + data_pointer = gs_type_new_ignored(p_bag, p_cnx, "data pointer", b, a, NULL); + + cops->read(p_cnx, &b, 1); + cops->read(p_cnx, &a, 1); + function_pointer = gs_type_new_ignored(p_bag, p_cnx, "function pointer", b, a, NULL); + } else { + signed_short_int = gs_type_new_signed_integer_elemental (p_bag, NULL, "signed short int", sizeof (signed short int)); + unsigned_short_int = gs_type_new_unsigned_integer_elemental(p_bag, NULL, "unsigned short int", sizeof (unsigned short int)); + + signed_int = gs_type_new_signed_integer_elemental (p_bag, NULL, "signed int", sizeof (signed int)); + unsigned_int = gs_type_new_unsigned_integer_elemental(p_bag, NULL, "unsigned int", sizeof (unsigned int)); + + signed_long_int = gs_type_new_signed_integer_elemental (p_bag, NULL, "signed long int", sizeof (signed long int)); + unsigned_long_int = gs_type_new_unsigned_integer_elemental(p_bag, NULL, "unsigned long int", sizeof (unsigned long int)); + + signed_long_long_int = gs_type_new_signed_integer_elemental (p_bag, NULL, "signed long long int", sizeof (signed long long int)); + unsigned_long_long_int = gs_type_new_unsigned_integer_elemental(p_bag, NULL, "unsigned long long int", sizeof (unsigned long long int)); + + data_pointer = gs_type_new_ignored(p_bag, NULL, "data pointer", sizeof (void *), sizeof (void *), NULL); + function_pointer = gs_type_new_ignored(p_bag, NULL, "function pointer", sizeof (void (*) (void)), sizeof (void (*) (void)), NULL); + } + + char_array = gs_type_new_array_with_callback(p_bag, p_cnx, "_char_array", -1, signed_char, _strlen_cb, NULL); + string = gs_type_new_ref(p_bag, p_cnx, "_string", char_array); + + /* Elemental cat */ + s_gs_cat_elemental = gs_type_new_struct(p_bag, p_cnx, "_s_gs_cat_elemental"); + gs_type_struct_append_field(s_gs_cat_elemental, "encoding", signed_int); + + /* Struct cat */ + s_gs_cat_struct_field = gs_type_new_struct(p_bag, p_cnx, "_s_gs_cat_struct_field"); + gs_type_struct_append_field(s_gs_cat_struct_field, "name", string); + gs_type_struct_append_field(s_gs_cat_struct_field, "offset", signed_long_int); + gs_type_struct_append_field(s_gs_cat_struct_field, "code", signed_int); + gs_type_struct_append_field(s_gs_cat_struct_field, "before_callback", function_pointer); + gs_type_struct_append_field(s_gs_cat_struct_field, "after_callback", function_pointer); + + ref_s_gs_cat_struct_field = gs_type_new_ref (p_bag, p_cnx, "_ps_gs_cat_struct_field", s_gs_cat_struct_field); + tab_ref_s_gs_cat_struct_field = gs_type_new_array_with_callback(p_bag, p_cnx, "_aps_gs_cat_struct_field", -1, ref_s_gs_cat_struct_field, _field_count_pop_cb, NULL); + ref_tab_ref_s_gs_cat_struct_field = gs_type_new_ref (p_bag, p_cnx, "_paps_gs_cat_struct_field", tab_ref_s_gs_cat_struct_field); + + s_gs_cat_struct = gs_type_new_struct(p_bag, p_cnx, "_s_gs_cat_struct"); + gs_type_struct_append_field_with_callback(s_gs_cat_struct, "nb_fields", signed_int, _field_count_push_cb, NULL); + gs_type_struct_append_field(s_gs_cat_struct, "field_array", ref_tab_ref_s_gs_cat_struct_field); + + /* Union cat */ + s_gs_cat_union_field = gs_type_new_struct(p_bag, p_cnx, "_s_gs_cat_union_field"); + gs_type_struct_append_field(s_gs_cat_union_field, "name", string); + gs_type_struct_append_field(s_gs_cat_union_field, "code", signed_int); + gs_type_struct_append_field(s_gs_cat_union_field, "before_callback", function_pointer); + gs_type_struct_append_field(s_gs_cat_union_field, "after_callback", function_pointer); + + ref_s_gs_cat_union_field = gs_type_new_ref (p_bag, p_cnx, "_ps_gs_cat_union_field", s_gs_cat_union_field); + tab_ref_s_gs_cat_union_field = gs_type_new_array_with_callback(p_bag, p_cnx, "_aps_gs_cat_union_field", -1, ref_s_gs_cat_union_field, _field_count_pop_cb, NULL); + ref_tab_ref_s_gs_cat_union_field = gs_type_new_ref (p_bag, p_cnx, "_paps_gs_cat_union_field", tab_ref_s_gs_cat_union_field); + + s_gs_cat_union = gs_type_new_struct(p_bag, p_cnx, "_s_gs_cat_union"); + gs_type_struct_append_field_with_callback(s_gs_cat_union, "nb_fields", signed_int, _field_count_push_cb, NULL); + gs_type_struct_append_field(s_gs_cat_union, "field_array", ref_tab_ref_s_gs_cat_union_field); + gs_type_struct_append_field(s_gs_cat_union, "callback", function_pointer); + + /* Ref cat */ + s_gs_cat_ref = gs_type_new_struct(p_bag, p_cnx, "_s_gs_cat_ref"); + gs_type_struct_append_field(s_gs_cat_ref, "code", signed_int); + gs_type_struct_append_field(s_gs_cat_ref, "callback", function_pointer); + + /* Array cat */ + s_gs_cat_array = gs_type_new_struct(p_bag, p_cnx, "_s_gs_cat_array"); + gs_type_struct_append_field(s_gs_cat_array, "code", signed_int); + gs_type_struct_append_field(s_gs_cat_array, "element_count", signed_long_int); + gs_type_struct_append_field(s_gs_cat_array, "callback", function_pointer); + + /* Ignored cat */ + s_gs_cat_ignored = gs_type_new_struct(p_bag, p_cnx, "_s_gs_cat_ignored"); + gs_type_struct_append_field(s_gs_cat_ignored, "default_value", data_pointer); + + /* refs to categories */ + ref_s_gs_cat_elemental = gs_type_new_ref(p_bag, p_cnx, "_ref_s_gs_cat_elemental", s_gs_cat_elemental); + ref_s_gs_cat_struct = gs_type_new_ref(p_bag, p_cnx, "_ref_s_gs_cat_struct", s_gs_cat_struct ); + ref_s_gs_cat_union = gs_type_new_ref(p_bag, p_cnx, "_ref_s_gs_cat_union", s_gs_cat_union ); + ref_s_gs_cat_ref = gs_type_new_ref(p_bag, p_cnx, "_ref_s_gs_cat_ref", s_gs_cat_ref ); + ref_s_gs_cat_array = gs_type_new_ref(p_bag, p_cnx, "_ref_s_gs_cat_array", s_gs_cat_array ); + ref_s_gs_cat_ignored = gs_type_new_ref(p_bag, p_cnx, "_ref_s_gs_cat_ignored", s_gs_cat_ignored ); + + /* union of categories */ + u_gs_category = gs_type_new_union(p_bag, p_cnx, "_u_gs_category", _category_code_pop_cb); + gs_type_union_append_field(u_gs_category, "undefined_data", data_pointer); + gs_type_union_append_field(u_gs_category, "elemental_data", ref_s_gs_cat_elemental); + gs_type_union_append_field(u_gs_category, "struct_data", ref_s_gs_cat_struct); + gs_type_union_append_field(u_gs_category, "union_data", ref_s_gs_cat_union); + gs_type_union_append_field(u_gs_category, "ref_data", ref_s_gs_cat_ref); + gs_type_union_append_field(u_gs_category, "array_data", ref_s_gs_cat_array); + gs_type_union_append_field(u_gs_category, "ignored_data", ref_s_gs_cat_ignored); + + /* type */ + s_gs_type = gs_type_new_struct(p_bag, p_cnx, "_s_gs_type"); + gs_type_struct_append_field (s_gs_type, "code", signed_int); + gs_type_struct_append_field (s_gs_type, "name", string); + gs_type_struct_append_field (s_gs_type, "size", signed_long_int); + gs_type_struct_append_field (s_gs_type, "alignment", signed_long_int); + gs_type_struct_append_field (s_gs_type, "aligned_size", signed_long_int); + gs_type_struct_append_field_with_callback(s_gs_type, "category_code", signed_int, _category_code_push_cb, NULL); + gs_type_struct_append_field (s_gs_type, "category", u_gs_category); + gs_type_struct_append_field (s_gs_type, "before_callback", function_pointer); + gs_type_struct_append_field (s_gs_type, "after_callback", function_pointer); + + /* message */ + s_gs_sequence = gs_type_new_struct(p_bag, p_cnx, "_s_gs_sequence"); + s_gs_message = gs_type_new_struct(p_bag, p_cnx, "_s_gs_message"); + + ref_s_gs_sequence = gs_type_new_ref(p_bag, p_cnx, "_ref_s_gs_sequence", s_gs_sequence); + ref_s_gs_message = gs_type_new_ref(p_bag, p_cnx, "_ref_s_gs_message", s_gs_message); + + gs_type_struct_append_field(s_gs_sequence, "message", ref_s_gs_message); + gs_type_struct_append_field(s_gs_sequence, "code", signed_int); + gs_type_struct_append_field(s_gs_sequence, "next", ref_s_gs_sequence); + + gs_type_struct_append_field(s_gs_message, "code", signed_int); + gs_type_struct_append_field(s_gs_message, "name", string); + gs_type_struct_append_field(s_gs_message, "first", ref_s_gs_sequence); + gs_type_struct_append_field(s_gs_message, "next", ref_s_gs_sequence); +} + +void +gs_bootstrap_outgoing_connection(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx) { + struct s_gs_type_bag_ops *bops = p_bag->bag_ops; + struct s_gs_connection_ops *cops = p_cnx->connection_ops; + unsigned char b = 0; + + if (p_cnx->direction != e_gs_connection_direction_outgoing) + GS_FAILURE("invalid connection"); + + bops->mark_type(p_bag, p_cnx, "signed char"); + bops->mark_type(p_bag, p_cnx, "unsigned char"); + + b = sizeof(signed short int); + cops->write(p_cnx, &b, 1); + bops->mark_type(p_bag, p_cnx, "signed short int"); + + b = sizeof(unsigned short int); + cops->write(p_cnx, &b, 1); + bops->mark_type(p_bag, p_cnx, "unsigned short int"); + + b = sizeof(signed int); + cops->write(p_cnx, &b, 1); + bops->mark_type(p_bag, p_cnx, "signed int"); + + b = sizeof(unsigned int); + cops->write(p_cnx, &b, 1); + bops->mark_type(p_bag, p_cnx, "unsigned in"); + + b = sizeof(signed long int); + cops->write(p_cnx, &b, 1); + bops->mark_type(p_bag, p_cnx, "signed long int"); + + b = sizeof(unsigned long int); + cops->write(p_cnx, &b, 1); + bops->mark_type(p_bag, p_cnx, "unsigned long int"); + + b = sizeof(signed long long int); + cops->write(p_cnx, &b, 1); + bops->mark_type(p_bag, p_cnx, "signed long long int"); + + b = sizeof(unsigned long long int); + cops->write(p_cnx, &b, 1); + bops->mark_type(p_bag, p_cnx, "unsigned long long int"); + + b = sizeof(void *); + cops->write(p_cnx, &b, 1); /* size */ + cops->write(p_cnx, &b, 1); /* alignment */ + bops->mark_type(p_bag, p_cnx, "data pointer"); + + b = sizeof(void (*) (void)); + cops->write(p_cnx, &b, 1); /* size */ + cops->write(p_cnx, &b, 1); /* alignment */ + bops->mark_type(p_bag, p_cnx, "function pointer"); + + bops->mark_type(p_bag, p_cnx, "_char_array"); + bops->mark_type(p_bag, p_cnx, "_string"); + + bops->mark_type(p_bag, p_cnx, "_s_gs_cat_elemental"); + + bops->mark_type(p_bag, p_cnx, "_s_gs_cat_struct_field"); + bops->mark_type(p_bag, p_cnx, "_ps_gs_cat_struct_field"); + bops->mark_type(p_bag, p_cnx, "_aps_gs_cat_struct_field"); + bops->mark_type(p_bag, p_cnx, "_paps_gs_cat_struct_field"); + bops->mark_type(p_bag, p_cnx, "_s_gs_cat_struct"); + + bops->mark_type(p_bag, p_cnx, "_s_gs_cat_union_field"); + bops->mark_type(p_bag, p_cnx, "_ps_gs_cat_union_field"); + bops->mark_type(p_bag, p_cnx, "_aps_gs_cat_union_field"); + bops->mark_type(p_bag, p_cnx, "_paps_gs_cat_union_field"); + bops->mark_type(p_bag, p_cnx, "_s_gs_cat_union"); + + bops->mark_type(p_bag, p_cnx, "_s_gs_cat_ref"); + + bops->mark_type(p_bag, p_cnx, "_s_gs_cat_array"); + + bops->mark_type(p_bag, p_cnx, "_s_gs_cat_ignored"); + + bops->mark_type(p_bag, p_cnx, "_ref_s_gs_cat_elemental"); + bops->mark_type(p_bag, p_cnx, "_ref_s_gs_cat_struct"); + bops->mark_type(p_bag, p_cnx, "_ref_s_gs_cat_union"); + bops->mark_type(p_bag, p_cnx, "_ref_s_gs_cat_ref"); + bops->mark_type(p_bag, p_cnx, "_ref_s_gs_cat_array"); + bops->mark_type(p_bag, p_cnx, "_ref_s_gs_cat_ignored"); + + bops->mark_type(p_bag, p_cnx, "_u_gs_category"); + bops->mark_type(p_bag, p_cnx, "_s_gs_type"); + + bops->mark_type(p_bag, p_cnx, "_s_gs_sequence"); + bops->mark_type(p_bag, p_cnx, "_s_gs_message" ); + + bops->mark_type(p_bag, p_cnx, "_ref_s_gs_sequence"); + bops->mark_type(p_bag, p_cnx, "_ref_s_gs_message"); +} + + +/*...................................................................... + * Ignored + */ +static +struct s_gs_cat_ignored * +_gs_ignored_cat_alloc(void) { + struct s_gs_cat_ignored *p_ignored = NULL; + + p_ignored = malloc(sizeof (struct s_gs_cat_ignored)); + + return p_ignored; +} + +static +struct s_gs_cat_ignored * +_gs_ignored_cat_new(void) { + struct s_gs_cat_ignored *p_ignored = NULL; + + p_ignored = _gs_ignored_cat_alloc(); + p_ignored->default_value = NULL; + + return p_ignored; +} + + +struct s_gs_type * +gs_type_new_ignored_with_callback(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name, + long int size, + long int alignment, + void *default_value, + void (*callback)(void *vars, + struct s_gs_type *p_type, + void *data)) { + + struct s_gs_type *p_type = NULL; + struct s_gs_cat_ignored *p_ignored = NULL; + + p_ignored = _gs_ignored_cat_new(); + p_type = _gs_type_new(p_bag, p_connection, name); + + p_type->size = size > 0?size:0; + p_type->alignment = alignment; + + if (size > 0) { + long int aligned_size = aligned(size, alignment); + + p_type->aligned_size = aligned_size; + } else { + p_type->aligned_size = 0; + } + + if (default_value && p_type->size) { + p_ignored->default_value = gs_memdup(default_value, (size_t)size); + } + + p_type->category_code = e_gs_type_cat_ignored; + p_type->category.ignored_data = p_ignored; + + p_type->before_callback = callback; + + return p_type; +} + +struct s_gs_type * +gs_type_new_ignored(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name, + long int size, + long int alignment, + void *default_value) { + return gs_type_new_ignored_with_callback(p_bag, p_connection, name, size, alignment, default_value, NULL); +} diff --git a/src/gras/gs/type.h b/src/gras/gs/type.h new file mode 100644 index 0000000000..0d43a4fb17 --- /dev/null +++ b/src/gras/gs/type.h @@ -0,0 +1,44 @@ +/* gs_type.h */ +#ifndef GS_TYPE_H +#define GS_TYPE_H + + +/* + * Set of categories + */ +union u_gs_category { + void *undefined_data; + struct s_gs_cat_elemental *elemental_data; + struct s_gs_cat_struct *struct_data; + struct s_gs_cat_union *union_data; + struct s_gs_cat_ref *ref_data; + struct s_gs_cat_array *array_data; + struct s_gs_cat_ignored *ignored_data; +}; + + +/* + * A type + */ +struct s_gs_type { + int code; + char *name; + + long int size; + + long int alignment; + long int aligned_size; + + enum e_gs_type_category category_code; + union u_gs_category category; + + void (*before_callback)(void *vars, + struct s_gs_type *p_type, + void *data); + + void (*after_callback)(void *vars, + struct s_gs_type *p_type, + void *data); +}; + +#endif /* GS_TYPE_H */ diff --git a/src/gras/gs/type_driver.c b/src/gras/gs/type_driver.c new file mode 100644 index 0000000000..4455a78b44 --- /dev/null +++ b/src/gras/gs/type_driver.c @@ -0,0 +1,92 @@ +/* gs_type_driver.c */ + +#include "gs/gs_private.h" + +static +gras_dict_t *p_type_driver_dict = NULL; + +void +gs_type_drivers_init(void) { + gras_dict_insert(p_type_driver_dict, "rl", gs_rl_type_driver(), NULL); +} + + +struct s_gs_type_driver * +gs_type_driver_init(const char *name) { + + struct s_gs_type_driver_ops *type_driver_ops = NULL; + struct s_gs_type_driver *p_type_driver = NULL; + + gras_dict_retrieve(p_type_driver_dict, name, (void **)&type_driver_ops); + if (!type_driver_ops) + GS_FAILURE("type driver not found"); + + p_type_driver = calloc(1, sizeof (struct s_gs_type_driver)); + p_type_driver->type_ops = type_driver_ops; + p_type_driver->specific = NULL; + + if (type_driver_ops->_init) { + type_driver_ops->_init(p_type_driver); + } + + return p_type_driver; +} + + + +void +gs_type_driver_exit(struct s_gs_type_driver *p_type_driver){ + + struct s_gs_type_driver_ops *type_driver_ops = NULL; + + type_driver_ops = p_type_driver->type_ops; + if (type_driver_ops->_exit) { + type_driver_ops->_exit(p_type_driver); + } + + p_type_driver->type_ops = NULL; + + if (p_type_driver->specific) { + free(p_type_driver->specific); + p_type_driver->specific = NULL; + } + + free(p_type_driver); +} + +struct s_gs_type_bag * +gs_type_bag_alloc(struct s_gs_type_driver *p_driver) { + + struct s_gs_type_bag *p_bag = NULL; + struct s_gs_type_bag_ops *bag_ops = p_driver->bag_ops; + + p_bag = calloc(1, sizeof(struct s_gs_type_bag)); + + p_bag->bag_ops = bag_ops; + p_bag->p_type_driver = p_driver; + p_bag->specific = NULL; + + if (bag_ops->_init) { + bag_ops->_init(p_bag); + } + + return p_bag; +} + +void +gs_type_bag_free(struct s_gs_type_bag *p_bag) { + + struct s_gs_type_bag_ops *bag_ops = p_bag->bag_ops; + + if (bag_ops->_exit) { + bag_ops->_exit(p_bag); + } + + if (p_bag->specific) { + free(p_bag->specific); + p_bag->specific = NULL; + } + + free(p_bag); +} + diff --git a/src/gras/gs/type_driver.h b/src/gras/gs/type_driver.h new file mode 100644 index 0000000000..6cc0a25f6d --- /dev/null +++ b/src/gras/gs/type_driver.h @@ -0,0 +1,25 @@ +/* gs_type_driver.h */ +#ifndef GS_TYPE_DRIVER_H +#define GS_TYPE_DRIVER_H + +/* used structs */ +struct s_gs_type_bag; +struct s_gs_type_driver; + +struct s_gs_type_driver_ops { + + void + (*_init) (struct s_gs_type_driver *p_type_driver); + + void + (*_exit) (struct s_gs_type_driver *p_type_driver); +}; + +struct s_gs_type_driver { + struct s_gs_type_driver_ops *type_ops; + struct s_gs_type_bag_ops *bag_ops; + void *specific; +}; + + +#endif /* GS_TYPE_DRIVER_H */ diff --git a/src/gras/gs/type_driver_rl.c b/src/gras/gs/type_driver_rl.c new file mode 100644 index 0000000000..6f4a979ce0 --- /dev/null +++ b/src/gras/gs/type_driver_rl.c @@ -0,0 +1,532 @@ +/* gs_rl_type_driver.c */ + +#include "gs/gs_private.h" + +GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(NDR_tdriver_rl,NDR); +/* + * structs + */ +struct s_gs_rl_type_driver { + /**/ + int dummy; +}; + +struct s_gs_rl_type_bag { + gras_dict_t *incoming_dict; + + gras_dynar_t *type_dynar; + gras_dict_t *type_dict; + + gras_dynar_t *message_dynar; + gras_dict_t *message_dict; + + gras_dict_t *outgoing_dict; +}; + +struct s_gs_rl_incoming_connection { + struct s_gs_connection *p_connection; + + gras_dynar_t *type_dynar; + gras_dict_t *type_dict; + + gras_dynar_t *message_dynar; + gras_dict_t *message_dict; +}; + +struct s_gs_rl_outgoing_connection { + struct s_gs_connection *p_connection; + gras_dict_t *type_marker_dict; + gras_dict_t *message_marker_dict; +}; + + +/* + * static vars + */ +static +struct s_gs_type_driver_ops *type_driver_ops = NULL; + +static +struct s_gs_type_bag_ops *type_bag_ops = NULL; + +/* + * exported functions, driver part + */ +struct s_gs_type_driver_ops * +gs_rl_type_driver(void) { + + if (!type_bag_ops) { + type_bag_ops = calloc(1, sizeof(struct s_gs_type_bag_ops)); + + + type_bag_ops->_init = gs_rl_bag__init; + type_bag_ops->_exit = gs_rl_bag__exit; + + + type_bag_ops->register_incoming_connection = gs_rl_bag_register_incoming_connection; + type_bag_ops->register_outgoing_connection = gs_rl_bag_register_outgoing_connection; + + + type_bag_ops->store_type = gs_rl_bag_store_type; + type_bag_ops->store_incoming_type = gs_rl_bag_store_incoming_type; + type_bag_ops->get_type_by_name = gs_rl_bag_get_type_by_name; + type_bag_ops->get_type_by_code = gs_rl_bag_get_type_by_code; + type_bag_ops->mark_type = gs_rl_bag_mark_type; + type_bag_ops->check_type_mark = gs_rl_bag_check_type_mark; + + + type_bag_ops->store_message = gs_rl_bag_store_message; + type_bag_ops->store_incoming_message = gs_rl_bag_store_incoming_message; + type_bag_ops->get_message_by_name = gs_rl_bag_get_message_by_name; + type_bag_ops->get_message_by_code = gs_rl_bag_get_message_by_code; + type_bag_ops->mark_message = gs_rl_bag_mark_message; + type_bag_ops->check_message_mark = gs_rl_bag_check_message_mark; + } + + if (!type_driver_ops) { + type_driver_ops = calloc(1, sizeof(struct s_gs_type_driver_ops)); + + type_driver_ops->_init = gs_rl__init; + type_driver_ops->_exit = gs_rl__exit; + } + + return type_driver_ops; +} + +void +gs_rl__init(struct s_gs_type_driver *p_driver) { + + struct s_gs_rl_type_driver *p_rl = NULL; + + p_rl = calloc(1, sizeof(struct s_gs_rl_type_driver)); + p_driver->specific = p_rl; + p_driver->bag_ops = type_bag_ops; +} + +void +gs_rl__exit(struct s_gs_type_driver *p_driver) { + + struct s_gs_rl_type_driver *p_rl = p_driver->specific; + + free(p_rl); + p_driver->specific = NULL; +} + +/* + * exported functions, bag part + */ + +/* management */ +void +gs_rl_bag__init(struct s_gs_type_bag *p_bag) { + + struct s_gs_rl_type_bag *p_rl = NULL; + + p_rl = calloc(1, sizeof(struct s_gs_rl_type_bag)); + + p_rl->incoming_dict = NULL; + + gras_dynar_new(&p_rl->type_dynar, sizeof(struct s_gs_type *), NULL); + p_rl->type_dict = NULL; + + gras_dynar_new(&p_rl->message_dynar, sizeof(struct s_gs_type *), NULL); + p_rl->message_dict = NULL; + + p_rl->outgoing_dict = NULL; + + p_bag->specific = p_rl; + p_bag->bag_ops = type_bag_ops; + + gs_bootstrap_type_bag(p_bag); +} + +void +gs_rl_bag__exit(struct s_gs_type_bag *p_bag) { + + struct s_gs_rl_type_bag *p_rl = p_bag->specific; + + gras_dict_free(&p_rl->type_dict); + gras_dynar_free(p_rl->type_dynar); + + free(p_rl); + p_bag->specific = NULL; +} + +/* connection */ +void +gs_rl_bag_register_incoming_connection(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx) { + + struct s_gs_rl_type_bag *p_rl = p_bag->specific; + struct s_gs_rl_incoming_connection *p_in = NULL; + + if (p_cnx->direction != e_gs_connection_direction_incoming) + GS_FAILURE("invalid operation"); + + p_in = malloc(sizeof (struct s_gs_rl_incoming_connection)); + + p_in->p_connection = p_cnx; + + gras_dynar_new(&p_in->type_dynar, sizeof(struct s_gs_type *), NULL); + p_in->type_dict = NULL; + + gras_dynar_new(&p_in->message_dynar, sizeof(struct s_gs_type *), NULL); + p_in->message_dict = NULL; + + gras_dict_insert_ext(p_rl->incoming_dict, + (char *)&p_cnx, + sizeof(p_cnx), + p_in, + NULL); + + gs_bootstrap_incoming_connection(p_bag, p_cnx); +} + + +void +gs_rl_bag_register_outgoing_connection(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx) { + + struct s_gs_rl_type_bag *p_rl = p_bag->specific; + struct s_gs_rl_outgoing_connection *p_out = NULL; + + if (p_cnx->direction != e_gs_connection_direction_outgoing) + GS_FAILURE("invalid operation"); + + p_out = malloc(sizeof (struct s_gs_rl_outgoing_connection)); + + p_out->p_connection = p_cnx; + p_out->type_marker_dict = NULL; + p_out->message_marker_dict = NULL; + + gras_dict_insert_ext(p_rl->outgoing_dict, (char *)&p_cnx, sizeof(p_cnx), p_out, NULL); + + gs_bootstrap_outgoing_connection(p_bag, p_cnx); +} + + +/* types */ +void +gs_rl_bag_store_type(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx, + struct s_gs_type *p_type) { + + struct s_gs_rl_type_bag *p_rl = p_bag->specific; + struct s_gs_type **pp_type = NULL; + + pp_type = malloc(sizeof(struct s_gs_type *)); + *pp_type = p_type; + + if (p_cnx) { + struct s_gs_rl_incoming_connection *p_in = NULL; + + if (p_cnx->direction != e_gs_connection_direction_incoming) + GS_FAILURE("invalid operation"); + + gras_dict_retrieve_ext(p_rl->incoming_dict, + (char *)&p_cnx, + sizeof(p_cnx), + (void **)&p_in); + + + p_type->code = gras_dynar_length(p_in->type_dynar); + gras_dynar_insert_at(p_in->type_dynar, p_type->code, pp_type); + gras_dict_insert(p_in->type_dict, p_type->name, pp_type, NULL); + } else { + p_type->code = gras_dynar_length(p_rl->type_dynar); + gras_dynar_insert_at(p_rl->type_dynar, p_type->code, pp_type); + gras_dict_insert(p_rl->type_dict, p_type->name, pp_type, NULL); + } +} + +void +gs_rl_bag_store_incoming_type(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx, + struct s_gs_type *p_type) { + + struct s_gs_rl_type_bag *p_rl = p_bag->specific; + struct s_gs_rl_incoming_connection *p_in = NULL; + struct s_gs_type **pp_type = NULL; + + if (p_cnx->direction != e_gs_connection_direction_incoming) + GS_FAILURE("invalid operation"); + + gras_dict_retrieve_ext(p_rl->incoming_dict, + (char *)&p_cnx, + sizeof(p_cnx), + (void **)&p_in); + + pp_type = malloc(sizeof(struct s_gs_type *)); + *pp_type = p_type; + + gras_dynar_set(p_in->type_dynar, p_type->code, pp_type); + gras_dict_insert(p_in->type_dict, p_type->name, pp_type, NULL); +} + +struct s_gs_type * +gs_rl_bag_get_type_by_name(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx, + const char *name) { + + struct s_gs_rl_type_bag *p_rl = p_bag->specific; + struct s_gs_type **pp_type = NULL; + + if (p_cnx) { + struct s_gs_rl_incoming_connection *p_in = NULL; + + if (p_cnx->direction != e_gs_connection_direction_incoming) + GS_FAILURE("invalid operation"); + + gras_dict_retrieve_ext(p_rl->incoming_dict, + (char *)&p_cnx, + sizeof(p_cnx), + (void **)&p_in); + + gras_dict_retrieve(p_in->type_dict, name, (void **)&pp_type); + } else { + gras_dict_retrieve(p_rl->type_dict, name, (void **)&pp_type); + } + + if (!pp_type) { + DEBUG1("Get type by name '%s': not found",name); + return NULL; + } + + DEBUG1("Get type by name '%s': found",name); + return *pp_type; +} + +struct s_gs_type * +gs_rl_bag_get_type_by_code(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx, + int code) { + + struct s_gs_rl_type_bag *p_rl = p_bag->specific; + struct s_gs_type *p_type = NULL; + + if (p_cnx) { + struct s_gs_rl_incoming_connection *p_in = NULL; + + if (p_cnx->direction != e_gs_connection_direction_incoming) + GS_FAILURE("invalid operation"); + + gras_dict_retrieve_ext(p_rl->incoming_dict, + (char *)&p_cnx, + sizeof(p_cnx), + (void **)&p_in); + + if ((unsigned int)code < gras_dynar_length(p_in->type_dynar)) { + gras_dynar_get(p_in->type_dynar, code, (void **)&p_type); + } + } else { + if ((unsigned int)code < gras_dynar_length(p_rl->type_dynar)) { + gras_dynar_get(p_rl->type_dynar, code, (void **)&p_type); + } + } + + return p_type; +} + +void +gs_rl_bag_mark_type(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx, + const char *name) { + + struct s_gs_rl_type_bag *p_rl = p_bag->specific; + struct s_gs_rl_outgoing_connection *p_out = NULL; + + if (p_cnx->direction != e_gs_connection_direction_outgoing) + GS_FAILURE("invalid operation"); + + gras_dict_retrieve_ext(p_rl->outgoing_dict, (char *)&p_cnx, sizeof(p_cnx), (void **)&p_out); + + if (!p_out) + GS_FAILURE("unregistered connection"); + + gras_dict_insert(p_out->type_marker_dict, name, strdup(name), NULL); +} + +int +gs_rl_bag_check_type_mark(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx, + const char *name) { + + struct s_gs_rl_type_bag *p_rl = p_bag->specific; + struct s_gs_rl_outgoing_connection *p_out = NULL; + char *result = NULL; + + if (p_cnx->direction != e_gs_connection_direction_outgoing) + GS_FAILURE("invalid operation"); + + gras_dict_retrieve_ext(p_rl->outgoing_dict, (char *)&p_cnx, sizeof(p_cnx), (void **)&p_out); + + if (!p_out) + GS_FAILURE("unregistered connection"); + + gras_dict_retrieve(p_out->type_marker_dict, name, (void **)&result); + + return !!result; +} + +/* messages */ +void +gs_rl_bag_store_message(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx, + struct s_gs_message *p_message) { + + struct s_gs_rl_type_bag *p_rl = p_bag->specific; + struct s_gs_message **pp_message = NULL; + + pp_message = malloc(sizeof(struct s_gs_message *)); + *pp_message = p_message; + + if (p_cnx) { + struct s_gs_rl_incoming_connection *p_in = NULL; + + if (p_cnx->direction != e_gs_connection_direction_incoming) + GS_FAILURE("invalid operation"); + + gras_dict_retrieve_ext(p_rl->incoming_dict, + (char *)&p_cnx, + sizeof(p_cnx), + (void **)&p_in); + + + p_message->code = gras_dynar_length(p_in->message_dynar); + gras_dynar_insert_at(p_in->message_dynar, p_message->code, pp_message); + gras_dict_insert(p_in->message_dict, p_message->name, pp_message, NULL); + } else { + p_message->code = gras_dynar_length(p_rl->message_dynar); + gras_dynar_insert_at(p_rl->message_dynar, p_message->code, pp_message); + gras_dict_insert(p_rl->message_dict, p_message->name, pp_message, NULL); + } +} + +void +gs_rl_bag_store_incoming_message(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx, + struct s_gs_message *p_message) { + + struct s_gs_rl_type_bag *p_rl = p_bag->specific; + struct s_gs_rl_incoming_connection *p_in = NULL; + struct s_gs_message **pp_message = NULL; + + if (p_cnx->direction != e_gs_connection_direction_incoming) + GS_FAILURE("invalid operation"); + + gras_dict_retrieve_ext(p_rl->incoming_dict, + (char *)&p_cnx, + sizeof(p_cnx), + (void **)&p_in); + + pp_message = malloc(sizeof(struct s_gs_message *)); + *pp_message = p_message; + + gras_dynar_set(p_in->message_dynar, p_message->code, pp_message); + gras_dict_insert(p_in->message_dict, p_message->name, pp_message, NULL); +} + +struct s_gs_message * +gs_rl_bag_get_message_by_name(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx, + const char *name) { + + struct s_gs_rl_type_bag *p_rl = p_bag->specific; + struct s_gs_message **pp_message = NULL; + + if (p_cnx) { + struct s_gs_rl_incoming_connection *p_in = NULL; + + if (p_cnx->direction != e_gs_connection_direction_incoming) + GS_FAILURE("invalid operation"); + + gras_dict_retrieve_ext(p_rl->incoming_dict, + (char *)&p_cnx, + sizeof(p_cnx), + (void **)&p_in); + + gras_dict_retrieve(p_in->message_dict, name, (void **)&pp_message); + } else { + gras_dict_retrieve(p_rl->message_dict, name, (void **)&pp_message); + } + + if (!pp_message) { + return NULL; + } + + return *pp_message; +} + +struct s_gs_message * +gs_rl_bag_get_message_by_code(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx, + int code) { + + struct s_gs_rl_type_bag *p_rl = p_bag->specific; + struct s_gs_message *p_message = NULL; + + if (p_cnx) { + struct s_gs_rl_incoming_connection *p_in = NULL; + + if (p_cnx->direction != e_gs_connection_direction_incoming) + GS_FAILURE("invalid operation"); + + gras_dict_retrieve_ext(p_rl->incoming_dict, + (char *)&p_cnx, + sizeof(p_cnx), + (void **)&p_in); + + if ((unsigned int)code < gras_dynar_length(p_in->message_dynar)) { + gras_dynar_get(p_in->message_dynar, code, (void **)&p_message); + } + } else { + if ((unsigned int)code < gras_dynar_length(p_rl->message_dynar)) { + gras_dynar_get(p_rl->message_dynar, code, (void **)&p_message); + } + } + + return p_message; +} + +void +gs_rl_bag_mark_message(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx, + const char *name) { + + struct s_gs_rl_type_bag *p_rl = p_bag->specific; + struct s_gs_rl_outgoing_connection *p_out = NULL; + + if (p_cnx->direction != e_gs_connection_direction_outgoing) + GS_FAILURE("invalid operation"); + + gras_dict_retrieve_ext(p_rl->outgoing_dict, (char *)&p_cnx, sizeof(p_cnx), (void **)&p_out); + + if (!p_out) + GS_FAILURE("unregistered connection"); + + gras_dict_insert(p_out->message_marker_dict, name, strdup(name), NULL); +} + +int +gs_rl_bag_check_message_mark(struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx, + const char *name) { + + struct s_gs_rl_type_bag *p_rl = p_bag->specific; + struct s_gs_rl_outgoing_connection *p_out = NULL; + char *result = NULL; + + if (p_cnx->direction != e_gs_connection_direction_outgoing) + GS_FAILURE("invalid operation"); + + gras_dict_retrieve_ext(p_rl->outgoing_dict, (char *)&p_cnx, sizeof(p_cnx), (void **)&p_out); + + if (!p_out) + GS_FAILURE("unregistered connection"); + + gras_dict_retrieve(p_out->message_marker_dict, name, (void **)&result); + + return !!result; +} + + diff --git a/src/gras/gs/type_interface_rl.h b/src/gras/gs/type_interface_rl.h new file mode 100644 index 0000000000..0bcf4bea68 --- /dev/null +++ b/src/gras/gs/type_interface_rl.h @@ -0,0 +1,98 @@ +/* gs_rl_type_interface.h */ +#ifndef GS_RL_TYPE_INTERFACE_H +#define GS_RL_TYPE_INTERFACE_H + +struct s_gs_type_driver_ops * +gs_rl_type_driver(void); + + + +void +gs_rl__init(struct s_gs_type_driver *p_driver); + +void +gs_rl__exit(struct s_gs_type_driver *p_driver); + + + +void +gs_rl_bag__init(struct s_gs_type_bag *p_bag); + +void +gs_rl_bag__exit(struct s_gs_type_bag *p_bag); + + + +void +gs_rl_bag_register_incoming_connection (struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection); + +void +gs_rl_bag_register_outgoing_connection (struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection); + + + +void +gs_rl_bag_store_type (struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + struct s_gs_type *p_type); + +void +gs_rl_bag_store_incoming_type (struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx, + struct s_gs_type *p_type); + +struct s_gs_type * +gs_rl_bag_get_type_by_name (struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name); + +struct s_gs_type * +gs_rl_bag_get_type_by_code (struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + int code); + +void +gs_rl_bag_mark_type (struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name); + +int +gs_rl_bag_check_type_mark (struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name); + + + +void +gs_rl_bag_store_message (struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + struct s_gs_message *p_message); + +void +gs_rl_bag_store_incoming_message (struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_cnx, + struct s_gs_message *p_message); + +struct s_gs_message * +gs_rl_bag_get_message_by_name (struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name); + +struct s_gs_message * +gs_rl_bag_get_message_by_code (struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + int code); + +void +gs_rl_bag_mark_message (struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name); + +int +gs_rl_bag_check_message_mark (struct s_gs_type_bag *p_bag, + struct s_gs_connection *p_connection, + const char *name); + +#endif /* GS_RL_TYPE_INTERFACE_H */ diff --git a/src/gras/gs/vars.c b/src/gras/gs/vars.c new file mode 100644 index 0000000000..af6d42cb93 --- /dev/null +++ b/src/gras/gs/vars.c @@ -0,0 +1,223 @@ +/* gs_vars.c */ + +#include "gs/gs_private.h" + +struct s_gs_var { + struct s_gs_type *p_type; + void *data; +}; + + +struct s_gs_vars { + gras_dict_t *space; + gras_dynar_t *stack; + gras_dynar_t *globals; +}; + + +static +void +_gs_vars_pop(struct s_gs_vars *p_vars, + const char *name) { + + gras_dynar_t *p_dynar = NULL; + struct s_gs_var *p_var = NULL; + + gras_dict_retrieve(p_vars->space, name, (void **)&p_dynar); + gras_dynar_pop(p_dynar, &p_var); + + if (!gras_dynar_length(p_dynar)) { + gras_dict_remove(p_vars->space, name); + gras_dynar_free_container(p_dynar); + } + + free(p_var); +} + +void * +gs_vars_pop(void *_p_vars, + const char *name, + struct s_gs_type **pp_type) { + + struct s_gs_vars *p_vars = _p_vars; + gras_dynar_t *p_dynar = NULL; + struct s_gs_var *p_var = NULL; + void *data = NULL; + + gras_dict_retrieve(p_vars->space, name, (void **)&p_dynar); + gras_dynar_pop(p_dynar, &p_var); + + if (!gras_dynar_length(p_dynar)) { + gras_dict_remove(p_vars->space, name); + gras_dynar_free_container(p_dynar); + } + + if (pp_type) { + *pp_type = p_var->p_type; + } + + data = p_var->data; + + free(p_var); + + gras_dynar_pop(p_vars->stack, &p_dynar); + { + int l = gras_dynar_length(p_dynar); + + while (l--) { + char *_name = NULL; + + gras_dynar_get(p_dynar, l, &_name); + if (!strcmp(name, _name)) { + gras_dynar_remove_at(p_dynar, l, &_name); + free(_name); + break; + } + } + } + gras_dynar_push(p_vars->stack, &p_dynar); + + + return data; +} + +void +gs_vars_push(void *_p_vars, + struct s_gs_type *p_type, + const char *name, + void *data) { + + struct s_gs_vars *p_vars = _p_vars; + gras_dynar_t *p_dynar = NULL; + struct s_gs_var *p_var = NULL; + + name = strdup(name); + + gras_dict_retrieve(p_vars->space, name, (void **)&p_dynar); + + if (!p_dynar) { + gras_dynar_new(&p_dynar, sizeof (struct s_gs_var *), NULL); + gras_dict_insert(p_vars->space, name, (void **)p_dynar, NULL); + } + + p_var = calloc(1, sizeof(struct s_gs_var)); + p_var->p_type = p_type; + p_var->data = data; + + gras_dynar_push(p_dynar, &p_var); + + gras_dynar_pop(p_vars->stack, &p_dynar); + gras_dynar_push(p_dynar, &name); + gras_dynar_push(p_vars->stack, &p_dynar); +} + +void +gs_vars_set(void *_p_vars, + struct s_gs_type *p_type, + const char *name, + void *data) { + + struct s_gs_vars *p_vars = _p_vars; + gras_dynar_t *p_dynar = NULL; + struct s_gs_var *p_var = NULL; + + name = strdup(name); + gras_dict_retrieve(p_vars->space, name, (void **)&p_dynar); + + if (!p_dynar) { + gras_dynar_new(&p_dynar, sizeof (struct s_gs_var *), NULL); + gras_dict_insert(p_vars->space, name, (void **)p_dynar, NULL); + + p_var = calloc(1, sizeof(struct s_gs_var)); + gras_dynar_push(p_vars->globals, &name); + } else { + gras_dynar_pop(p_dynar, &p_var); + } + + p_var->p_type = p_type; + p_var->data = data; + + gras_dynar_push(p_dynar, &p_var); +} + +void * +gs_vars_get(void *_p_vars, + const char *name, + struct s_gs_type **pp_type) { + + struct s_gs_vars *p_vars = _p_vars; + gras_dynar_t *p_dynar = NULL; + struct s_gs_var *p_var = NULL; + + gras_dict_retrieve(p_vars->space, name, (void **)&p_dynar); + gras_dynar_pop(p_dynar, &p_var); + gras_dynar_push(p_dynar, &p_var); + + if (pp_type) { + *pp_type = p_var->p_type; + } + + return p_var->data; +} + +void +gs_vars_enter(void *_p_vars) { + + struct s_gs_vars *p_vars = _p_vars; + gras_dynar_t *p_dynar = NULL; + + gras_dynar_new(&p_dynar, sizeof (char *), NULL); + gras_dynar_push(p_vars->stack, &p_dynar); +} + + +void +gs_vars_leave(void *_p_vars) { + struct s_gs_vars *p_vars = _p_vars; + gras_dynar_t *p_dynar = NULL; + int cursor = 0; + char *name = NULL; + + gras_dynar_pop(p_vars->stack, &p_dynar); + + gras_dynar_foreach(p_dynar, cursor, name) { + _gs_vars_pop(p_vars, name); + free(name); + } + + gras_dynar_free_container(p_dynar); +} + + +void * +gs_vars_alloc(void) { + + struct s_gs_vars *p_vars = NULL; + + p_vars = calloc(1, sizeof (struct s_gs_vars)); + + p_vars->space = NULL; + gras_dynar_new(&p_vars->stack, sizeof (gras_dynar_t *), NULL); + + gs_vars_enter(p_vars); + + gras_dynar_pop(p_vars->stack, &p_vars->globals); + gras_dynar_push(p_vars->stack, &p_vars->globals); + + return p_vars; +} + + +void +gs_vars_free(void *_p_vars) { + + struct s_gs_vars *p_vars = _p_vars; + + gs_vars_leave(p_vars); + + gras_dynar_free_container(p_vars->stack); + gras_dict_free(&p_vars->space); + + free(p_vars); +} + diff --git a/src/nws_portability/.cvsignore b/src/nws_portability/.cvsignore new file mode 100644 index 0000000000..dc4ea0ba23 --- /dev/null +++ b/src/nws_portability/.cvsignore @@ -0,0 +1 @@ +Makedefs build-* config.log config.status diff --git a/src/nws_portability/Copyright b/src/nws_portability/Copyright new file mode 100644 index 0000000000..ba08528087 --- /dev/null +++ b/src/nws_portability/Copyright @@ -0,0 +1,28 @@ +Copyright (c) 2002, The Regents of the University of California +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. +Neither the names of the University of California, nor the names of its +contributors may be used to endorse or promote products derived from this +software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + diff --git a/src/nws_portability/Forecast/Makefile b/src/nws_portability/Forecast/Makefile new file mode 100644 index 0000000000..a69fbae9a4 --- /dev/null +++ b/src/nws_portability/Forecast/Makefile @@ -0,0 +1,42 @@ +# +# Makefile for Forecaster + +# include common variables +include ../Makedefs + +# these are the targets +LIBRARY = $(buildlibdir)/libNwsForecast.a + +# objects we are creating here +OBJS = $(buildobjdir)/exp_smooth.o \ + $(buildobjdir)/fbuff.o \ + $(buildobjdir)/forc.o \ + $(buildobjdir)/forecast_api.o \ + $(buildobjdir)/last_value.o \ + $(buildobjdir)/median.o \ + $(buildobjdir)/mse_forc.o \ + $(buildobjdir)/run_mean.o + +.PHONY: all clean dist + +all: $(LIBRARY) + +clean: + @$(RM) -f $(OBJS) + +dist: + @$(INSTALL) -d $(DIST_ROOT)/Forecast + @$(CP) Makefile *.c $(DIST_ROOT)/Forecast + +$(LIBRARY): $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + $(RANLIB) $@ + +#pure: +# $(MAKE) LD="$(PURIFY) $(LD)" + + +# Compilation rules for C. +$(buildobjdir)/%.o : %.c ../Include/config_portability.h ../Include/%.h ../Include/forc.h + $(CC) $(INCLUDES) $(CFLAGS) -g -c $< -o $@ + diff --git a/src/nws_portability/Forecast/exp_smooth.c b/src/nws_portability/Forecast/exp_smooth.c new file mode 100644 index 0000000000..0615f638a5 --- /dev/null +++ b/src/nws_portability/Forecast/exp_smooth.c @@ -0,0 +1,104 @@ +/* $Id$ */ + +#include +#include +#include +#include +#include +#include + +#include "fbuff.h" +#include "exp_smooth.h" + +struct exp_smooth_state +{ + fbuff series; /* the series so far */ + fbuff time_stamps; /* the time stamps */ + double last_pred; + double gain; +}; + +/* + * init local state. can save a copy of the pointer to the + * series and time stamps, if desired + */ +char * +InitExpSmooth(fbuff series, fbuff time_stamps, char *params) +{ + struct exp_smooth_state *state; + double gain; + char *p_str; + + state = (struct exp_smooth_state *) + malloc(sizeof(struct exp_smooth_state)); + + if(state == NULL) + { + return(NULL); + } + + if(params == NULL) + { + free(state); + return(NULL); + } + + p_str = params; + gain = strtod(p_str,&p_str); + + /* + * all functions take a series and time_stamps + */ + state->series = series; + state->time_stamps = time_stamps; + state->last_pred = 0.0; + state->gain = gain; + + return((char *)state); +} + +void +FreeExpSmooth(char *state) +{ + free(state); + return; +} + +void +UpdateExpSmooth(char *state, + double ts, + double value) +{ + double pred; + struct exp_smooth_state *s = (struct exp_smooth_state *)state; + + pred = s->last_pred + s->gain * (value - s->last_pred); + + /* + * if there is only one value, last pred is the first valeu in the + * series + */ + if(F_COUNT(s->series) <= 1) + { + s->last_pred = F_VAL(s->series,F_FIRST(s->series)); + } + else + { + s->last_pred = pred; + } + + return; +} + +int +ForcExpSmooth(char *state, double *v) +{ + struct exp_smooth_state *s = (struct exp_smooth_state *)state; + + *v = s->last_pred; + + return(1); + +} + + diff --git a/src/nws_portability/Forecast/fbuff.c b/src/nws_portability/Forecast/fbuff.c new file mode 100644 index 0000000000..d5de930057 --- /dev/null +++ b/src/nws_portability/Forecast/fbuff.c @@ -0,0 +1,72 @@ +/* $Id$ */ + +#include +#include +#include +#include + +#include "fbuff.h" + +fbuff +InitFBuff(int size) +{ + fbuff lb; + + lb = (fbuff)malloc(FBUFF_SIZE); + + if(lb == NULL) + { + fprintf(stderr,"InitFBuff: couldn't get space for fbuff\n"); + fflush(stderr); + return(NULL); + } + + /* + * count from bottom to top + * + * head is the next available space + * tail is the last valid data item + */ + lb->size = size; + lb->head = size - 1; + lb->tail = 0; + + lb->vals = (double *)malloc(size*sizeof(double)); + if(lb->vals == NULL) + { + fprintf(stderr,"InitFBuff: couldn't get space for vals\n"); + fflush(stderr); + free(lb); + return(NULL); + } + + return(lb); + +} + +void +FreeFBuff(fbuff fb) +{ + free(fb->vals); + free(fb); + + return; +} + +void +UpdateFBuff(fbuff fb, double val) +{ + F_HEAD(fb) = val; + fb->head = MODMINUS(fb->head,1,fb->size); + + /* + * if we have moved the head over the tail, bump the tail around too + */ + if(fb->head == fb->tail) + { + fb->tail = MODMINUS(fb->tail,1,fb->size); + } + + return; +} + diff --git a/src/nws_portability/Forecast/forc.c b/src/nws_portability/Forecast/forc.c new file mode 100644 index 0000000000..e59e6ba1bb --- /dev/null +++ b/src/nws_portability/Forecast/forc.c @@ -0,0 +1,1152 @@ +#include +#include +#include +#include +#include +#include + + + +/* + * individual forecaster packages + */ +#include "forecasters.h" + +#include "mse_forc.h" +#include "forc.h" + +#define FORECASTER(name,init,params,freer,update,forecaster) \ +{ \ + frb = InitForcB(series, \ + time_stamps, \ + (name), \ + (init), \ + (params), \ + (freer), \ + (update), \ + (forecaster)); \ + \ + if(frb == NULL) \ + { \ + free(l_forcl); \ + free(forcs); \ + free(derived_forcs); \ + FreeFBuff(series); \ + FreeFBuff(time_stamps); \ + return(NULL); \ + } \ + \ + frb->series = series; \ + frb->time_stamps = time_stamps; \ + forcs[l_forcl->count] = frb; \ + l_forcl->count = l_forcl->count + 1; \ +} + + +#define DERIVED_FORC(name,init,params,freer,update,forecaster) \ +{ \ + frb = InitForcB(series, \ + time_stamps, \ + (name), \ + (init), \ + (params), \ + (freer), \ + (update), \ + (forecaster)); \ + \ + if(frb == NULL) \ + { \ + free((char *)forcs); \ + free((char *)derived_forcs); \ + FreeFBuff(series); \ + FreeFBuff(time_stamps); \ + for(i=0; i < l_forcl->count; i++) \ + { \ + FreeForcB(l_forcl->forcs[i]); \ + } \ + free((char *)l_forcl); \ + return(NULL); \ + } \ + frb->series = series; \ + frb->time_stamps = time_stamps; \ + derived_forcs[l_forcl->derived_count] = frb; \ + l_forcl->derived_count = l_forcl->derived_count + 1; \ +} + +forcb +InitForcB(fbuff series, + fbuff time_stamps, + const char *name, + char *(*init)(), + const char *params, + void (*freer)(), + void (*update)(), + int (*forecast)()) +{ + forcb frb; + + frb = (forcb)malloc(FORCB_SIZE); + + + if(frb == NULL) + { + return(NULL); + } + + /* + * get fbuff space for the cumulative error series -- needed + * for windowed MSE and MAE predictions + */ + frb->se_series = InitFBuff(MAX_MSE_WIN); + + if(frb->se_series == NULL) + { + free(frb); + return(NULL); + } + + frb->ae_series = InitFBuff(MAX_MSE_WIN); + + if(frb->se_series == NULL) + { + FreeFBuff(frb->se_series); + free(frb); + return(NULL); + } + /* + * could be NULL because of derived forecasters + */ + if(init != NULL) + { + frb->state = (*init)(series,time_stamps,params); + if(frb == NULL) + { + FreeFBuff(frb->se_series); + FreeFBuff(frb->ae_series); + free(frb); + fprintf(stderr,"InitForcB: init failed for %s\n", + name); + fflush(stderr); + return(NULL); + } + } + else + { + frb->state = NULL; + } + + frb->update = update; + frb->forecast = forecast; + frb->free = freer; + + + frb->se = 0.0; + frb->ae = 0.0; + frb->count = 0.0; + strncpy(frb->name,name,sizeof(frb->name)); + + /* + * point forcb at the series and time stamp buffers + */ + frb->series = series; + frb->time_stamps = time_stamps; + + frb->best_f = 0.0; + frb->best_i = 0; + frb->best_err = 0.0; + + + return(frb); +} + +void +FreeForcB(forcb frb) +{ + if(frb->state != NULL) + { + frb->free(frb->state); + } + + /* + * defensive programming + */ + if(frb->se_series != NULL) + { + FreeFBuff(frb->se_series); + } + if(frb->ae_series != NULL) + { + FreeFBuff(frb->ae_series); + } + free(frb); + + return; +} + +void +FreeForcl(char *i_forcl) +{ + int i; + forcl l_forcl; + + l_forcl = (forcl)i_forcl; + + /* + * shared by all forcbs + */ + FreeFBuff(l_forcl->forcs[0]->series); + FreeFBuff(l_forcl->forcs[0]->time_stamps); + + for(i=0; i < l_forcl->count; i++) + { + FreeForcB(l_forcl->forcs[i]); + } + for(i=0; i < l_forcl->derived_count; i++) + { + FreeForcB(l_forcl->derived_forcs[i]); + } + + /* + * the state is the l_forcl itself -- clear it to free works + * properly + */ + l_forcl->total_mse->state = NULL; + l_forcl->total_mae->state = NULL; + FreeForcB(l_forcl->total_mse); + FreeForcB(l_forcl->total_mae); + + free(l_forcl->derived_forcs); + free(l_forcl->forcs); + free(l_forcl); + + return; +} + +/* + * initializes a single fbuff for the data series and another for the + * time stamps. + * + * initializes an array of forcb structs, one per forecaster + * + * points each forcb to the series and time stamps + */ +char * +InitForcl(int max_forc_count, int buff_size) +{ + forcb frb; + forcb *forcs; + forcb *derived_forcs; + forcl l_forcl; + fbuff series; + fbuff time_stamps; + int i; + char derived_params[255]; + + /* + * first, get space for series and time stamps + */ + series = InitFBuff(buff_size); + if(series == NULL) + { + fprintf(stderr,"InitForcs: couldn't get fbuff for series\n"); + fflush(stderr); + return(NULL); + } + + time_stamps = InitFBuff(buff_size); + if(time_stamps == NULL) + { + fprintf(stderr, + "InitForcs: couldn't get fbuff for time stamps\n"); + fflush(stderr); + FreeFBuff(series); + return(NULL); + } + + /* + * now, get forcl list space + */ + l_forcl = (forcl)(malloc(FORCL_SIZE)); + if(l_forcl == NULL) + { + fprintf(stderr,"InitForcs: couldn't malloc %d forcl\n", + max_forc_count); + fflush(stderr); + FreeFBuff(series); + FreeFBuff(time_stamps); + return(NULL); + } + + memset((char *)l_forcl,0,FORCL_SIZE); + l_forcl->derived_count = 0; + + /* + * get space for individual forecasters + */ + forcs = (forcb *)(malloc(max_forc_count*sizeof(forcb))); + + if(forcs == NULL) + { + fprintf(stderr,"InitForcl: couldn't malloc %d forcb pointers\n", + max_forc_count); + fflush(stderr); + free(l_forcl); + FreeFBuff(series); + FreeFBuff(time_stamps); + return(NULL); + } + + /* + * get space for derived forecasters + */ + derived_forcs = (forcb *)(malloc(max_forc_count*sizeof(forcb))); + + if(derived_forcs == NULL) + { + fprintf(stderr,"InitForcl: couldn't malloc %d derived forcb pointers\n", + max_forc_count); + fflush(stderr); + free(l_forcl); + FreeFBuff(series); + FreeFBuff(time_stamps); + free(forcs); + return(NULL); + } + + l_forcl->forcs = forcs; + l_forcl->derived_forcs = derived_forcs; + + /* + * include the primary forecasters + */ +#include "forecasters.c" + + + /* + * now do derived forecaster types + */ + + /* + * for min MSE, we set the window size to 0. The first + * argument is the address of the forc list structure we are building + * + * thread safe? I think not. + */ + sprintf(derived_params, + "%p %d", + (void *)l_forcl, + 0); + DERIVED_FORC("Minimum MSE", + InitWinMSE, + derived_params, + FreeWinMSE, + NULL, + LocalWinMSEForecast); + + /* + * for min MAE, we set the window size to 0. The first + * argument is the address of the forc list structure we are building + * + * thread safe? I think not. + */ + sprintf(derived_params, + "%p %d", + (void *)l_forcl, + 0); + + DERIVED_FORC("Minimum MAE", + InitWinMAE, + derived_params, + FreeWinMAE, + NULL, + LocalWinMAEForecast); + + /* + * for min windowed MSE, we set the window size to 1. The first + * argument is the address of the forc list structure we are building + * + * thread safe? I think not. + */ + sprintf(derived_params, + "%p %d", + (void *)l_forcl, + 1); + DERIVED_FORC("Minimum Window 1 MSE", + InitWinMSE, + derived_params, + FreeWinMSE, + NULL, + LocalWinMSEForecast); + /* + * for min windowed MSE, we set the window size to 5. The first + * argument is the address of the forc list structure we are building + * + * thread safe? I think not. + */ + sprintf(derived_params, + "%p %d", + (void *)l_forcl, + 5); + DERIVED_FORC("Minimum Window 5 MSE", + InitWinMSE, + derived_params, + FreeWinMSE, + NULL, + LocalWinMSEForecast); + + /* + * for min windowed MSE, we set the window size to 10. The first + * argument is the address of the forc list structure we are building + * + * thread safe? I think not. + */ + sprintf(derived_params, + "%p %d", + (void *)l_forcl, + 10); + DERIVED_FORC("Minimum Window 10 MSE", + InitWinMSE, + derived_params, + FreeWinMSE, + NULL, + LocalWinMSEForecast); + + /* + * for min windowed MSE, we set the window size to 20. The first + * argument is the address of the forc list structure we are building + * + * thread safe? I think not. + */ + sprintf(derived_params, + "%p %d", + (void *)l_forcl, + 20); + DERIVED_FORC("Minimum Window 20 MSE", + InitWinMSE, + derived_params, + FreeWinMSE, + NULL, + LocalWinMSEForecast); + /* + * for min windowed MSE, we set the window size to 30. The first + * argument is the address of the forc list structure we are building + * + * thread safe? I think not. + */ + sprintf(derived_params, + "%p %d", + (void *)l_forcl, + 30); + DERIVED_FORC("Minimum Window 30 MSE", + InitWinMSE, + derived_params, + FreeWinMSE, + NULL, + LocalWinMSEForecast); + /* + * for min windowed MSE, we set the window size to 50. The first + * argument is the address of the forc list structure we are building + * + * thread safe? I think not. + */ + sprintf(derived_params, + "%p %d", + (void *)l_forcl, + 50); + DERIVED_FORC("Minimum Window 50 MSE", + InitWinMSE, + derived_params, + FreeWinMSE, + NULL, + LocalWinMSEForecast); + /* + * for min windowed MSE, we set the window size to 100. The first + * argument is the address of the forc list structure we are building + * + * thread safe? I think not. + */ + sprintf(derived_params, + "%p %d", + (void *)l_forcl, + 100); + DERIVED_FORC("Minimum Window 100 MSE", + InitWinMSE, + derived_params, + FreeWinMSE, + NULL, + LocalWinMSEForecast); + + /* + * for win min MAE, with window size to 1. The first + * argument is the address of the forc list structure we are building + * + * thread safe? I think not. + */ + sprintf(derived_params, + "%p %d", + (void *)l_forcl, + 1); + + DERIVED_FORC("Minimum Window 1 MAE", + InitWinMAE, + derived_params, + FreeWinMAE, + NULL, + LocalWinMAEForecast); + /* + * for win min MAE, with window size to 5. The first + * argument is the address of the forc list structure we are building + * + * thread safe? I think not. + */ + sprintf(derived_params, + "%p %d", + (void *)l_forcl, + 5); + + DERIVED_FORC("Minimum Window 5 MAE", + InitWinMAE, + derived_params, + FreeWinMAE, + NULL, + LocalWinMAEForecast); + /* + * for win min MAE, with window size to 10. The first + * argument is the address of the forc list structure we are building + * + * thread safe? I think not. + */ + sprintf(derived_params, + "%p %d", + (void *)l_forcl, + 10); + + DERIVED_FORC("Minimum Window 10 MAE", + InitWinMAE, + derived_params, + FreeWinMAE, + NULL, + LocalWinMAEForecast); + /* + * for win min MAE, with window size to 20. The first + * argument is the address of the forc list structure we are building + * + * thread safe? I think not. + */ + sprintf(derived_params, + "%p %d", + (void *)l_forcl, + 20); + + DERIVED_FORC("Minimum Window 20 MAE", + InitWinMAE, + derived_params, + FreeWinMAE, + NULL, + LocalWinMAEForecast); + /* + * for win min MAE, with window size to 30. The first + * argument is the address of the forc list structure we are building + * + * thread safe? I think not. + */ + sprintf(derived_params, + "%p %d", + (void *)l_forcl, + 30); + + DERIVED_FORC("Minimum Window 30 MAE", + InitWinMAE, + derived_params, + FreeWinMAE, + NULL, + LocalWinMAEForecast); + /* + * for win min MAE, with window size to 50. The first + * argument is the address of the forc list structure we are building + * + * thread safe? I think not. + */ + sprintf(derived_params, + "%p %d", + (void *)l_forcl, + 50); + + DERIVED_FORC("Minimum Window 50 MAE", + InitWinMAE, + derived_params, + FreeWinMAE, + NULL, + LocalWinMAEForecast); + /* + * for win min MAE, with window size to 100. The first + * argument is the address of the forc list structure we are building + * + * thread safe? I think not. + */ + sprintf(derived_params, + "%p %d", + (void *)l_forcl, + 100); + + DERIVED_FORC("Minimum Window 100 MAE", + InitWinMAE, + derived_params, + FreeWinMAE, + NULL, + LocalWinMAEForecast); + /* + * end of derived forecaster init + */ + + /* + * now init a total MSE forcb for the + * list + */ + + frb = InitForcB(series, + time_stamps, + "Total MSE", + NULL, /* no init */ + NULL, /* no params */ + NULL, /* no free */ + NULL, /* no update */ + TotalMSEForecast); /* MSE forecast */ + if(frb == NULL) + { + free(forcs); + free(derived_forcs); + FreeFBuff(series); + FreeFBuff(time_stamps); + for(i=0; i < l_forcl->count; i++) + { + FreeForcB(l_forcl->forcs[i]); + } + for(i=0; i < l_forcl->derived_count; i++) + { + FreeForcB(l_forcl->derived_forcs[i]); + } + free(l_forcl->derived_forcs); + free(l_forcl); + return(NULL); + } + frb->series = series; + frb->time_stamps = time_stamps; + frb->ae = 0.0; + frb->se = 0.0; + frb->count = 0.0; + /* + * total forecasters take forcl as state + */ + frb->state = (char *)l_forcl; + l_forcl->total_mse = frb; + + /* + * now init a total MAE forcb for the + * list + */ + + frb = InitForcB(series, + time_stamps, + "Total MAE", + NULL, /* no init */ + NULL, /* no params */ + NULL, /* no free */ + NULL, /* no update */ + TotalMAEForecast); /* MSE forecast */ + if(frb == NULL) + { + free(forcs); + free(derived_forcs); + FreeFBuff(series); + FreeFBuff(time_stamps); + for(i=0; i < l_forcl->count; i++) + { + FreeForcB(l_forcl->forcs[i]); + } + for(i=0; i < l_forcl->derived_count; i++) + { + FreeForcB(l_forcl->derived_forcs[i]); + } + free(l_forcl->derived_forcs); + free(l_forcl); + return(NULL); + } + frb->series = series; + frb->time_stamps = time_stamps; + frb->ae = 0.0; + frb->se = 0.0; + frb->count = 0.0; + /* + * total forecasters take forcl as state + */ + frb->state = (char *)l_forcl; + l_forcl->total_mae = frb; + + + + return((char *)l_forcl); + +} + +void +UpdateForecasts(char *i_forcl, double ts, double value) +{ + int i; + double err; + double forecast; + int ferr; + forcl l_forcl; + int forc_okay; + double best_sq_f; + double best_f; + int best_i; + int best_sq_i; + double best_sq_err; + double best_err; + + l_forcl = (forcl)i_forcl; + + forc_okay = 0; + + /* + * get mse forecast for this value and update error + */ + ferr = (l_forcl->total_mse)->forecast((l_forcl->total_mse)->state, + &forecast); + if(ferr == 1) + { + forc_okay = 1; + err = forecast - value; + if(err < 0.0) + { + err = err * -1.0; + } + l_forcl->total_mse->ae += err; + l_forcl->total_mse->se += err*err; + l_forcl->total_mse->count += 1.0; + + /* + * write out the cumulative total in the + * series buffer so that we may do windowed + * mse and mae things + */ + UpdateFBuff(l_forcl->total_mse->se_series, + l_forcl->total_mse->se); + UpdateFBuff(l_forcl->total_mse->ae_series, + l_forcl->total_mse->ae); + } + /* + * get mae forecast for this value and update error + */ + ferr = (l_forcl->total_mae)->forecast((l_forcl->total_mae)->state, + &forecast); + if(ferr == 1) + { + err = forecast - value; + if(err < 0.0) + { + err = err * -1.0; + } + l_forcl->total_mae->ae += err; + l_forcl->total_mae->se += err*err; + l_forcl->total_mae->count += 1.0; + + /* + * write out the cumulative total in the + * series buffer so that we may do windowed + * mse and mae things + */ + UpdateFBuff(l_forcl->total_mae->se_series, + l_forcl->total_mae->se); + UpdateFBuff(l_forcl->total_mae->ae_series, + l_forcl->total_mae->ae); + } + + if(forc_okay == 1) + { + /* + * update derived forecast error values + */ + for(i=0; i < l_forcl->derived_count; i++) + { + /* + * get forecast for this value and update error + */ + ferr = + (l_forcl->derived_forcs[i])->forecast((l_forcl->derived_forcs[i])->state, + &forecast); + if(ferr == 0) + { + continue; + } + forc_okay = 1; + err = forecast - value; + if(err < 0.0) + { + err = err * -1.0; + } + l_forcl->derived_forcs[i]->ae += err; + l_forcl->derived_forcs[i]->se += err*err; + l_forcl->derived_forcs[i]->count += 1.0; + + /* + * write out the cumulative total in the + * series buffer so that we may do windowed + * mse and mae things + */ + UpdateFBuff(l_forcl->derived_forcs[i]->se_series, + l_forcl->derived_forcs[i]->se); + UpdateFBuff(l_forcl->derived_forcs[i]->ae_series, + l_forcl->derived_forcs[i]->ae); + } + } + /* + * first, update the error values + */ + best_sq_err = DBIG_VAL; + best_err = DBIG_VAL; + best_sq_f = 0.0; + best_f = 0.0; + best_sq_i = 0; + best_i = 0; + for(i=0; i < l_forcl->count; i++) + { + /* + * get forecast for this value and update error + */ + ferr = + (l_forcl->forcs[i])->forecast((l_forcl->forcs[i])->state,&forecast); + if(ferr == 0) + { + continue; + } + + err = forecast - value; + if(err < 0.0) + { + err = err * -1.0; + } + l_forcl->forcs[i]->ae += err; + l_forcl->forcs[i]->se += err*err; + l_forcl->forcs[i]->count += 1.0; + + /* + * find the forecast that actually has the min error + */ + if((err*err) < best_sq_err) + { + best_sq_err = err*err; + best_sq_i = i; + best_sq_f = forecast; + } + if(err < best_err) + { + best_err = err; + best_i = i; + best_f = forecast; + } + /* + * write out the cumulative total in the + * series buffer so that we may do windowed + * mse and mae things + */ + UpdateFBuff(l_forcl->forcs[i]->se_series, + l_forcl->forcs[i]->se); + UpdateFBuff(l_forcl->forcs[i]->ae_series, + l_forcl->forcs[i]->ae); + } + + /* + * record the forecast that actually won + */ + if(best_sq_err != DBIG_VAL) + { + l_forcl->total_mse->best_f = best_sq_f; + l_forcl->total_mse->best_i = best_sq_i; + l_forcl->total_mse->best_err += best_sq_err; + + l_forcl->total_mae->best_f = best_f; + l_forcl->total_mae->best_i = best_i; + l_forcl->total_mae->best_err += best_err; + } + + /* + * now update the series and time_stamps fbuffs. all forcs point + * the same series and time_stamp fbuffs + */ + + if(l_forcl->count >= 1) + { + UpdateFBuff(l_forcl->forcs[0]->series, value); + UpdateFBuff(l_forcl->forcs[0]->time_stamps, ts); + } + + for(i=0; i < l_forcl->count; i++) + { + /* + * now update forecast state for the individual forecasters + * + * note that the forecasters need not record the series and + * time_stamp points, hence the ts and value parameters + */ + (l_forcl->forcs[i])->update((l_forcl->forcs[i])->state, + ts, + value); + } + + return; +} + +int +ForcRange(char *i_forcl, double *low, double *high, int *low_i, int *high_i) +{ + forcl l_forcl; + int i; + double min = DBIG_VAL; + double max = -1.0 * DBIG_VAL; + double f; + int err; + + l_forcl = (forcl)i_forcl; + + /* + * simple forecasters + */ + for(i=0; i < l_forcl->count; i++) + { + err = l_forcl->forcs[i]->forecast(l_forcl->forcs[i]->state, + &f); + if(err == 0) + continue; + + if(f < min) + { + min = f; + *low_i = i; + } + + if(f > max) + { + max = f; + *high_i = i; + } + } + + if((min == DBIG_VAL) || (max == (-1.0*DBIG_VAL))) + { + return(0); + } + + *low = min; + *high = max; + + return(1); + +} + +void +PrintForecastSummary(char *i_forcl) +{ + forcl l_forcl; + int i; + + l_forcl = (forcl)i_forcl; + + /* + * simple forecasters + */ + for(i=0; i < l_forcl->count; i++) + { + fprintf(stdout,"MSE: %3.4f\tMAE: %3.4f\t%s\n", + l_forcl->forcs[i]->se/l_forcl->forcs[i]->count, + l_forcl->forcs[i]->ae/l_forcl->forcs[i]->count, + l_forcl->forcs[i]->name); + } + + /* + * secondary forecasters + */ + for(i=0; i < l_forcl->derived_count; i++) + { + fprintf(stdout,"MSE: %3.4f\tMAE: %3.4f\t%s\n", + l_forcl->derived_forcs[i]->se/l_forcl->derived_forcs[i]->count, + l_forcl->derived_forcs[i]->ae/l_forcl->derived_forcs[i]->count, + l_forcl->derived_forcs[i]->name); + } + + /* + * totals + */ + fprintf(stdout,"MSE: %3.4f\tMAE: %3.4f\tTotal MSE\n", + l_forcl->total_mse->se / l_forcl->total_mse->count, + l_forcl->total_mse->ae / l_forcl->total_mse->count); + fprintf(stdout,"MSE: %3.4f\tMAE: %3.4f\tTotal MAE\n", + l_forcl->total_mae->se / l_forcl->total_mae->count, + l_forcl->total_mae->ae / l_forcl->total_mae->count); + fprintf(stdout,"MSE: %3.4f\tMAE: %3.4f\tOptimum\n", + l_forcl->total_mse->best_err/l_forcl->total_mse->count, + l_forcl->total_mae->best_err/l_forcl->total_mse->count); + + return; +} + +void +PrintLifetimeForecastSummary(char *state) +{ + forclife flife; + + flife = (forclife)state; + + PrintForecastSummary(flife->forc_list); + + return; +} + +/* + * routine put in to support FORECASTAPI_MethodName which doesn't + * take a state record + */ +void +GetForcNames(char *state, char *methodNames[], int max_size, int *out_size) +{ + forcl s; + int i; + + s = (forcl)state; + + for(i=0; i < max_size; i++) + { + if(i >= s->count) + break; + + methodNames[i] = s->forcs[i]->name; + } + + *out_size = i; + + return; +} + +char * +InitForcLife(int max_forc_count, int buff_size, double lifetime) +{ + char *l_forcl; + forclife flife; + + /* + * get a forc list for the series + */ + l_forcl = InitForcl(max_forc_count, buff_size); + if(l_forcl == NULL) + { + fprintf(stderr,"InitForcLife: no space for forc list\n"); + fflush(stderr); + return(NULL); + } + + /* + * now, get space for the lifetime forecasting structure + */ + flife = (forclife)malloc(FORCLIFE_SIZE); + if(flife == NULL) + { + FreeForcl(l_forcl); + fprintf(stderr,"InitForcLife: no space for forclife struct\n"); + fflush(stderr); + return(NULL); + } + + + flife->lifetime = lifetime; + flife->epoch_end = 0.0; + flife->total = 0.0; + flife->count = 0.0; + flife->forc_list = l_forcl; + + return((char *)flife); +} + +void +FreeForcLife(char *state) +{ + forclife flife; + + flife = (forclife)state; + + FreeForcl(flife->forc_list); + free(flife); + + return; +} + +void +UpdateForcLife(char *state, double ts, double value) +{ + forclife flife; + double avg; + + flife = (forclife)state; + + /* + * if we are initializing + */ + if(flife->epoch_end == 0.0) + { + flife->epoch_end = ts + flife->lifetime; + } + + if(ts < flife->epoch_end) + { + flife->total += value; + flife->count += 1.0; + } + else + { + if(flife->count == 0.0) + flife->count = 1.0; + + avg = flife->total / flife->count; + UpdateForecasts((char *)flife->forc_list, + flife->epoch_end, + avg); + flife->total = 0.0; + flife->count = 0.0; + flife->epoch_end = ts+flife->lifetime; + } + + return; +} + +double +LifetimeValue(char *state) +{ + forclife flife; + forcl l_forcl; + double value; + + flife = (forclife)state; + l_forcl = (forcl)flife->forc_list; + + value = + F_VAL(l_forcl->forcs[0]->series,F_FIRST(l_forcl->forcs[0]->series)); + + return(value); +} + +double +LifetimeTimestamp(char *state) +{ + forclife flife; + forcl l_forcl; + double ts; + + flife = (forclife)state; + l_forcl = (forcl)flife->forc_list; + + ts = + F_VAL(l_forcl->forcs[0]->time_stamps, + F_FIRST(l_forcl->forcs[0]->time_stamps)); + + return(ts); +} diff --git a/src/nws_portability/Forecast/forecast_api.c b/src/nws_portability/Forecast/forecast_api.c new file mode 100644 index 0000000000..6cd7d38f7b --- /dev/null +++ b/src/nws_portability/Forecast/forecast_api.c @@ -0,0 +1,113 @@ +/* $Id$ */ + +#include /* free() malloc() */ +#include /* strdup() */ +#include "forc.h" /* forecaster functions */ +#include "diagnostic.h" /* FAIL() */ +#include "forecast_api.h" + + +struct FORECASTAPI_ForecastStateStruct { + char *Forecaster_state; +}; + + +void +FORECASTAPI_FreeForecastState(FORECASTAPI_ForecastState **state) { + FreeForcl((*state)->Forecaster_state); + free(*state); + *state = NULL; +} + +const char * +FORECASTAPI_MethodName(unsigned int methodIndex) { + + int i; + static int methodCount = 0; + static char *methodNames[MAX_FORC]; + char *stateForNames; + + if(methodCount == 0) { + stateForNames = InitForcl(MAX_FORC, MAX_DATA_ENTRIES); + GetForcNames(stateForNames, methodNames, MAX_FORC, &methodCount); + /* + ** GetForNames() gives us pointers which will be freed by FreeForcl(), so + ** we have to strdup() them. + */ + for(i = 0; i < methodCount; i++) { + methodNames[i] = strdup(methodNames[i]); + } + FreeForcl(stateForNames); + } + + return((methodIndex < methodCount) ? methodNames[methodIndex] : NULL); + +} + + +FORECASTAPI_ForecastState * +FORECASTAPI_NewForecastState(void) { + FORECASTAPI_ForecastState *returnValue; + /* + * init the forecaster state + */ + returnValue = + (FORECASTAPI_ForecastState *)malloc(sizeof(FORECASTAPI_ForecastState)); + if(returnValue == NULL) + FAIL("NewForecastState: out of memory\n"); + + returnValue->Forecaster_state = InitForcl(MAX_FORC,MAX_DATA_ENTRIES); + if(returnValue->Forecaster_state == NULL) { + free(returnValue); + FAIL("NewForecastState: out of memory\n"); + } + return returnValue; +} + + +void +FORECASTAPI_UpdateForecastState(FORECASTAPI_ForecastState *state, + const FORECASTAPI_Measurement *measurements, + size_t howManyMeasurements, + FORECASTAPI_ForecastCollection *forecasts, + size_t howManyForecasts) { + int i; + + /* sanity check */ + if (state == NULL) { + return; + } + + /* check if we want forecast */ + if (forecasts == NULL) { + howManyForecasts = 0; + } + + for(i = howManyMeasurements - 1; i >= 0; i--) { + UpdateForecasts(state->Forecaster_state, (double)measurements[i].timeStamp, (double)measurements[i].measurement); + if(i < howManyForecasts) { + FORECASTAPI_ComputeForecast(state, &forecasts[i]); + forecasts[i].measurement = measurements[i]; + } + } +} + +int +FORECASTAPI_ComputeForecast( FORECASTAPI_ForecastState *state, + FORECASTAPI_ForecastCollection *forecast) { + + /* sanity check */ + if (state == NULL || forecast == NULL) { + return 1; + } + + forecast->forecasts[FORECASTAPI_MAE_FORECAST].forecast = MAEForecast(state->Forecaster_state); + forecast->forecasts[FORECASTAPI_MAE_FORECAST].error = MAEError(state->Forecaster_state); + forecast->forecasts[FORECASTAPI_MAE_FORECAST].methodUsed = MAEMethod(state->Forecaster_state); + forecast->forecasts[FORECASTAPI_MSE_FORECAST].forecast = MSEForecast(state->Forecaster_state); + forecast->forecasts[FORECASTAPI_MSE_FORECAST].error = MSEError(state->Forecaster_state); + forecast->forecasts[FORECASTAPI_MSE_FORECAST].methodUsed = MSEMethod(state->Forecaster_state); + + return 0; +} + diff --git a/src/nws_portability/Forecast/forecasters.c b/src/nws_portability/Forecast/forecasters.c new file mode 100644 index 0000000000..e98164212b --- /dev/null +++ b/src/nws_portability/Forecast/forecasters.c @@ -0,0 +1,239 @@ +/* $Id$ */ + +/* + * Forecaster Configuration File + * + * FORECASTER(name,init,params,free,update,forecaster) + * name -- a print string to be associated with the forecaster + * init -- initialization function + * params -- string to be passed to init as initial parameters + * free -- free routine to be called to release forecaster spec. state + * update -- update routine for forecaster + * forecaster -- forecaster routine + * + * To add a forecaster to the system, both a FORECASTER specifier and + * an include file need to be specified. forecasters.h contains include + * files for each forecasting package. + * + * Each forecaster consists of a (char *)init() routine, a (void)free() + * routine, a (void)update() routine, and an (int)forecaster() + * routine. + * + * char * Init(fbuff series, + * fbuff time_stamps, + * char *params) + * + * series -- a pointer to the actual data series + * time_stamps -- a pointer to the time stamp series + * params -- string passed as initial parameters + * + * returns a local state record that will be passed to + * all subsequent calls + * + * void Free(char *state) + * + * state -- local state to be deallocated when forecaster] + * is shut down + * + * void Update(char *state, + * double ts, + * doubel value) + * + * state -- local forecaster state + * ts -- time stamp for new value to be added + * value -- value to be added to the forecaster state + * + * int Forecaster(char *state, + * double *forecast) + * + * state -- local forecaster state + * forecast -- out parameter through which forecast is passed + * + * returns a 1 if forecast can be made and a 0 if the + * foreacster fails for some reason + * + * a header file for each package shoould include external definitions + * for each routine + */ + +/* + * last value predictor + */ +FORECASTER("Last Value", + InitLastValue, + NULL, + FreeLastValue, + UpdateLastValue, + ForcLastValue); + +/* + * running tabulation of the mean + */ +FORECASTER("Running Mean", + InitRunMean, + NULL, + FreeRunMean, + UpdateRunMean, + ForcRunMean); + +/* + * exp smooth predictor with 0.05 gain + */ +FORECASTER("5% Exp Smooth", + InitExpSmooth, + "0.05", + FreeExpSmooth, + UpdateExpSmooth, + ForcExpSmooth); + +/* + * exp smooth predictor with 0.10 gain + */ +FORECASTER("10% Exp Smooth", + InitExpSmooth, + "0.10", + FreeExpSmooth, + UpdateExpSmooth, + ForcExpSmooth); + +/* + * exp smooth predictor with 0.15 gain + */ +FORECASTER("15% Exp Smooth", + InitExpSmooth, + "0.15", + FreeExpSmooth, + UpdateExpSmooth, + ForcExpSmooth); + +/* + * exp smooth predictor with 0.20 gain + */ +FORECASTER("20% Exp Smooth", + InitExpSmooth, + "0.20", + FreeExpSmooth, + UpdateExpSmooth, + ForcExpSmooth); + +/* + * exp smooth predictor with 0.30 gain + */ +FORECASTER("30% Exp Smooth", + InitExpSmooth, + "0.30", + FreeExpSmooth, + UpdateExpSmooth, + ForcExpSmooth); + +/* + * exp smooth predictor with 0.40 gain + */ +FORECASTER("40% Exp Smooth", + InitExpSmooth, + "0.40", + FreeExpSmooth, + UpdateExpSmooth, + ForcExpSmooth); + +/* + * exp smooth predictor with 0.50 gain + */ +FORECASTER("50% Exp Smooth", + InitExpSmooth, + "0.50", + FreeExpSmooth, + UpdateExpSmooth, + ForcExpSmooth); + +/* + * exp smooth predictor with 0.75 gain + */ +FORECASTER("75% Exp Smooth", + InitExpSmooth, + "0.75", + FreeExpSmooth, + UpdateExpSmooth, + ForcExpSmooth); + +/* + * median predictor with window = 31 + */ +FORECASTER("Median Window 31", + InitMedian, + "31.0", + FreeMedian, + UpdateMedian, + ForcMedian); + +/* + * median predictor with window = 5 + */ +FORECASTER("Median Window 5", + InitMedian, + "5.0", + FreeMedian, + UpdateMedian, + ForcMedian); + +/* + * sliding window with window = 31 -- Trim Median with alpha = 0.0 + */ +FORECASTER("Sliding Median Window 31", + InitTrimMedian, + "31.0 0.0", + FreeTrimMedian, + UpdateTrimMedian, + ForcTrimMedian); + +/* + * sliding window with window = 5 -- Trim Median with alpha = 0.0 + */ +FORECASTER("Sliding Median Window 5", + InitTrimMedian, + "5.0 0.0", + FreeTrimMedian, + UpdateTrimMedian, + ForcTrimMedian); + +/* + * trimmed median with window = 31, alpha = 0.30 + */ +FORECASTER("30% Trimmed Median Window 31", + InitTrimMedian, + "31.0 0.30", + FreeTrimMedian, + UpdateTrimMedian, + ForcTrimMedian); + +/* + * trimmed median with window = 51, alpha = 0.30 + */ +FORECASTER("30% Trimmed Median Window 51", + InitTrimMedian, + "51.0 0.30", + FreeTrimMedian, + UpdateTrimMedian, + ForcTrimMedian); + +/* + * adaptive median with win=10, min_win=5, max_win=21, and a adjustment + * value of 1 + */ +FORECASTER("Adaptive Median Window 5-21", + InitAdMedian, + "10.0 5.0 21.0 1.0", + FreeAdMedian, + UpdateAdMedian, + ForcAdMedian); + +/* + * adaptive median with win=30, min_win=21, max_win=51, and a adjustment + * value of 5 + */ +FORECASTER("Adaptive Median Window 21-51", + InitAdMedian, + "30.0 21.0 51.0 5.0", + FreeAdMedian, + UpdateAdMedian, + ForcAdMedian); diff --git a/src/nws_portability/Forecast/last_value.c b/src/nws_portability/Forecast/last_value.c new file mode 100644 index 0000000000..590c1143b7 --- /dev/null +++ b/src/nws_portability/Forecast/last_value.c @@ -0,0 +1,83 @@ +/* $Id$ */ + +#include +#include +#include +#include +#include +#include + +#include "fbuff.h" +#include "last_value.h" + +struct last_value_state +{ + fbuff series; /* the series so far */ + fbuff time_stamps; /* the time stamps */ + double value; +}; + +/* + * init local state. can save a copy of the pointer to the + * series and time stamps, if desired + */ +char * +InitLastValue(fbuff series, fbuff time_stamps, char *params) +{ + struct last_value_state *state; + + state = (struct last_value_state *) + malloc(sizeof(struct last_value_state)); + + if(state == NULL) + { + return(NULL); + } + + /* + * all functions take a forcb + */ + state->series = series; + state->time_stamps = time_stamps; + + return((char *)state); +} + +void +FreeLastValue(char *state) +{ + free(state); + return; +} + +void +UpdateLastValue(char *state, + double ts, + double value) +{ + /* + * no op -- will just grab it from series + */ + return; +} + +int +ForcLastValue(char *state, double *v) +{ + double val; + struct last_value_state *s = (struct last_value_state *)state; + + if(!IS_EMPTY(s->series)) + { + val = F_VAL(s->series,F_FIRST(s->series)); + *v = val; + return(1); + } + else + { + *v = 0.0; + return(0); + } +} + + diff --git a/src/nws_portability/Forecast/median.c b/src/nws_portability/Forecast/median.c new file mode 100644 index 0000000000..88c881b0f0 --- /dev/null +++ b/src/nws_portability/Forecast/median.c @@ -0,0 +1,978 @@ +/* $Id$ */ + +#include +#include +#include +#include +#include +#include +#include + + +#include "fbuff.h" +#include "median.h" + + +/* + * to do -- + * + * init M_ts to BIG_TS + * + * handle the case where data is filling the window + * + * find the biggest window + */ + +#define SMALL_TS (-1) +#define BIG_TS (99999999999999999.99) + + + +/* + * state record for median and trimmed median + */ +struct median_state +{ + fbuff series; + fbuff time_stamps; + double M_array[MAX_MED_SIZE]; + double M_ts[MAX_MED_SIZE]; + int artificial_time; + int M_count; + int M_size; + double trim; +}; + +/* + * state record for adjusted median and adjusted mean + */ +struct ad_median_state +{ + fbuff series; + fbuff time_stamps; + double M_array[MAX_MED_SIZE]; + double M_ts[MAX_MED_SIZE]; + int M_count; + int artificial_time; + int last_win; + int win; + int min; + int max; + int offset; +}; + +void +MSort(double *M_value, double *M_ts, double value, double ts, int size) +{ + int i; + int prev; + int curr; + int next; + int l_index = 0; + double temp; + double min_ts = BIG_TS; + + /* + * list is sorted from smallest to biggest -- find the + * oldest time stamp + */ + for(i=0; i < size; i++) + { + if(M_ts[i] < min_ts) + { + l_index = i; + min_ts = M_ts[i]; + } + } + + /* + * overwrite the slot with the new value and + * timestamp + */ + M_value[l_index] = value; + M_ts[l_index] = ts; + + /* + * bump the value into the right place in the list + */ + + prev = l_index - 1; + if(prev < 0) + prev = 0; + curr = l_index; + next = l_index + 1; + if(next > (size - 1)) + next = size - 1; + /* + * while the value is not in the right spot + */ + while(!((M_value[curr] >= M_value[prev]) && + (M_value[curr] <= M_value[next]))) + { + /* + * if it is too big, shift up + */ + if(M_value[curr] < M_value[prev]) + { + temp = M_value[prev]; + M_value[prev] = M_value[curr]; + M_value[curr] = temp; + + temp = M_ts[prev]; + M_ts[prev] = M_ts[curr]; + M_ts[curr] = temp; + + curr = curr - 1; + } + else /* shift down */ + { + temp = M_value[next]; + M_value[next] = M_value[curr]; + M_value[curr] = temp; + + temp = M_ts[next]; + M_ts[next] = M_ts[curr]; + M_ts[curr] = temp; + + curr = curr + 1; + } + + prev = curr - 1; + if(prev < 0) + prev = 0; + + next = curr + 1; + if(next > (size - 1)) + next = size - 1; + } + + /* + * new list should be sorted + */ + + return; +} + + +/* + * these next two routines can do windowed medians for different + * window sizes. We put them in for the Adjusted versions but + * all medians should use them + */ +double +FindMedian(double *sorted_list, + double *sorted_ts, + int list_size, + double now, + int win_size) +{ + int i; + int count; + int temp; + double val; + int last_i; + + last_i = 0; + + if(win_size == 1) + { + return(sorted_list[0]); + } + + /* + * sweep through sorted list counting only those that are + * within a win_size of now. stop when we have win_size/2 + */ + count = 0; + for(i=0; i < list_size; i++) + { + if(sorted_ts[i] > (now - win_size)) + { + count++; + /* + * need to remember this one for the even case + */ + if(count == (win_size / 2)) + { + last_i = i; + } + } + + if(count == ((win_size / 2) + 1)) + break; + } + + /* + * i should now be the index of middle element -- almost + */ + temp = win_size / 2; + /* + * if even + */ + if(win_size == (temp * 2)) + { + val = (sorted_list[last_i] + sorted_list[i]) / 2.0; + } + else + { + val = sorted_list[i]; + } + + return(val); +} + +double +FindTrimMedian(double *sorted_list, + double *sorted_ts, + double now, + int win_size, + double alpha) +{ + int i; + double val; + int T; + double vcount; + + if(win_size == 1) + { + return(sorted_list[0]); + } + + /* + * sweep through sorted list counting only those that are + * within a win_size of now. stop when we have win_size/2 + */ + T = alpha * win_size; + val = 0.0; + vcount = 0.0; + for(i=0; i < win_size ; i++) + { + if((sorted_ts[i] > (now - win_size + T)) && + (sorted_ts[i] < (now - T))) + { + val += sorted_list[i]; + vcount++; + } + } + + if(vcount > 0.0) + { + val = val / vcount; + } + else + { + val = 0.0; + } + + return(val); +} + + +char * +InitMedian(fbuff series, fbuff time_stamps, char *params) +{ + struct median_state *state; + char *p_str; + double M_size; + int i; + + state = (struct median_state *)malloc(sizeof(struct median_state)); + + if(state == NULL) + { + return(NULL); + } + + memset((void *)state,0,sizeof(struct median_state)); + + state->trim = 0; + if(params != NULL) + { + /* + * first parameter is siaze of median window + */ + p_str = params; + M_size = (int)strtod(p_str,&p_str); + state->M_size = M_size; + } + else + { + state->M_size = MAX_MED_SIZE; + } + + /* + * init M_ts to all SMALL_TS so that MSort will build sorted + * list correctly + */ + for(i=0; i < MAX_MED_SIZE; i++) + { + state->M_ts[i] = SMALL_TS; + } + state->artificial_time = 0; + state->series = series; + state->time_stamps = time_stamps; + state->M_count = 0; + + return((char *)state); +} + +void +FreeMedian(char *state) +{ + free(state); + return; +} + +void +UpdateMedian(char *state, + double ts, + double value) +{ + struct median_state *s = (struct median_state *)state; + int curr_size; + + + curr_size = F_COUNT(s->series); + + if(curr_size > s->M_size) + { + s->M_count = curr_size = s->M_size; + } + else + { + s->M_count = curr_size; + } + + /* + * update the sorted list + */ + + /* + * increment the artificial time stamp + */ + s->artificial_time = s->artificial_time + 1; + + /* + * use artificial time stamp instead of real one to + * keep things in terms of entries instead of seconds + */ + MSort(s->M_array,s->M_ts,value,s->artificial_time,curr_size); + + return; +} + + +int +ForcMedian(char *state, double *forecast) +{ + struct median_state *s = (struct median_state *)state; + int l_index; + double val; + + if(s->M_count < 1) + { + return(0); + } + + l_index = s->M_count/2; + + /* + * if even + */ + if(s->M_count == (2 * l_index)) + { + val = (s->M_array[l_index-1] + s->M_array[l_index]) / 2.0; + } + else + { + val = s->M_array[l_index]; + } + + *forecast = val; + return(1); +} + +char *InitTrimMedian(fbuff series, fbuff time_stamps, char *params) +{ + struct median_state *state; + char *p_str; + double M_size; + double alpha; + int i; + + state = (struct median_state *)malloc(sizeof(struct median_state)); + + if(state == NULL) + { + return(NULL); + } + + memset((void *)state,0,sizeof(struct median_state)); + + state->trim = 0; + if(params != NULL) + { + /* + * first parameter is size of median window + */ + p_str = params; + M_size = (int)strtod(p_str,&p_str); + state->M_size = M_size; + + /* + * second parameter is the alpha trim value + */ + alpha = strtod(p_str, &p_str); + state->trim = alpha; + } + else + { + state->M_size = MAX_MED_SIZE; + state->trim = 0.0; + } + + /* + * init M_ts to all SMALL_TS so that MSort will build sorted + * list correctly + */ + for(i=0; i < MAX_MED_SIZE; i++) + { + state->M_ts[i] = SMALL_TS; + } + state->artificial_time = 0; + state->series = series; + state->time_stamps = time_stamps; + state->M_count = 0; + + return((char *)state); +} + +void +FreeTrimMedian(char *state) +{ + FreeMedian(state); + return; +} + +void +UpdateTrimMedian(char *state, double ts, double value) +{ + UpdateMedian(state,ts,value); + return; +} + + + +/* + * page 264 in DSP book + */ +int +ForcTrimMedian(char *state, double *forecast) +{ + struct median_state *s = (struct median_state *)state; + double val; + int l_index; + int T; + + if(s->M_count < 1) + { + return(0); + } + + + T = (int)(s->trim * s->M_count); + + val = 0.0; + for(l_index = T; l_index < (s->M_count - T); l_index++) + { + val += s->M_array[l_index]; + } + + val = val / (double)(s->M_count - 2*T); + + + *forecast = val; + + return(1); +} + + + +char *InitAdMedian(fbuff series, fbuff time_stamps, char *params) +{ + struct ad_median_state *state; + char *p_str; + double win; + double min_win; + double max_win; + double offset; + int i; + + state = (struct ad_median_state *) + malloc(sizeof(struct ad_median_state)); + + if(state == NULL) + { + return(NULL); + } + + memset((void *)state,0,sizeof(struct median_state)); + + + if(params != NULL) + { + /* + * first parameter is initial target size of median window + */ + p_str = params; + win = (int)strtod(p_str,&p_str); + state->win = win; + + /* + * defaults + */ + min_win = win; + max_win = win; + offset = 1; + + /* + * second parameter is the min window value + */ + min_win = strtod(p_str, &p_str); + + /* + * third parameter is the max window value + */ + max_win = strtod(p_str, &p_str); + + /* + * fourth parameter is the offset value to use + * when calculating alternative window sizes + */ + offset = strtod(p_str, &p_str); + state->offset = (int)offset; + + /* + * sanity checking + */ + if(win == 1) + state->offset = 0; + + if((win - state->offset) < 0) + state->offset = 1; + + if(min_win > (win - state->offset)) + min_win = win - state->offset; + + if(max_win < (win + state->offset)) + max_win = win + state->offset; + + state->min = (int)min_win; + state->max = (int)max_win; + } + else + { + state->min = state->max = state->win = MAX_MED_SIZE; + state->offset = 1; + } + + /* + * init M_ts to all SMALL_TS so that MSort will build sorted + * list correctly + */ + for(i=0; i < MAX_MED_SIZE; i++) + { + state->M_ts[i] = SMALL_TS; + } + state->artificial_time = 0; + state->series = series; + state->time_stamps = time_stamps; + state->M_count = 0; + state->artificial_time = 1; + + return((char *)state); +} + +void +FreeAdMedian(char *state) +{ + free(state); + return; +} + +void +UpdateAdMedian(char *state, double ts, double value) +{ + struct ad_median_state *s = (struct ad_median_state *)state; + int curr_size; + int win; + double less_val; + double eq_val; + double more_val; + double less_err; + double eq_err; + double more_err; + int lo_offset; + int hi_offset; + + + curr_size = F_COUNT(s->series); + + /* + * M_size is the current window size, and M_count is the + * current amount of data in the median buffer + */ + + if(curr_size > s->max) + { + s->M_count = curr_size = s->max; + } + else + { + s->M_count = curr_size; + } + + /* + * update the sorted list + */ + + /* + * increment the artificial time stamp + */ + s->artificial_time = s->artificial_time + 1; + + /* + * use artificial time stamp instead of real one to + * keep things in terms of entries instead of seconds + */ + MSort(s->M_array,s->M_ts,value,s->artificial_time,curr_size); + + + /* + * calculate the window based on how much data there is + */ + if(curr_size > s->win) + { + win = s->win; + } + else + { + win = curr_size; + } + /* + * find the median using the current + * window size + */ + eq_val = FindMedian(s->M_array, + s->M_ts, + s->M_count, + s->artificial_time, + win); + + /* + * we want to wait until there is enough data before we start + * to adapt. We don't start to adjust s->win until there is + * enough data to get out to the max window size + */ + if(curr_size < s->max) + { + return; + } + + if((win - s->offset) < 0) + { + lo_offset = win - 1; + } + else + { + lo_offset = s->offset; + } + + if((win + s->offset) > s->M_count) + { + hi_offset = s->M_count - win - 1; + } + else + { + hi_offset = s->offset; + } + + /* + * find the median for a smaller window -- offset + * controls how much smaller or bigger the window should be + * that we consider + */ + less_val = FindMedian(s->M_array, + s->M_ts, + s->M_count, + s->artificial_time, + lo_offset); + + /* + * find the median for a bigger window -- offset + * controls how much smaller or bigger the window should be + * that we consider + */ + more_val = FindMedian(s->M_array, + s->M_ts, + s->M_count, + s->artificial_time, + hi_offset); + + /* + * now, calculate the errors + */ + less_err = (value - less_val) * (value - less_val); + more_err = (value - more_val) * (value - more_val); + eq_err = (value - eq_val) * (value - eq_val); + + /* + * adapt the window according to the direction giving us the + * smallest error + */ + if(less_err < eq_err) + { + if(less_err < more_err) + { + win = win - 1; + } + else if(more_err < eq_err) + { + win = win + 1; + } + } + else if(more_err < eq_err) + { + if(more_err < less_err) + { + win = win + 1; + } + else if(less_err < eq_err) + { + win = win - 1; + } + } + + s->win = win; + + return; +} + + +int +ForcAdMedian(char *state, double *forecast) +{ + struct ad_median_state *s = (struct ad_median_state *)state; + double forc; + + if(s->M_count == 0) + { + return(0); + } + + if(s->M_count < s->max) + { + forc = FindMedian(s->M_array, + s->M_ts, + s->M_count, + s->artificial_time, + s->M_count); + } + else + { + forc = FindMedian(s->M_array, + s->M_ts, + s->M_count, + s->artificial_time, + s->win); + + } + + *forecast = forc; + + return(1); +} + + + + + + + + + +#ifdef NOTYET + +AdjustedMedian(tp,pred,min,max) +struct thruput_pred *tp; +int pred; +int min; +int max; +{ + double err1; + double err2; + double err3; + double val1; + double val2; + double val3; + int win; + struct value_el *data = tp->data; + int prev = MODMINUS(tp->head,1,HISTORYSIZE); + int head = tp->head; + double value = tp->data[head].value; + double predictor = PRED(pred,data[prev]); + int out_win; + double out_val; + + win = MedWIN(pred,data[prev]); + if(MODMINUS(head,tp->tail,HISTORYSIZE) < 3) + { + PRED(pred,data[head]) = value; + MedWIN(pred,data[head]) = win; + return(0.0); + } + if(win < 2) + win = 2; + val1 = Median(tp,win-1); + val2 = Median(tp,win+1); + val3 = Median(tp,win); + + err1 = (value - val1) * (value - val1); + err2 = (value - val2) * (value - val2); + err3 = (value - val3) * (value - val3); + + if(err1 < err2) + { + if(err1 < err3) + { + out_win = win - 1; + out_val = val1; + } + else + { + out_win = win; + out_val = val3; + } + } + else if(err2 < err1) + { + if(err2 < err3) + { + out_win = win + 1; + out_val = val2; + } + else + { + out_win = win; + out_val = val3; + } + } + else + { + out_win = win; + out_val = val3; + } + + if(out_win < min) + { + out_win = min; + out_val = Median(tp,min); + } + + if(out_win > max) + { + out_win = max; + out_val = Median(tp,max); + } + + MedWIN(pred,data[head]) = out_win; + PRED(pred,data[head]) = out_val; +} + +AdjustedMean(tp,pred,min,max) +struct thruput_pred *tp; +int pred; +int min; +int max; +{ + double err1; + double err2; + double err3; + double val1; + double val2; + double val3; + int win; + struct value_el *data = tp->data; + int prev = MODMINUS(tp->head,1,HISTORYSIZE); + int head = tp->head; + double value = tp->data[head].value; + double predictor = PRED(pred,data[prev]); + int out_win; + double out_val; + + win = MeanWIN(pred,data[prev]); + if(MODMINUS(head,tp->tail,HISTORYSIZE) < 3) + { + PRED(pred,data[head]) = value; + MeanWIN(pred,data[head]) = WIN_INIT; + return(0.0); + } + if(win < 2) + win = 2; + val1 = TrimmedMedian(tp,win-1,0.0); + val2 = TrimmedMedian(tp,win+1,0.0); + val3 = TrimmedMedian(tp,win,0.0); + + err1 = (value - val1) * (value - val1); + err2 = (value - val2) * (value - val2); + err3 = (value - val3) * (value - val3); + + if(err1 < err2) + { + if(err1 < err3) + { + out_win = win - 1; + out_val = val1; + } + else + { + out_win = win; + out_val = val3; + } + } + else if(err2 < err1) + { + if(err2 < err3) + { + out_win = win + 1; + out_val = val2; + } + else + { + out_win = win; + out_val = val3; + } + } + else + { + out_win = win; + out_val = val3; + } + + if(out_win < min) + { + out_win = min; + out_val = TrimmedMedian(tp,min,0.0); + } + + if(out_win > max) + { + out_win = max; + out_val = TrimmedMedian(tp,max,0.0); + } + + MeanWIN(pred,data[head]) = out_win; + PRED(pred,data[head]) = out_val; +} + +#endif diff --git a/src/nws_portability/Forecast/mse_forc.c b/src/nws_portability/Forecast/mse_forc.c new file mode 100644 index 0000000000..efefead202 --- /dev/null +++ b/src/nws_portability/Forecast/mse_forc.c @@ -0,0 +1,658 @@ +#include + +#include +#include +#include +#include +#include + + + +#include "forc.h" + +struct mse_state +{ + forcl forc_list; + int win; + int method; + int last_index; /* optimization */ + double last_forecast; /* optimization */ +}; + + +/* + * forward refs for derived forecaster types + */ +int TotalMSEForecast(char *state, double *forecast); +int LocalMAEForecast(char *state, double *forecast); + +int DerivedMethod(char *state); + +/* + * the MSE forecast chooses the best forecast from the derived + * forecasters, one of which is the total MSE forecast + */ +double +MSEForecast(char *i_forcl) +{ + int i; + int min_i; + double min_se; + double sq_err; + double forecast; + forcl l_forcl; + int ferr; + fbuff series; + + l_forcl = (forcl)i_forcl; + + /* + * first, check to see if there is any data -- the forecaster + * routines may be called with an empty series + */ + if(F_COUNT(l_forcl->forcs[0]->series) == 0) + { + forecast = FORE_ERROR_VAL; + return(forecast); + } + + + + min_se = DBIG_VAL; + min_i = 0; + + /* + * find the forecaster that has the lowest current + * mean square error + */ + for(i=0; i < l_forcl->derived_count; i++) + { + series = l_forcl->derived_forcs[i]->se_series; + if(F_COUNT(series) > 0) + { + sq_err = + F_VAL(series,F_FIRST(series)) / F_COUNT(series); + } + else + { + sq_err = DBIG_VAL; + } + + if(sq_err < min_se) + { + min_i = i; + min_se = sq_err; + } + } + + /* + * report the best + */ + ferr = +(l_forcl->derived_forcs[min_i])->forecast((l_forcl->derived_forcs[min_i])->state, + &forecast); + + /* + * if an error has occurred, print and error and report + * FORE_ERROR_VAL + */ + if(ferr == 0) + { + /* + * since we know there is at least one data item, + * return the last on error + */ + forecast = F_VAL(l_forcl->forcs[0]->series, + F_FIRST(l_forcl->forcs[0]->series)); + return(forecast); + } + + /* + * update the method that was used + */ + l_forcl->total_mse_method = + DerivedMethod(l_forcl->derived_forcs[min_i]->state); + + return(forecast); +} + +double +MSEError(char *state) +{ + forcl s; + double val; + + s = (forcl)state; + + if(s->total_mse->count > 0.0) + { + val = s->total_mse->se / s->total_mse->count; + } + else + { + val = 0.0; + } + + return(val); +} + +int +MSEMethod(char *state) +{ + forcl s; + + s = (forcl)state; + + return(s->total_mse_method); +} + +/* + * for forecaster interface + */ +int +TotalMSEForecast(char *state, double *forecast) +{ + *forecast = MSEForecast(state); + + if(*forecast == FORE_ERROR_VAL) + { + return(0); + } + else + { + return(1); + } +} + +double +MAEForecast(char *i_forcl) +{ + int i; + int min_i; + double min_ae; + double err; + double forecast; + forcl l_forcl; + int ferr; + fbuff series; + + l_forcl = (forcl)i_forcl; + + min_ae = DBIG_VAL; + min_i = 0; + + /* + * find the forecaster that has the lowest current + * mean absolute error + */ + for(i=0; i < l_forcl->derived_count; i++) + { + series = l_forcl->derived_forcs[i]->ae_series; + if(F_COUNT(series) > 0) + { + err = + F_VAL(series,F_FIRST(series)) / F_COUNT(series); + } + else + { + err = DBIG_VAL; + } + + if(err < min_ae) + { + min_i = i; + min_ae = err; + } + } + + /* + * report the best + */ + ferr = +(l_forcl->derived_forcs[min_i])->forecast((l_forcl->derived_forcs[min_i])->state, + &forecast); + + /* + * if an error has occurred, print and error and report + * FORE_ERROR_VAL + */ + if(ferr == 0) + { + forecast = F_VAL(l_forcl->forcs[0]->series, + F_FIRST(l_forcl->forcs[0]->series)); + } + + /* + * update the method that was used + */ + l_forcl->total_mae_method = + DerivedMethod(l_forcl->derived_forcs[min_i]->state); + return(forecast); +} + +double +MAEError(char *state) +{ + forcl s; + double val; + + s = (forcl)state; + + if(s->total_mae->count > 0.0) + { + val = s->total_mae->ae / s->total_mae->count; + } + else + { + val = 0.0; + } + + return(val); +} + +int +MAEMethod(char *state) +{ + forcl s; + + s = (forcl)state; + + return(s->total_mae_method); +} + +int +TotalMAEForecast(char *state, double *forecast) +{ + *forecast = MAEForecast(state); + + if(*forecast == FORE_ERROR_VAL) + { + return(0); + } + else + { + return(1); + } +} + +char * +InitWinMSE(fbuff series, fbuff time_stamps, char *params) +{ + struct mse_state *state; + int pcount; + forcl l_forcl; + int win; + + state = (struct mse_state *)malloc(sizeof(struct mse_state)); + + if(state == NULL) + { + return(NULL); + } + + /* + * first parameter is the address of the forcl and the + * second is the window size + */ + pcount = sscanf(params,"%p %d", + &l_forcl, + &win); + + if(pcount != 2) + { + free(state); + return(NULL); + } + + state->forc_list = l_forcl; + state->win = win; + + return((char *)state); +} + +void +FreeWinMSE(char *state) +{ + free(state); +} + +char * +InitWinMAE(fbuff series, fbuff time_stamps, char *params) +{ + return(InitWinMSE(series,time_stamps,params)); +} + +void +FreeWinMAE(char *state) +{ + FreeWinMSE(state); +} + +int +LocalWinMSEForecast(char *state, double *out_f) +{ + struct mse_state *s; + int i; + int win; + int min_i; + double min_se; + double sq_err; + double forecast; + forcl l_forcl; + int ferr; + double temp_err; + int windex; + fbuff series; + + s = (struct mse_state *)state; + + l_forcl = s->forc_list; + win = s->win; + + + min_se = DBIG_VAL; + min_i = 0; + + + /* + * find the forecaster that has the lowest current + * mean square error -- + * + * if the win size > 0, look only over the window + * using the cumulative series. Otherwise, use the total + * cumulative value + */ + for(i=0; i < l_forcl->count; i++) + { + if((l_forcl->forcs[i])->count > 0.0) + { + series = + (l_forcl->forcs[i])->se_series; + + /* + * make sure we only window as much + * as there is + */ + if(win > (F_COUNT(series) - 1)) + win = F_COUNT(series) - 1; + + if(win == 0) + { + /* + * get the first value which is + * the current cumulative total + */ + temp_err = + F_VAL(series, F_FIRST(series)); + sq_err = temp_err / + (l_forcl->forcs[i])->count; + } + else + { + /* + * get the index of the end of the + * window + */ + windex = MODPLUS(F_FIRST(series), + win, + F_SIZE(series)); + /* + * the difference is the cumulative + * total over the window size + */ + temp_err = F_VAL(series, F_FIRST(series)) - + F_VAL(series,windex); + sq_err = temp_err / win; + } + } + else + { + sq_err = DBIG_VAL; + } + + if(sq_err < min_se) + { + min_i = i; + min_se = sq_err; + } + } + + /* + * report the best + */ + ferr = +(l_forcl->forcs[min_i])->forecast((l_forcl->forcs[min_i])->state,&forecast); + + /* + * if an error has occurred, print and error and report + * FORE_ERROR_VAL + */ + if(ferr == 0) + { + forecast = F_VAL(l_forcl->forcs[0]->series, + F_FIRST(l_forcl->forcs[0]->series)); + + return(0); + } + + /* + * update the method that was used + */ + s->method = min_i; + *out_f = forecast; + + return(1); +} + +int +LocalWinMAEForecast(char *state, double *out_f) +{ + struct mse_state *s; + int i; + int win; + int min_i; + double min_ae; + double err; + double forecast; + forcl l_forcl; + int ferr; + double temp_err; + int windex; + fbuff series; + + s = (struct mse_state *)state; + + l_forcl = s->forc_list; + win = s->win; + + + min_ae = DBIG_VAL; + min_i = 0; + + /* + * find the forecaster that has the lowest current + * mean square error -- + * + * if the win size > 0, look only over the window + * using the cumulative series. Otherwise, use the total + * cumulative value + */ + for(i=0; i < l_forcl->count; i++) + { + if((l_forcl->forcs[i])->count > 0.0) + { + series = + (l_forcl->forcs[i])->ae_series; + + /* + * make sure we only window as much + * as there is + */ + if(win > (F_COUNT(series) - 1)) + win = F_COUNT(series) - 1; + + if(win == 0) + { + /* + * get the first value which is + * the current cumulative total + */ + temp_err = + F_VAL(series, F_FIRST(series)); + err = temp_err / + (l_forcl->forcs[i])->count; + } + else + { + /* + * get the index of the end of the + * window + */ + windex = MODPLUS(F_FIRST(series), + win, + F_SIZE(series)); + /* + * the difference is the cumulative + * total over the window size + */ + temp_err = + F_VAL(series, F_FIRST(series)) - + F_VAL(series,windex); + err = temp_err / win; + } + } + else + { + err = DBIG_VAL; + } + + if(err < min_ae) + { + min_i = i; + min_ae = err; + } + } + + /* + * report the best + */ + ferr = +(l_forcl->forcs[min_i])->forecast((l_forcl->forcs[min_i])->state,&forecast); + + /* + * if an error has occurred, print and error and report + * FORE_ERROR_VAL + */ + if(ferr == 0) + { + forecast = F_VAL(l_forcl->forcs[0]->series, + F_FIRST(l_forcl->forcs[0]->series)); + + *out_f = forecast; + return(0); + } + + /* + * update the method that was used + */ + s->method = min_i; + *out_f = forecast; + + return(1); +} + +int +DerivedMethod(char *state) +{ + struct mse_state *s; + + s = (struct mse_state *)state; + + return(s->method); +} + +/* + * lifetime versions + */ +double +MSELifetimeForecast(char *state) +{ + forclife flife; + forcl l_forcl; + + flife = (forclife)state; + l_forcl = (forcl)flife->forc_list; + if(F_COUNT(l_forcl->forcs[0]->series) == 0) + { + if(flife->count == 0.0) + return(0.0); + return(flife->total / flife->count); + } + return(MSEForecast((char *)flife->forc_list)); +} + +double +MSELifetimeError(char *state) +{ + forclife flife; + flife = (forclife)state; + return(MSEError((char *)flife->forc_list)); +} + +int +MSELifetimeMethod(char *state) +{ + forclife flife; + flife = (forclife)state; + return(MSEMethod((char *)flife->forc_list)); +} + +double +MSELifetimeEpoch(char *state) +{ + forclife flife; + flife = (forclife)state; + return(flife->epoch_end); +} + +double +MAELifetimeForecast(char *state) +{ + forclife flife; + forcl l_forcl; + + flife = (forclife)state; + l_forcl = (forcl)flife->forc_list; + + if(F_COUNT(l_forcl->forcs[0]->series) == 0) + { + if(flife->count == 0.0) + return(0.0); + return(flife->total / flife->count); + } + return(MAEForecast((char *)flife->forc_list)); +} + +double +MAELifetimeError(char *state) +{ + forclife flife; + flife = (forclife)state; + return(MAEError((char *)flife->forc_list)); +} + +int +MAELifetimeMethod(char *state) +{ + forclife flife; + flife = (forclife)state; + return(MAEMethod((char *)flife->forc_list)); +} + +double +MAELifetimeEpoch(char *state) +{ + forclife flife; + flife = (forclife)state; + return(flife->epoch_end); +} diff --git a/src/nws_portability/Forecast/predictor.c b/src/nws_portability/Forecast/predictor.c new file mode 100644 index 0000000000..1299c08ed8 --- /dev/null +++ b/src/nws_portability/Forecast/predictor.c @@ -0,0 +1,607 @@ +/* $Id$ */ + +#include "config_portability.h" +#include /* fprintf() fflush() */ +#include "strutil.h" /* SAFESTRCPY() */ +#include "predictor.h" + +/* These should be in a header file, median.h */ +extern double Median(); +extern double TrimmedMedian(); +extern void AdjustedMean(); +extern void AdjustedMedian(); +extern char *DefineHistogram(); +extern char *DefineHistogramPred(); +extern void PrintHistogram(); +extern void ModalDev(); + +/* not yet +char *Histogram; +char *MeanPred; +char *MedianPred; +char *MiddlePred; +int Histodim; +int Histostates; +double Histomax; +double Histomin; +*/ + +double Onedev_mse; +double Onedev_mpe; +double Onedev_modal; +double Twodev_mse; +double Twodev_mpe; +double Twodev_modal; +double Devcounts; + +double Lifetime_mse[LIFETIMES]; +double Lifetime_mpe[LIFETIMES]; +int Lifetime_count = 0; +extern int Median_sorted; + +const char *Names[PREDS]; +#define NAME(i) (Names[i]) + +void +PrintPredData(tp,where) +struct thruput_pred *tp; +int where; +{ + struct value_el *data = tp->data; + int prev = MODMINUS(where,1,HISTORYSIZE); + int i; + + fprintf(stdout,"%d %3.4f ",(int)data[where].time, data[where].value); + + for(i=0; i < PREDS; i++) + { + fprintf(stdout,"| %3.4f %3.4f %3.4f ",PRED(i,data[prev]), + TPMSE(tp,i)/TPCOUNT(tp,i), + TPMAE(tp,i)/TPCOUNT(tp,i)); + } + fprintf(stdout,"| %d %d | ",MedWIN(6,data[prev]),MeanWIN(7,data[prev])); + for(i=STATIC_PREDS; i < SECOND_ORDER_PREDS; i++) + { + fprintf(stdout,"%d ",TPPREDNUM(tp,i)); + } + fprintf(stdout,"| "); + for(i=SECOND_ORDER_PREDS; i < PREDS; i++) + { + fprintf(stdout,"%d ",TPPREDNUM(tp,i)); + } + fprintf(stdout,"\n"); + fflush(stdout); + + return; +} + + +void +ThruputPrediction(tp) +struct thruput_pred *tp; +{ + int tail = tp->tail; + int head = tp->head; + int i; + int prev; + double error; + double sq_error; + struct value_el *data = tp->data; + double value; + double run_mean = tp->run_mean; + double total = tp->total; + double tot_sum; + double min_run_p_error = MAXDOUBLE; + int min_run_p_i = 0; + double min_run_sq_error = MAXDOUBLE; + int min_run_sq_i = 0; + double prev_pred; + double absolute_error; + int last_error; + double min_win_sq_error = MAXDOUBLE; + double min_win_p_error = MAXDOUBLE; + int min_win_sq_i = 0; + int min_win_p_i = 0; + double min_tot_sq_error = MAXDOUBLE; + double min_tot_p_error = MAXDOUBLE; + int min_tot_sq_i = 0; + int min_tot_p_i = 0; + double win_error; + int error_window; + int datasize; + + datasize = MODMINUS(head,tail,HISTORYSIZE) - 1; + if(ERR_WIN > datasize) + error_window = datasize; + else + error_window = ERR_WIN; + + last_error = MODMINUS(head,error_window,HISTORYSIZE); + + + + value = data[head].value; + prev = MODMINUS(head,1,HISTORYSIZE); +#ifdef GROT + /* + * was the value within one deviation of the total prediction? + */ + avg_err = TPMAE(tp,TOT_MSE_PRED)/TPCOUNT(tp,TOT_MSE_PRED); + if((value > (PRED(TOT_MSE_PRED,data[prev])-avg_err)) && + (value < (PRED(TOT_MSE_PRED,data[prev])+avg_err))) + { + Onedev_mse++; + } + if((value > (PRED(TOT_MSE_PRED,data[prev])-2*avg_err)) && + (value < (PRED(TOT_MSE_PRED,data[prev])+2*avg_err))) + { + Twodev_mse++; + } + + avg_err = TPMAE(tp,TOT_MAE_PRED)/TPCOUNT(tp,TOT_MAE_PRED); + if((value > (PRED(TOT_MAE_PRED,data[prev])-avg_err)) && + (value < (PRED(TOT_MAE_PRED,data[prev])+avg_err))) + { + Onedev_mpe++; + } + if((value > (PRED(TOT_MAE_PRED,data[prev])-2*avg_err)) && + (value < (PRED(TOT_MAE_PRED,data[prev])+2*avg_err))) + { + Twodev_mpe++; + } + + ModalDev(Histogram,MedianPred,1.0,&hi,&lo); + if((value > lo) && (value < hi)) + Onedev_modal++; + ModalDev(Histogram,MedianPred,2.0,&hi,&lo); + if((value > lo) && (value < hi)) + Twodev_modal++; + + Devcounts++; +#endif + + /* + * calculate the error our last prediction made + * now that we have the actual value + */ + for(i=0; i < PREDS; i++) + { + + error = data[head].value - PRED(i,data[prev]); + if(TPCOUNT(tp,i) < MIN_DATA_HISTORY) + error = 0.0; + sq_error = error * error; + + SQERR(i,data[head]) = SQERR(i,data[prev])+sq_error; + TPMSE(tp,i) += sq_error; + if(error < 0.0) + error = -1.0 * error; + absolute_error = error; + ERR(i,data[head]) = ERR(i,data[prev])+absolute_error; + TPMAE(tp,i) += absolute_error; + TPCOUNT(tp,i) += 1.0; + + } + +#ifdef GROT + /* + * now calculate MSE values over different lifetimes + */ + if(datasize > LIFETIMES) + { + curr = prev; + for(i=0; i < LIFETIMES; i++) + { + error = data[head].value - + PRED(TOT_MSE_PRED,data[curr]); + Lifetime_mse[i] += (error * error); + error = data[head].value - + PRED(TOT_MAE_PRED,data[curr]); + if(error < 0.0) + error = -1.0 * error; + Lifetime_mpe[i] += (error / data[head].value); + curr = MODMINUS(curr,1,HISTORYSIZE); + } + Lifetime_count++; + } +#endif + + + + + + /* + * use the current running mean + */ + NAME(0) = "Last value"; + PRED(0,data[head]) = value; + + + /* + * use the current value as a prediction of the next value + */ + tot_sum = run_mean * total; + tot_sum += data[head].value; + total++; + run_mean = tot_sum/total; + tp->run_mean = run_mean; + tp->total = total; + NAME(1) = "Running Mean"; + PRED(1,data[head]) = run_mean; + + /* + * use the Van Jacobson method + */ + prev_pred = PRED(2,data[prev]); + NAME(2) = "Van Jacobson"; + PRED(2,data[head]) = prev_pred + GAIN*(value - prev_pred); + + /* + * tell the median routines that the array is no longer valid + */ + Median_sorted = 0; + NAME(3) = "Median"; + PRED(3,data[head]) = Median(tp,MED_N); + NAME(4) = "Trimmed Median"; + PRED(4,data[head]) = TrimmedMedian(tp,MED_N,MED_ALPHA); + + /* + * Now use TrimmedMean to give a sliding window mean + */ + NAME(5) = "Sliding Window Mean"; + PRED(5,data[head]) = TrimmedMedian(tp,MED_N,0.0); + NAME(6) = "Adjusted Median"; + AdjustedMedian(tp,6,WIN_MIN,WIN_MAX); + NAME(7) = "Adjusted Mean"; + AdjustedMean(tp,7,WIN_MIN,WIN_MAX); + + for(i=0; i < STATIC_PREDS; i++) + { + if((TPMSE(tp,i)/TPCOUNT(tp,i)) < min_run_sq_error) + { + min_run_sq_error = TPMSE(tp,i)/TPCOUNT(tp,i); + min_run_sq_i = i; + } + + if((TPMAE(tp,i)/TPCOUNT(tp,i)) < min_run_p_error) + { + min_run_p_error = TPMAE(tp,i)/TPCOUNT(tp,i); + min_run_p_i = i; + } + + win_error = + (SQERR(i,data[head]) - SQERR(i,data[last_error])) / + (double)error_window; + if(win_error < min_win_sq_error) + { + min_win_sq_error = win_error; + min_win_sq_i = i; + } + + win_error = + (ERR(i,data[head]) - ERR(i,data[last_error])) / + (double)error_window; + if(win_error < min_win_p_error) + { + min_win_p_error = win_error; + min_win_p_i = i; + } + + } + + + NAME(MSE_PRED) = "Min MSE Pred"; + PRED(MSE_PRED,data[head]) = PRED(min_run_sq_i,data[head]); + TPPREDNUM(tp,MSE_PRED) = min_run_sq_i; + NAME(MAE_PRED) = "Min MAE Pred"; + PRED(MAE_PRED,data[head]) = PRED(min_run_p_i,data[head]); + TPPREDNUM(tp,MAE_PRED) = min_run_p_i; + NAME(WIN_MSE_PRED) = "Win MSE Pred"; + PRED(WIN_MSE_PRED,data[head]) = PRED(min_win_sq_i,data[head]); + TPPREDNUM(tp,WIN_MSE_PRED) = min_win_sq_i; + NAME(WIN_MAE_PRED) = "Win MAE Pred"; + PRED(WIN_MAE_PRED,data[head]) = PRED(min_win_p_i,data[head]); + TPPREDNUM(tp,WIN_MAE_PRED) = min_win_p_i; + + for(i=STATIC_PREDS; i < SECOND_ORDER_PREDS; i++) + { + if((TPMSE(tp,i)/TPCOUNT(tp,i)) < min_tot_sq_error) + { + min_tot_sq_error = TPMSE(tp,i)/TPCOUNT(tp,i); + min_tot_sq_i = TPPREDNUM(tp,i); + } + if((TPMAE(tp,i)/TPCOUNT(tp,i)) < min_tot_p_error) + { + min_tot_p_error = TPMAE(tp,i)/TPCOUNT(tp,i); + min_tot_p_i = TPPREDNUM(tp,i); + } + } + NAME(TOT_MSE_PRED) = "Total MSE Pred"; + PRED(TOT_MSE_PRED,data[head]) = PRED(min_tot_sq_i,data[head]); + TPPREDNUM(tp,TOT_MSE_PRED) = min_tot_sq_i; + NAME(TOT_MAE_PRED) = "Total MAE Pred"; + PRED(TOT_MAE_PRED,data[head]) = PRED(min_tot_p_i,data[head]); + TPPREDNUM(tp,TOT_MAE_PRED) = min_tot_p_i; + +#ifdef PRINTPRED + ModalDev(Histogram,MedianPred,2.0,&hi,&lo); + fprintf(stdout,"%d %10.5f\n",data[head].time, + PRED(TOT_MAE_PRED,data[prev])); + + fflush(stdout); +#endif + + return; + +} + +void +InitThruputPrediction(struct thruput_pred *tp) +{ + int i; + + tp->head = 0; + tp->tail = 0; + +/* ** NOT yet as we don't quite know what min and max values to use + + Histogram = DefineHistogram(MODES, + DIM, + Histomin, + Histomax); + MeanPred = DefineHistogramPred(Histogram); + MedianPred = DefineHistogramPred(Histogram); + MiddlePred = DefineHistogramPred(Histogram); +*/ + + + tp->mean = 0.0; + tp->run_mean = 0.0; + tp->total = 0.0; + memset(tp->data,0,sizeof(tp->data)); + + for(i=0; i < PREDS; i++) + { + TPMSE(tp,i) = 0.0; + TPCOUNT(tp,i) = 0.0; + } + + return; +} + +/* not sure if exptime is right, I just wanted to avoid namespace collisions */ +void +UpdateThruputPrediction(struct thruput_pred *tp,float value, time_t exptime) +{ + + int head = tp->head; + int tail = tp->tail; + struct value_el *data = tp->data; + int i; + int data_size = MODMINUS(head,tail,HISTORYSIZE); + + tp->data[tp->head].time = exptime; + tp->data[tp->head].value = value; + + /* + * a negative tail value says that we haven't filled the + * pipe yet. See if this does it. + */ + if(data_size > MIN_DATA_HISTORY) + { + ThruputPrediction(tp); + + } + else + { + for(i=0; i < PREDS; i++) + { + PRED(i,data[head]) = tp->data[head].value; + TPMSE(tp,i) = 0.0; + TPMAE(tp,i) = 0.0; + ERR(i,data[head]) = 0.0; + SQERR(i,data[head]) = 0.0; + MedWIN(i,data[head]) = WIN_INIT; + MeanWIN(i,data[head]) = WIN_INIT; + } + TPPREDNUM(tp,TOT_MSE_PRED) = 0; + TPPREDNUM(tp,TOT_MAE_PRED) = 0; + } + + + + tp->head = MODPLUS(head,1,HISTORYSIZE); + + /* + * if we have incremented head forward to that it is sitting on + * top of tail, then we need to bump tail. The entire buffer is + * being used to fill the window. + */ + if(tp->head == tp->tail) + tp->tail = MODPLUS(tp->tail,1,HISTORYSIZE); + + return; +} + +#ifdef STANDALONE + +#define PRED_ARGS "f:d:s:l:h:" + +#include "format.h" + +CalculateThruputPredictors(fname,tp) +char *fname; +struct thruput_pred *tp; +{ + FILE *fd; + char line_buf[255]; + char *cp; + time_t ltime; + float value; + int i; + + + fd = fopen(fname,"r"); + + if(fd == NULL) + { + fprintf(stderr, + "CalculateThruputPredictors: unable to open file %s\n", + fname); + fflush(stderr); + exit(1); + } + + while(fgets(line_buf,255,fd)) + { + cp = line_buf; + + while(isspace(*cp)) + cp++; + + for(i=1; i < TSFIELD; i++) + { + while(!isspace(*cp)) + cp++; + + while(isspace(*cp)) + cp++; + } + + ltime = atoi(cp); + + cp = line_buf; + + for(i=1; i < VALFIELD; i++) + { + while(!isspace(*cp)) + cp++; + + while(isspace(*cp)) + cp++; + } + + value = atof(cp); + + if(value != 0.0) + UpdateThruputPrediction(tp,value,ltime); + + } + + fclose(fd); +} + + +struct thruput_pred Tp; + +main(argc,argv) +int argc; +char *argv[]; +{ + + FILE *fd; + int i; + int j; + double temp_mse; + double temp_mpe; + char fname[255]; + char c; + + + if(argc < 2) + { + fprintf(stderr,"usage: testpred filename\n"); + fflush(stderr); + exit(1); + } + + fname[0] = 0; + Histodim = DIM; + Histostates = STATES; + Histomax = HMAX; + Histomin = HMIN; + + while((c = getopt(argc,argv,PRED_ARGS)) != EOF) + { + switch(c) + { + case 'f': + SAFESTRCPY(fname,optarg); + break; + case 'd': + Histodim = atoi(optarg); + break; + case 's': + Histostates = atoi(optarg); + break; + case 'l': + Histomin = atof(optarg); + break; + case 'h': + Histomax = atof(optarg); + break; + } + } + + if(fname[0] == 0) + { + fprintf(stderr,"usage: predictor -f fname [-d,s,l,h]\n"); + fflush(stderr); + exit(1); + } + + InitThruputPrediction(&Tp); + +#if !defined(PRINTPRED) + fprintf(stdout,"Calculating throughput predictors..."); + fflush(stdout); +#endif + + CalculateThruputPredictors(fname,&Tp); + + fprintf(stdout,"done.\n"); + fflush(stdout); + + for(i=0; i < PREDS; i++) + { + + fprintf(stdout,"Predictor %d, MSE: %3.4f MAE: %3.4f, %s\n", + i,TPMSE(&Tp,i)/TPCOUNT(&Tp,i), + TPMAE(&Tp,i)/TPCOUNT(&Tp,i), + NAME(i)); + } + + fprintf(stdout,"MSE within 1 dev: %3.2f, 2 dev: %3.2f\n", + Onedev_mse/Devcounts,Twodev_mse/Devcounts); + fprintf(stdout,"MAE within 1 dev: %3.2f, 2 dev: %3.2f\n", + Onedev_mpe/Devcounts,Twodev_mpe/Devcounts); + fprintf(stdout,"Modal within 1 dev: %3.2f, 2 dev: %3.2f\n", + Onedev_modal/Devcounts,Twodev_modal/Devcounts); + + +#ifdef GROT + fprintf(stdout,"\nlook ahead MSE MAE\n"); + for(i=0; i < LIFETIMES; i++) + { + temp_mse = 0.0; + temp_mpe = 0.0; + for(j=0; j <= i; j++) + { + temp_mse += (Lifetime_mse[j]/(double)Lifetime_count); + temp_mpe += (Lifetime_mpe[j]/(double)Lifetime_count); + } + fprintf(stdout,"%d %f %f\n",i, + temp_mse/(double)j, + temp_mpe/(double)j); + } +#endif + + fprintf(stdout,"Histogram\n"); + PrintHistogram(Histogram); + fprintf(stdout,"\n"); + + exit(0); + + +} +#endif diff --git a/src/nws_portability/Forecast/run_mean.c b/src/nws_portability/Forecast/run_mean.c new file mode 100644 index 0000000000..a08912436c --- /dev/null +++ b/src/nws_portability/Forecast/run_mean.c @@ -0,0 +1,89 @@ +/* $Id$ */ + +#include +#include +#include +#include +#include +#include + +#include "fbuff.h" +#include "run_mean.h" + +struct run_mean_state +{ + fbuff series; /* the series so far */ + fbuff time_stamps; /* the time stamps */ + double total; + double count; +}; + +/* + * init local state. can save a copy of the pointer to the + * series and time stamps, if desired + */ +char * +InitRunMean(fbuff series, fbuff time_stamps, char *params) +{ + struct run_mean_state *state; + + state = (struct run_mean_state *) + malloc(sizeof(struct run_mean_state)); + + if(state == NULL) + { + return(NULL); + } + + /* + * all functions take a forcb + */ + state->series = series; + state->time_stamps = time_stamps; + state->total = 0.0; + state->count = 0.0; + + return((char *)state); +} + +void +FreeRunMean(char *state) +{ + free(state); + return; +} + +void +UpdateRunMean(char *state, + double ts, + double value) +{ + struct run_mean_state *s; + + s = (struct run_mean_state *)state; + + s->total += value; + s->count += 1.0; + return; +} + +int +ForcRunMean(char *state, double *v) +{ + double val; + struct run_mean_state *s = (struct run_mean_state *)state; + + if(s->count != 0.0) + { + val = s->total / s->count; + *v = val; + return(1); + } + else + { + *v = 0.0; + return(0); + } +} + + diff --git a/src/nws_portability/Include/.cvsignore b/src/nws_portability/Include/.cvsignore new file mode 100644 index 0000000000..8426c89d8c --- /dev/null +++ b/src/nws_portability/Include/.cvsignore @@ -0,0 +1 @@ +config_portability.h diff --git a/src/nws_portability/Include/Makefile b/src/nws_portability/Include/Makefile new file mode 100755 index 0000000000..c018647dd8 --- /dev/null +++ b/src/nws_portability/Include/Makefile @@ -0,0 +1,37 @@ +# +# Makefile for Include +# +# $Id$ +# + +# include common variables +include ../Makedefs + +# headers to be installed +HEADERS = diagnostic.h \ + dnsutil.h \ + formatutil.h \ + messages.h \ + osutil.h \ + protocol.h \ + config_portability.h \ + strutil.h \ + fbuff.h \ + timeouts.h \ + forecast_api.h + +.PHONY: all clean dist install + +all: + @$(CP) $(HEADERS) $(buildincdir) + +clean: + +dist: + @$(INSTALL) -d $(DIST_ROOT)/Include + @$(CP) Makefile *.h.in *.h $(DIST_ROOT)/Include + +install: + @echo "Installing header files..." + @$(CP) $(HEADERS) $(incdir) + diff --git a/src/nws_portability/Include/config_portability.h.in b/src/nws_portability/Include/config_portability.h.in new file mode 100644 index 0000000000..7bf83a3ff0 --- /dev/null +++ b/src/nws_portability/Include/config_portability.h.in @@ -0,0 +1,164 @@ +/* $Id$ */ + +#ifndef CONFIG_PORTABILITY_H +#define CONFIG_PORTABILITY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef NULL +# define NULL 0 +#endif + +/* Have standard C headers. */ +#undef STDC_HEADERS + +/* Preserve 2.0 interface with this definition */ +#undef NWS_API_COMPAT + +/* Define to `int' if doesn't define. */ +#undef pid_t + +/* Define if you have the alarm function. */ +#undef HAVE_ALARM + +/* Define if you have inet_ntoa */ +#undef HAVE_INET_ATON + +/* Define if you have inet_ntoa */ +#undef HAVE_INET_NTOA + +/* Define if you have gettimeofday */ +#undef HAVE_GETTIMEOFDAY + +/* Define if you have gethostname. Some OSes doesn't have the definition + * in the include: define it here to avoid warning message. */ +#undef HAVE_GETHOSTNAME +#ifdef HAVE_GETHOSTNAME +int +gethostname(); +#endif + +/* Define if you have uname */ +#undef HAVE_UNAME + +/* Define if you have gethostbyname */ +#undef HAVE_GETHOSTBYNAME + +/* Define if you have gethostbyaddr */ +#undef HAVE_GETHOSTBYADDR + +/* Define if you have gethostbyaddr */ +#undef HAVE_GETHOSTBYADDR_R + +/* Define if you have the getrusage function. */ +#undef HAVE_GETRUSAGE + +/* Define if you have the sqrt function. */ +#undef HAVE_SQRT + +/* Define if we are going to use SIGALRM for our purposes */ +#undef USE_ALARM_SIGNAL + +/* Define if you have the sighold function. */ +#undef HAVE_SIGHOLD + +/* Define if you have the sigrelse function. */ +#undef HAVE_SIGRELSE + +/* Define if you have the siginterrupt function. */ +#undef HAVE_SIGINTERRUPT + +/* Define if you have the statvfs function. */ +#undef HAVE_STATVFS + +/* Define if you have the sys/vfs.h header. */ +#undef HAVE_SYS_VFS_H + +/* Define if you have the math.h header. */ +#undef HAVE_MATH_H + +/* Define if you have the inttypes.h header. */ +#undef HAVE_INTTYPES_H + +/* Define if you have the declaration of uint32_t. */ +#undef HAVE_UINT32_T +/* I would love to use UINT32_T but not with autoconf 2.13 */ +/*#ifdef HAVE_UINT32_T +* # ifdef HAVE_INTTYPES_H +* # include +* # endif +* typedef uint32_t IPAddress; +* #else +* typedef unsigned long IPAddress; +* #endif */ +/* kludge to be sure we have uint32_t */ +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifndef uint32_t +#undef uint32_t +#endif +/* end kludge*/ + +/* Define if you have the sysconf function. */ +#undef HAVE_SYSCONF + +/* Define if you have the strnlen function. */ +#undef HAVE_STRNLEN + +/* Define if you have the fileno function. */ +#undef HAVE_FILENO + +/* Define to the type pointed to by the third parameter of getpeername(). */ +#undef SOCKLEN_T + +/* Define to the (char *) version of the NWS sources. */ +#undef VERSION + +/* Define as the path to the `uptime' program. */ +#undef UPTIME_PATH + +/* Define as the path to the `vmstat' program. */ +#undef VMSTAT_PATH + +/* in some realloc()s, realloc(ptr, 0) != free(ptr) */ +#undef REALLOC_NOT_POSIX + +/* do we have the pthread header? (and hopefully pthread support) */ +#undef HAVE_PTHREAD_H +#ifdef HAVE_PTHREAD_H +#define _REENTRANT +#endif + +#undef PS + +#undef AWK + +#undef WITH_NETLOGGER + +#undef WITH_LDAP + + +#define MALLOC(size) malloc ((size)==0?1:(size)) + +#define FREE(ptr) \ + if (ptr != NULL) { \ + free(ptr); \ + ptr = NULL; \ + } + + +#ifdef REALLOC_NOT_POSIX +#define REALLOC(ptr,size) (((size > 0)?((ptr == NULL)?malloc(size):\ + realloc(ptr,size)):((ptr == NULL)?NULL:(free(ptr),NULL)))) +#else +#define REALLOC(ptr,size) realloc(ptr,size) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* CONFIG_PORTABILITY_H */ diff --git a/src/nws_portability/Include/diagnostic.h b/src/nws_portability/Include/diagnostic.h new file mode 100644 index 0000000000..d910eb91c9 --- /dev/null +++ b/src/nws_portability/Include/diagnostic.h @@ -0,0 +1,223 @@ +/* $Id$ */ + + +#ifndef DIAGNOSTIC_H +#define DIAGNOSTIC_H + + +/* + * This module manages the production of diagnostic messages. + */ + + +#include /* FILE */ + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* +** Different types of diagnostics. +*/ +typedef enum {DIAGLOG, DIAGINFO, DIAGWARN, DIAGERROR, DIAGFATAL, DIAGDEBUG} DiagLevels; + + +#define DIAGSUPPRESS 0 + +/* + * Maximum size for the message and for filenames + */ +#define MAX_MESSAGE_LENGTH 512 +#define MAX_FILENAME_LENGTH 512 + +/* +** Directs #level#-level diagnostic messages to the file #whereTo#. Messages +** for any level may be supressed by passing DIAGSUPPRESS as the second +** parameter to this routine. By default, all messages are suppressed. +*/ +void +DirectDiagnostics(DiagLevels level, + FILE *whereTo); + + +/* +** Returns the file to which #level#-level diagnostics are being directed. May +** be used to save off the direction for a change/restore, or for writing out +** non-message-based information. +*/ +FILE * +DiagnosticsDirection(DiagLevels level); + + +/* +** Produces the #level#-level diagnostic message #message#, which is used as +** the format string in a call to fprintf(). #sourcefilename# and +** #sourcelinenumber# are appended to the message. Additional fprintf() +** arguments may be passed after #message#. +*/ +void +PositionedDiagnostic(DiagLevels level, + const char *fileName, + int line, + const char *message, + ...); + + +/* +** Produces the #level#-level diagnostic message #message#, which is used as +** the format string in a call to fprintf(). Additional fprintf() +** arguments may be passed after #message#. +*/ +void +Diagnostic(DiagLevels level, + const char *message, + ...); + + +/* +** These macros are provided for the usual case where DIAGFATAL messages are +** emitted just before aborting the program and DIAGERROR messages just before +** returning a failure value from a function. The ERROR, WARN, INFO, and LOG +** macros are just a handy shorthand. Unfortunately, the varargs concept +** doesn't extend to macros, which means separate macros have to be defined for +** various parameter counts. The peculiar use of do ... while here prevents +** compilation problems in cases such as: +** if (foo < bar) FAIL("ick!"); else something(); +** The embedded if (1) satisfies the picky compilers that complain about +** execution not reaching the loop test otherwise. +*/ +#define ABORT(message) \ + do { \ + PositionedDiagnostic(DIAGFATAL,__FILE__, __LINE__,message); \ + if (1) exit(1); \ + } while (0) +#define ABORT1(message,a) \ + do { \ + PositionedDiagnostic(DIAGFATAL,__FILE__,__LINE__,message,a); \ + if (1) exit(1); \ + } while (0) +#define ABORT2(message,a,b) \ + do { \ + PositionedDiagnostic(DIAGFATAL,__FILE__,__LINE__,message,a,b); \ + if (1) exit(1); \ + } while (0) +#define ABORT3(message,a,b,c) \ + do { \ + PositionedDiagnostic(DIAGFATAL,__FILE__,__LINE__,message,a,b,c); \ + if (1) exit(1); \ + } while (0) +#define ABORT4(message,a,b,c,d) \ + do { \ + PositionedDiagnostic(DIAGFATAL,__FILE__,__LINE__,message,a,b,c,d); \ + if (1) exit(1); \ + } while (0) +#define ABORT5(message,a,b,c,d,e) \ + do { \ + PositionedDiagnostic(DIAGFATAL,__FILE__,__LINE__,message,a,b,c,d,e); \ + if (1) exit(1); \ + } while (0) + +#define FAIL(message) \ + do { \ + PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message); \ + if (1) return(0); \ + } while (0) +#define FAIL1(message,a) \ + do { \ + PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message,a); \ + if (1) return(0); \ + } while (0) +#define FAIL2(message,a,b) \ + do { \ + PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message,a,b); \ + if (1) return(0); \ + } while (0) +#define FAIL3(message,a,b,c) \ + do { \ + PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message,a,b,c); \ + if (1) return(0); \ + } while (0) +#define FAIL4(message,a,b,c,d) \ + do { \ + PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message,a,b,c,d); \ + if (1) return(0); \ + } while (0) +#define FAIL5(message,a,b,c,d,e) \ + do {PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message,a,b,c,d,e); \ + if (1) return(0); \ + } while (0) + +#define ERROR(message) \ + PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message) +#define ERROR1(message,a) \ + PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message,a) +#define ERROR2(message,a,b) \ + PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message,a,b) +#define ERROR3(message,a,b,c) \ + PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message,a,b,c) +#define ERROR4(message,a,b,c,d) \ + PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message,a,b,c,d) +#define ERROR5(message,a,b,c,d,e) \ + PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message,a,b,c,d,e) + +#define WARN(message) \ + PositionedDiagnostic(DIAGWARN,__FILE__,__LINE__,message) +#define WARN1(message,a) \ + PositionedDiagnostic(DIAGWARN,__FILE__,__LINE__,message,a) +#define WARN2(message,a,b) \ + PositionedDiagnostic(DIAGWARN,__FILE__,__LINE__,message,a,b) +#define WARN3(message,a,b,c) \ + PositionedDiagnostic(DIAGWARN,__FILE__,__LINE__,message,a,b,c) +#define WARN4(message,a,b,c,d) \ + PositionedDiagnostic(DIAGWARN,__FILE__,__LINE__,message,a,b,c,d) +#define WARN5(message,a,b,c,d,e) \ + PositionedDiagnostic(DIAGWARN,__FILE__,__LINE__,message,a,b,c,d,e) + +#define INFO(message) \ + PositionedDiagnostic(DIAGINFO,__FILE__,__LINE__,message) +#define INFO1(message,a) \ + PositionedDiagnostic(DIAGINFO,__FILE__,__LINE__,message,a) +#define INFO2(message,a,b) \ + PositionedDiagnostic(DIAGINFO,__FILE__,__LINE__,message,a,b) +#define INFO3(message,a,b,c) \ + PositionedDiagnostic(DIAGINFO,__FILE__,__LINE__,message,a,b,c) +#define INFO4(message,a,b,c,d) \ + PositionedDiagnostic(DIAGINFO,__FILE__,__LINE__,message,a,b,c,d) +#define INFO5(message,a,b,c,d,e) \ + PositionedDiagnostic(DIAGINFO,__FILE__,__LINE__,message,a,b,c,d,e) + +#define LOG(message) \ + PositionedDiagnostic(DIAGLOG,__FILE__,__LINE__,message) +#define LOG1(message,a) \ + PositionedDiagnostic(DIAGLOG,__FILE__,__LINE__,message,a) +#define LOG2(message,a,b) \ + PositionedDiagnostic(DIAGLOG,__FILE__,__LINE__,message,a,b) +#define LOG3(message,a,b,c) \ + PositionedDiagnostic(DIAGLOG,__FILE__,__LINE__,message,a,b,c) +#define LOG4(message,a,b,c,d) \ + PositionedDiagnostic(DIAGLOG,__FILE__,__LINE__,message,a,b,c,d) +#define LOG5(message,a,b,c,d,e) \ + PositionedDiagnostic(DIAGLOG,__FILE__,__LINE__,message,a,b,c,d,e) + +/* /usr/include/macros.h defines a DEBUG macro, so we use DDEBUG instead. */ +#define DDEBUG(message) \ + PositionedDiagnostic(DIAGDEBUG,__FILE__,__LINE__,message) +#define DDEBUG1(message,a) \ + PositionedDiagnostic(DIAGDEBUG,__FILE__,__LINE__,message,a) +#define DDEBUG2(message,a,b) \ + PositionedDiagnostic(DIAGDEBUG,__FILE__,__LINE__,message,a,b) +#define DDEBUG3(message,a,b,c) \ + PositionedDiagnostic(DIAGDEBUG,__FILE__,__LINE__,message,a,b,c) +#define DDEBUG4(message,a,b,c,d) \ + PositionedDiagnostic(DIAGDEBUG,__FILE__,__LINE__,message,a,b,c,d) +#define DDEBUG5(message,a,b,c,d,e) \ + PositionedDiagnostic(DIAGDEBUG,__FILE__,__LINE__,message,a,b,c,d,e) + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/src/nws_portability/Include/dnsutil.h b/src/nws_portability/Include/dnsutil.h new file mode 100644 index 0000000000..5db9e7086d --- /dev/null +++ b/src/nws_portability/Include/dnsutil.h @@ -0,0 +1,112 @@ +/* $Id$ */ + + +#ifndef DNSUTIL_H +#define DNSUTIL_H + +#include "config_portability.h" + +/** + * This package defines some utilities for determining and converting DNS + * machine names and IP addresses. + */ + + +#ifdef __cplusplus +extern "C" { +#endif + + +#define MAX_IP_IMAGE 15 +/* Maximum text length of an IP address, i.e. strlen("255.255.255.255") */ + + +/* + * Common typedefs for all portability + */ +typedef uint32_t IPAddress; +typedef int Socket; +#define NO_SOCKET ((Socket)-1) + +/** + * returns the address of the host connected to #sd#. Returns 0 on error. + */ +IPAddress +Peer(Socket sd); + + +/** + * Returns the DNS name of the host connected to #sd#, or descriptive text if + * #sd# is not an inter-host connection: returns NULL in case of error + * The value returned needs to be freed. + */ +char * +PeerName_r(Socket sd); + +/* + * returns the port number on the other side of socket sd. -1 is returned + * if pipes or unknown + */ +unsigned short +PeerNamePort(Socket sd); + + +/** + * Converts #addr# into a printable string and returns the result. You + * are responsible to free the returned string: can return NULL (out of + * memory condition). + */ +char * +IPAddressImage_r(IPAddress addr); + + +/** + * Converts #addr# to a fully-qualified machine name and returns the result. + * You are responsible to free the returned string: can return NULL + * (out of memory or error). + */ +char * +IPAddressMachine_r(IPAddress addr); + +/* + * Converts #machineOrAddress#, which may be either a DNS name or an IP address + * image, into a list of addresses. Copies the list into the #atMost#-long + * array #addressList#. Returns the number of addresses copied, or zero on + * error. #atMost# may be zero, in which case the function simply returns one + * or zero depending on whether or not #machineOrAddress# is a valid machine + * name or IP address image. + */ +int +IPAddressValues(const char *machineOrAddress, + IPAddress *addressList, + unsigned int atMost); +#define IPAddressValue(machineOrAddress,address) \ + IPAddressValues(machineOrAddress,address,1) +#define IsValidIP(machineOrAddress) IPAddressValues(machineOrAddress,NULL,0) + + +/** + * Returns the fully-qualified name of the host machine, or NULL if the name + * cannot be determined. Always returns the same value, so multiple calls + * cause no problems. + */ +const char * +MyMachineName(void); + + +/* DEPRECATED! These functions are going to go away: they are not thread + * safe. */ +const char * +IPAddressImage(IPAddress addr); +const char * +IPAddressMachine(IPAddress addr); +const char * +PeerName(Socket sd); + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/src/nws_portability/Include/exp_smooth.h b/src/nws_portability/Include/exp_smooth.h new file mode 100644 index 0000000000..eccb961580 --- /dev/null +++ b/src/nws_portability/Include/exp_smooth.h @@ -0,0 +1,20 @@ +/* $Id$ */ + +#if !defined(EXP_SMOOTH_H) +#define EXP_SMOOTH_H + +#include "fbuff.h" + +extern char *InitExpSmooth(fbuff series, + fbuff time_stamps, + char *params); + +extern void FreeExpSmooth(char *state); + +extern void UpdateExpSmooth(char *state, + double ts, + double value); + +extern int ForcExpSmooth(char *state, double *v); +#endif + diff --git a/src/nws_portability/Include/fbuff.h b/src/nws_portability/Include/fbuff.h new file mode 100644 index 0000000000..2dd9181bf2 --- /dev/null +++ b/src/nws_portability/Include/fbuff.h @@ -0,0 +1,35 @@ +/* $Id$ */ + +#if !defined(FBUFF_H) +#define FBUFF_H + +#define MODMINUS(a,b,m) ((a) - (b) + (((a) >= (b)) ? 0 : ((b) <= (m)) ? (m) : ((m) * (1 + (int)(b) / (int)(m))))) +#define MODPLUS(a,b,m) ((a) + (b) - ((((m) - (b)) > (a)) ? 0 : ((b) <= (m)) ? (m) : ((m) * (1 + (int)(b) / (int)(m))))) + +struct fbuff_stc +{ + int head; + int tail; + int size; + double *vals; +}; + +typedef struct fbuff_stc *fbuff; + +#define FBUFF_SIZE (sizeof(struct fbuff_stc)) + +#define F_HEAD(fb) ((fb)->vals[(fb)->head]) +#define F_SIZE(fb) ((fb)->size) +#define F_FIRST(fb) MODPLUS(((fb)->head),1,(fb)->size) +#define F_LAST(fb) ((fb)->head) +#define F_VAL(fb,i) ((fb)->vals[(i)]) +#define F_COUNT(fb) (MODMINUS((fb)->tail,(fb)->head,(fb)->size) - 1) +#define F_TAIL(fb) ((fb)->tail) + +#define IS_EMPTY(fb) ((F_COUNT(fb) == 0) ? 1 : 0) + +extern fbuff InitFBuff(int size); +extern void FreeFBuff(fbuff fb); +extern void UpdateFBuff(fbuff fb, double val); + +#endif diff --git a/src/nws_portability/Include/forc.h b/src/nws_portability/Include/forc.h new file mode 100644 index 0000000000..a1e9c307df --- /dev/null +++ b/src/nws_portability/Include/forc.h @@ -0,0 +1,193 @@ +#if !defined(FORC_H) + +#define FORC_H + +/* + * forcb structure contains generic forecasting fields. The individual + * forecastres can see the current time series and time_stamps as well + * as any other local state that wish to preserve. + */ + +#include "fbuff.h" +#include "mse_forc.h" + +struct forcb_stc +{ + fbuff series; /* data series */ + fbuff time_stamps; /* time stamp series */ + fbuff se_series; /* cumulative sq. err. series */ + fbuff ae_series; /* cumulative ab err series */ + double best_f; /* best forecast */ + int best_i; /* best forecast number */ + double best_err; /* cum best err */ + char *state; + double se; + double ae; + double count; + void (*update)(); + int (*forecast)(); + void (*free)(); + char name[255]; +}; + +typedef struct forcb_stc *forcb; + +#define FORCB_SIZE (sizeof(struct forcb_stc)) + + +/* + * list of forcb structs -- used as a cookie through the interface + */ +struct fork_list_stc +{ + forcb *forcs; + int count; + forcb *derived_forcs; + int derived_count; + forcb total_mse; + int total_mse_method; + forcb total_mae; + int total_mae_method; +}; + +#define FORCL_SIZE (sizeof(struct fork_list_stc)) + +typedef struct fork_list_stc *forcl; + +struct forc_life_stc +{ + char *forc_list; + double lifetime; + double epoch_end; + double total; + double count; +}; +#define FORCLIFE_SIZE (sizeof(struct forc_life_stc)) + +typedef struct forc_life_stc *forclife; + + +/* + * initializes forecasting structure with as many as #max_forc_count# + * forecasters and a circular buffer with #buff_size# values and + * time_stamp entries. Returns a cookie to be passed subsequently + */ +char * +InitForcl(int max_forc_count, int buff_size); + +/* + * lifetime version + */ +char * +InitForcLife(int max_forc_count, int buff_size, double lifetime); + +/* + * frees forecaster state associated with cookie #i_forcl# + */ +void +FreeForcl(char *cookie); + +/* + * lifetime version + */ +void +FreeForcLife(char *state); + + +/* + * updates forecaster state associated with #cookie# using #value# + * and #time_stamp#. Neither #value# nore #time_stamp# are checked + * for validity + */ +void +UpdateForecasts(char *cookie, double time_stamp, double value); + +/* + * lifetime version + */ +void +UpdateForcLife(char *state, double ts, double value); + +/* + * returns value and lifetime from series (may be averages) + */ +double +LifetimeValue(char *state); + +double +LifetimeTimestamp(char *state); + + + +/* + * generates MSE nd MAE forecasts value for data associated with #cookie# + */ +double MSEForecast(char *cookie); +double MSEOptForecast(char *cookie); +double MSEError(char *cookie); +int MSEMethod(char *cookie); +int MSEOptMethod(char *cookie); +double MAEForecast(char *cookie); +double MAEOptForecast(char *cookie); +double MAEError(char *cookie); +int MAEMethod(char *cookie); +int MAEOptMethod(char *cookie); + +/* + * same API for versions that take a lifetime and forecast the average + */ +double MSELifetimeForecast(char *cookie); +double MSELifetimeError(char *cookie); +int MSELifetimeMethod(char *cookie); +double MSELifetimeEpoch(char *cookie); +double MAELifetimeForecast(char *cookie); +double MAELifetimeError(char *cookie); +int MAELifetimeMethod(char *cookie); +double MAELifetimeEpoch(char *cookie); + +/* + * prints the low and high forecasts and their forecast numbers + */ +int +ForcRange(char *cookie, double *low, double *high, int *low_i, int *high_i); + +/* + * prints a summary of forecaster state + */ +void PrintForecastSummary(char *state); +void PrintLifetimeForecastSummary(char *state); + +/* + * routine put in to support FORECASTAPI_MethodName which doesn't + * take a state record + */ +void GetForcNames(char *state, + char *methodNames[], + int max_size, + int *out_size); + +/* + * generic interface requiring no size parameterization -- could waste + * space + */ + +/* + * maximum number of forecasters + */ +#define MAX_FORC (35) + +/* + * default size of circular buffer + */ +#define MAX_DATA_ENTRIES (100) + +#define INITFORECASTER() (InitForcl(MAX_FORC,MAX_DATA_ENTRIES)) +#define FREEFORECASTER(cookie) (FreeForcl(cookie)) +#define UPDATEFORECASTER(cookie,ts,v) (UpdateForecasts((cookie),(ts),(v))) +#define FORECAST(cookie) (MSEForecast((cookie))) + +#define DBIG_VAL (999999999999999999999999999.99) +#define FORE_ERROR_VAL (DBIG_VAL) + + +#endif diff --git a/src/nws_portability/Include/forecast_api.h b/src/nws_portability/Include/forecast_api.h new file mode 100644 index 0000000000..b1f6d174c2 --- /dev/null +++ b/src/nws_portability/Include/forecast_api.h @@ -0,0 +1,143 @@ +/* $Id$ */ + +#ifndef FORECAST_API_H +#define FORECAST_API_H + + +#include /* size_t */ + + +/* + * This file defines the API for the Network Weather Service forecast- + * generation library. The functions defined here allow programs to compute + * forecasts from time-stamp/value pairs. The logic of operation is: + * - create a new ForecasterState + * - Update the state with values you observe + * - get a forecast back + * + * NOTE: In order to avoid name collisions, all names defined here begin with + * FORECASTAPI_. To avoid having to use this prefix, #define + * FORECASTAPI_SHORTNAMES before #include'ing this file. + */ + + +/* + * A description of a measurement. The time the measurement was taken + * (represented as a number of seconds since midnight, 1/1/1970 GMT) and the + * observed value. + */ +typedef struct { + double timeStamp; + double measurement; +} FORECASTAPI_Measurement; + + +/* + * A description of a forecast. The forecast value itself, an estimate of the + * precision of the forecast, and an index for the method used to generate it. + */ +typedef struct { + double forecast; + double error; + unsigned int methodUsed; +} FORECASTAPI_Forecast; + + +/** + * A description of a collection of forecasts, each one based on minimizing a + * different measurement of the error (MAE == MEAN_ABSOLUTE_ERROR, MSE == + * MEAN_SQUARE_ERROR). The actual measurement taken at the same time is + * included for convenience when available. + */ +#define FORECASTAPI_FORECAST_TYPE_COUNT 2 +#define FORECASTAPI_MAE_FORECAST 0 +#define FORECASTAPI_MSE_FORECAST 1 +typedef struct { + FORECASTAPI_Measurement measurement; + FORECASTAPI_Forecast forecasts[FORECASTAPI_FORECAST_TYPE_COUNT]; +} FORECASTAPI_ForecastCollection; + + +/** + * A description of a forecasting state. Client code should obtain these + * structures via NewForecastState(), update them with new values via + * UpdateForecastState(), then delete them via FreeForecastState(). + */ +struct FORECASTAPI_ForecastStateStruct; +typedef struct FORECASTAPI_ForecastStateStruct FORECASTAPI_ForecastState; + + +/** + * Frees the memory occupied by the forecasting state pointed to by #state# + * and sets #state# to NULL. + */ +void +FORECASTAPI_FreeForecastState(FORECASTAPI_ForecastState **state); + + +/** + * Returns the name of the #methodIndex#th forecasting method used by the + * forecasting library, or NULL if #methodIndex# is out of range. + */ +const char * +FORECASTAPI_MethodName(unsigned int methodIndex); + + +/** + * Allocates and returns a new forecasting state, or NULL if memory is + * exhausted. The caller should eventually call FreeForecastingState() to + * free the memory. + */ +FORECASTAPI_ForecastState * +FORECASTAPI_NewForecastState(void); + + +/** + * Incorporates the #howManyMeasurements#-long series #measurements# into the + * forecasting state #state#. If #forecasts# is non-NULL, it points to a + * #howManyForecasts#-long array into which the function should store + * forecasts generated during the course of the update If #howManyForecasts# + * is less than #howManyMeasurements#, the forecasts derived from the later + * measurements (which appear at the beginning of #measurements#) are stored. + */ +void +FORECASTAPI_UpdateForecastState(FORECASTAPI_ForecastState *state, + const FORECASTAPI_Measurement *measurements, + size_t howManyMeasurements, + FORECASTAPI_ForecastCollection *forecasts, + size_t howManyForecasts); +#define FORECASTAPI_UpdateForecast(state, measurements, howMany) \ + FORECASTAPI_UpdateForecastState(state, measurements, howMany, NULL, 0) + +/** + * Return a set of forecast base on the current state of the forecaster. + * #forecast# need to have space for at least one ForecastCollection. + * + * Return 1 in case of error, 0 otherwise. + * + * Warning: The measurement insite the Collection is not meaningful. + */ +int +FORECASTAPI_ComputeForecast( FORECASTAPI_ForecastState *state, + FORECASTAPI_ForecastCollection *forecast); + +#ifdef FORECASTAPI_SHORTNAMES + +#define Measurement FORECASTAPI_Measurement +#define Forecast FORECASTAPI_Forecast +#define FORECAST_TYPE_COUNT FORECASTAPI_FORECAST_TYPE_COUNT +#define MAE_FORECAST FORECASTAPI_MAE_FORECAST +#define MSE_FORECAST FORECASTAPI_MSE_FORECAST +#define ForecastCollection FORECASTAPI_ForecastCollection +#define ForecastStateStruct FORECASTAPI_ForecastStateStruct +#define ForecastState FORECASTAPI_ForecastState +#define FreeForecastState FORECASTAPI_FreeForecastState +#define MethodName FORECASTAPI_MethodName +#define NewForecastState FORECASTAPI_NewForecastState +#define UpdateForecastState FORECASTAPI_UpdateForecastState +#define UpdateForecast FORECASTAPI_UpdateForecast +#define ComputeForecast FORECASTAPI_ComputeForecast + +#endif + +#endif diff --git a/src/nws_portability/Include/forecasters.h b/src/nws_portability/Include/forecasters.h new file mode 100644 index 0000000000..9858f0667a --- /dev/null +++ b/src/nws_portability/Include/forecasters.h @@ -0,0 +1,6 @@ +/* $Id$ */ + +#include "last_value.h" +#include "exp_smooth.h" +#include "median.h" +#include "run_mean.h" diff --git a/src/nws_portability/Include/formatutil.h b/src/nws_portability/Include/formatutil.h new file mode 100644 index 0000000000..e18c225203 --- /dev/null +++ b/src/nws_portability/Include/formatutil.h @@ -0,0 +1,164 @@ +/* $Id$ */ + + +#ifndef FORMATUTIL_H +#define FORMATUTIL_H + + +/* +** This package provides utilities for translating between host and network +** data formats. It may be thought of as an extention of the Unix {hn}to{nh}* +** functions or as a lightweight version of XDR. It handles big-to-little +** endian translations, integer size discrepencies, and conversions to/from +** IEEE floating point format. It does *not* presently handle either non-two's +** complement integer formats or mixed-endian (e.g., little endian bytes, big +** endian words) ordering. These are so rare and generally archaic that +** handling them seems not worth the added code. Note: compiling the body of +** this package with NORMAL_FP_FORMAT defined will yield a tiny performance +** improvement and a small savings in code size by eliminating the IEEE +** conversion code. +*/ + + +#include /* offsetof() */ +#include /* size_t */ + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* +** Supported data types. "Network format" characters are one byte and longs +** four bytes; otherwise, the formats are those used by Java: two byte shorts, +** four byte ints and floats, eight byte doubles; two's compliment integer and +** IEEE 754 floating point; most-significant bytes first. +*/ +typedef enum + {CHAR_TYPE, DOUBLE_TYPE, FLOAT_TYPE, INT_TYPE, LONG_TYPE, SHORT_TYPE, + UNSIGNED_INT_TYPE, UNSIGNED_LONG_TYPE, UNSIGNED_SHORT_TYPE, STRUCT_TYPE} + DataTypes; +#define SIMPLE_TYPE_COUNT 9 +typedef enum {HOST_FORMAT, NETWORK_FORMAT} FormatTypes; + + +/* +** A description of a collection of #type# data. #repetitions# is used only +** for arrays; it contains the number of elements. #offset# is used only for +** struct members in host format; it contains the offset of the member from the +** beginning of the struct, taking into account internal padding added by the +** compiler for alignment purposes. #members#, #length#, and #tailPadding# are +** used only for STRUCT_TYPE data; the #length#-long array #members# describes +** the members of the nested struct, and #tailPadding# indicates how many +** padding bytes the compiler adds to the end of the structure. +*/ +typedef struct DataDescriptorStruct { + DataTypes type; + size_t repetitions; + size_t offset; + struct DataDescriptorStruct *members; + size_t length; + size_t tailPadding; +} DataDescriptor; +#ifndef NULL +#define NULL 0 +#endif +#define SIMPLE_DATA(type,repetitions) {type, repetitions, 0, NULL, 0, 0} +#define SIMPLE_MEMBER(type,repetitions,offset) \ + {type, repetitions, offset, NULL, 0, 0} +#define PAD_BYTES(structType,lastMember,memberType,repetitions) \ + sizeof(structType) - offsetof(structType, lastMember) - \ + sizeof(memberType) * repetitions + + +/* +** Translates the data pointed to by #source# between host and network formats +** and stores the result in #destination#. The contents of #source# are +** described by the #length#-long array #description#, and #sourceFormat# +** indicates whether we're translating from host format to network format or +** vice versa. The caller must insure that the memory pointed to by +** #destination# is of sufficient size to contain the translated data. +*/ +void +ConvertData(void *destination, + const void *source, + const DataDescriptor *description, + size_t length, + FormatTypes sourceFormat); + + +/* +** Returns the number of bytes required to hold the objects indicated by the +** data described by the #length#-long array #description#. #hostFormat# +** indicates whether the host or network format size is desired. +*/ +size_t +DataSize(const DataDescriptor *description, + size_t length, + FormatTypes format); + + +/* +** Returns 1 or 0 depending on whether or not the host format for #whatType# +** differs from the network format. +*/ +int +DifferentFormat(DataTypes whatType); + + +/* +** Returns 1 or 0 depending on whether or not the host architecture stores +** data in little-endian (least significant byte first) order. +*/ +int +DifferentOrder(void); + + +/* +** Returns 1 or 0 depending on whether or not the host data size for #whatType# +** differs from the network data size. +*/ +int +DifferentSize(DataTypes whatType); + + +/* +** These two functions are a convenience that allows callers to work with +** homogenous blocks of data without setting up a DataDescriptor. They perform +** the same function as the more general function on a block of #repetitions# +** occurrences of #whatType# data. +*/ +void +HomogenousConvertData(void *destination, + const void *source, + DataTypes whatType, + size_t repetitions, + FormatTypes sourceFormat); +size_t +HomogenousDataSize(DataTypes whatType, + size_t repetitions, + FormatTypes format); + + +/* +** Copies #repetitions# data items of type #whatType# from #source# to +** #destination#, reversing the bytes of each item (i.e., translates between +** network and host byte order). #format# indicates whether the data to be +** reversed is in network or host format. This is an internal package function +** which is included in the interface for convenience. +*/ +void +ReverseData(void *destination, + const void *source, + DataTypes whatType, + int repetitions, + FormatTypes format); + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/src/nws_portability/Include/last_value.h b/src/nws_portability/Include/last_value.h new file mode 100644 index 0000000000..530738c12f --- /dev/null +++ b/src/nws_portability/Include/last_value.h @@ -0,0 +1,13 @@ +/* $Id$ */ + +#if !defined(LAST_VAL_H) +#define LAST_VAL_H + +#include "fbuff.h" + +char *InitLastValue(fbuff series, fbuff time_stamps, char *params); +void FreeLastValue(char *state); +void UpdateLastValue(char *state, double ts, double value); +int ForcLastValue(char *state, double *v); +#endif + diff --git a/src/nws_portability/Include/median.h b/src/nws_portability/Include/median.h new file mode 100644 index 0000000000..433078df3a --- /dev/null +++ b/src/nws_portability/Include/median.h @@ -0,0 +1,26 @@ +/* $Id$ */ + +#ifndef MEDIAN_H +#define MEDIAN_H + +#define MAX_MED_SIZE 100 + +#include "fbuff.h" + +char *InitMedian(fbuff series, fbuff time_stamps, char *params); +void FreeMedian(char *state); +void UpdateMedian(char *state, double ts, double value); +int ForcMedian(char *state, double *forecast); + +char *InitTrimMedian(fbuff series, fbuff time_stamps, char *params); +void FreeTrimMedian(char *state); +void UpdateTrimMedian(char *state, double ts, double value); +int ForcTrimMedian(char *state, double *forecast); + +char *InitAdMedian(fbuff series, fbuff time_stamps, char *params); +void FreeAdMedian(char *state); +void UpdateAdMedian(char *state, double ts, double value); +int ForcAdMedian(char *state, double *forecast); + +#endif + diff --git a/src/nws_portability/Include/messages.h b/src/nws_portability/Include/messages.h new file mode 100644 index 0000000000..ffe3858002 --- /dev/null +++ b/src/nws_portability/Include/messages.h @@ -0,0 +1,196 @@ +/* $Id$ */ + +#ifndef MESSAGES_H +#define MESSAGES_H + +/* + * This package defines NWS functions for sending messages between hosts. + */ + +#include /* size_t */ +#include "formatutil.h" /* DataDescriptor */ +#include "protocol.h" /* Socket */ +#ifdef WITH_LDAP +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * This is the four-byte NWS version number. The first two bytes are + * major and minor release numbers; the meaning of the other two bytes is + * undefined. + */ +#define NWS_VERSION 0x02030000 + + +typedef unsigned int MessageType; + +/** + * this is the message header: it contains the NWS version (if I don't + * forget to update) so that we can try to be backward compatible, the + * message type and the data size. Upwn recepit of a message this is + * what is passed to the listener along with the open socket. + */ +typedef struct { + unsigned int version; + MessageType message; + size_t dataSize; +} MessageHeader; + + +typedef void (*ListenFunction)(Socket *, MessageHeader); +typedef int (*LdapListenFunction)(Socket *); + + +/** + * Waits up to #timeOut# seconds to see if a message comes in; if so, + * calls the registered listener for that message (see + * RegisterListener()). + */ +void +ListenForMessages(double timeOut); + + +/** + * Indicates a desire that the function #listener# be called whenever a + * #message# message comes in. #image# is a printable message name; it's + * used to log the arrival of the message. + */ +void +RegisterListener(MessageType message, + const char *image, + ListenFunction listener); + + +#ifdef WITH_LDAP +/* +** Indicates a desire that the function #listener# be called whenever an +** LDAP message comes in. Only one LDAP listener may be active at a time. +*/ +void +RegisterLdapListener(LdapListenFunction listener); + + +/* +** Sends an unsolicited notification of disconnection on *sd, then shut down +** the socket. See the LDAP RFC for details on this message. +*/ +void +SendLdapDisconnect (Socket *sd, + ber_int_t resultCode); +#endif + + +/** + * Receives on #sd#, into #data#, the data described by the #howMany#-long + * array of descriptors #description#. Returns 1 if successful within + * #timeOut# seconds, else 0. + * If #timeOut# is negative adaptive timeouts will be used, if it's 0 no + * timeouts will be used. + */ +int +RecvData(Socket sd, + void *data, + const DataDescriptor *description, + size_t howMany, + double timeOut); + + +/** + * Waits for a #message# message to come in over #sd#. If successful within + * #timeOut# seconds, returns 1 and copies the size of the accompanying data + * into #dataSize#; otherwise, returns 0. + * If #timeOut# is negative adaptive timeouts will be used, if it's 0 no + * timeouts will be used. + */ +int +RecvMessage(Socket sd, + MessageType message, + size_t *dataSize, + double timeOut); + + +/** + * Waits for a #message# message to come in over #sd#. If successful within + * #timeOut# seconds, returns 1 and copies the accompanying data into #data1# + * and #data2#, which are described by the #howMany1# and #howMany3#-long + * arrays of descriptors #description1# and #description2#, respectively; + * otherwise, returns 0. + * If #timeOut# is negative adaptive timeouts will be used, if it's 0 no + * timeouts will be used. + */ +int +RecvMessageAndDatas(Socket sd, + MessageType message, + void *data1, + const DataDescriptor *description1, + size_t howMany1, + void *data2, + const DataDescriptor *description2, + size_t howMany2, + double timeOut); +#define RecvMessageAndData(sd,message,data,description,howMany,timeOut) \ + RecvMessageAndDatas(sd,message,data,description,howMany,NULL,NULL,0,timeOut) + + +/** + * Sends #data#, described by the #howMany#-long array of descriptors + * #description#. Returns 1 if successful in #timeOut# seconds, else 0. This + * fuction allows callers to extend the data that accompanies messages beyond + * the two items provided for by SendMessageAndDatas(). Note, however, that + * since the data sent via a call to this function is not packaged with a + * message, the receiver will not be able to determine the data size directly. + * The caller must assure that the data size is known to the recipient, either + * because its length is predetermined, or because its length was enclosed in a + * previously-transmitted message. + * If #timeOut# is negative adaptive timeouts will be used, if it's 0 no + * timeouts will be used. + */ +int +SendData(Socket sd, + const void *data, + const DataDescriptor *description, + size_t howMany, + double timeOut); + + +/** + * Sends a message of type #message# on #sd# followed by #data1# and #data2#, + * which are described, respectively, by the #howMany1#-long and the + * #howMany2#-long arrays of descriptors #description1# and #description2#. + * Each data parameter may be NULL, in which case its description is ignored. + * Returns 1 if successful within #timeOut# seconds, else 0. + * If #timeOut# is negative adaptive timeouts will be used, if it's 0 no + * timeouts will be used. + */ +int +SendMessageAndDatas(Socket sd, + MessageType message, + const void *data1, + const DataDescriptor *description1, + size_t howMany1, + const void *data2, + const DataDescriptor *description2, + size_t howMany2, + double timeOut); +#define SendMessage(sd,message,timeOut) \ + SendMessageAndDatas(sd,message,NULL,NULL,0,NULL,NULL,0,timeOut) +#define SendMessageAndData(sd,message,data,descriptor,howMany,timeOut) \ + SendMessageAndDatas(sd,message,data,descriptor,howMany,NULL,NULL,0,timeOut) + +/** + * reads the NWS header associated with in incoming message and returns + * the message type #message# as an integer. returns -1 if the read fails + * If #timeOut# is negative adaptive timeouts will be used, if it's 0 no + * timeouts will be used. + */ +int RecvMsgType(Socket sd, double timeout); + +#ifdef __cplusplus +} +#endif + +#endif /* MESSAGES_H */ diff --git a/src/nws_portability/Include/mse_forc.h b/src/nws_portability/Include/mse_forc.h new file mode 100644 index 0000000000..4e9e36861e --- /dev/null +++ b/src/nws_portability/Include/mse_forc.h @@ -0,0 +1,20 @@ +#ifndef MSE_FORC_H + +#define MSE_FORC_H + +#define MAX_MSE_WIN (100) + +/* + * API for forc.c + */ +int TotalMSEForecast(char *state, double *forecast); +int TotalMAEForecast(char *state, double *forecast); + +char *InitWinMSE(fbuff series, fbuff time_stamps, char *params); +char *InitWinMAE(fbuff series, fbuff time_stamps, char *params); +void FreeWinMSE(char *state); +void FreeWinMAE(char *state); +int LocalWinMSEForecast(char *state, double *forecast); +int LocalWinMAEForecast(char *state, double *forecast); + +#endif diff --git a/src/nws_portability/Include/osutil.h b/src/nws_portability/Include/osutil.h new file mode 100644 index 0000000000..9ef63b35c1 --- /dev/null +++ b/src/nws_portability/Include/osutil.h @@ -0,0 +1,132 @@ +/* $Id$ */ + + +#ifndef OSUTIL_H +#define OSUTIL_H + + +/* +** This package defines functions for working with operating system facilities. +*/ + + +#include /* mode_t size_t */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Returns a best-guess estimate of the number of CPUs on the system. +*/ +int +CPUCount(void); + + +/* +** Returns the current time in number of seconds since midnight 1/1/1970, GMT. +*/ +double +CurrentTime(void); + + +/* +** Returns the environment value for the variable #name#. This value is +** determined in one of three ways: if an environment variable of that name is +** set, its value is used; otherwise, if a file named #rcName# in one of the +** colon-delimited set of directories #rcDirs# contains a line of the form +** #name#=value, then that value is used; otherwise #defaultValue# is used. +** For convenience, a directory of "~" in #rcDirs# is expanded to the contents +** of the HOME environment variable. +*/ +const char * +GetEnvironmentValue(const char *name, + const char *rcDirs, + const char *rcName, + const char *defaultValue); + + +/* +** Attempts to determine the login id of the user running the binary. Returns +** 1 and copies the name into the #length#-long array name if successful, else +** returns 0. +*/ +int +GetUserName(char *name, + size_t length); + + +/* + * Wrapper around the system signal() for the SIGALRM signal. + * new_hanlder is the handler to be installed and old_handler (if not + * NULL) will contain the handler to be substituted. + * Return 1 upon * success and 0 otherwise. + * + */ +typedef void(* handler)(int sig); +int +SignalAlarm( handler new_handler, + handler *old_handler); + +/* +** Prevents the O/S from raising the signal #sig# until a subsequent call to +** ReleaseSignal() is made. +*/ +void +HoldSignal(int sig); + + +/* +** Creates the directory specified by #path# with mode #mode#. If +** #makeEntirePath# is non-zero, any missing subpaths in #path# will also be +** created. Returns 1 if successful, else 0. +*/ +int +MakeDirectory(const char *path, + mode_t mode, + int makeEntirePath); + + +/* +** Returns the number of microseconds that have elapsed since midnight, local +** time. +*/ +long int +MicroTime(void); + + +/* +** Allows the O/S to raise the signal #sig#. +*/ +void +ReleaseSignal(int sig); + + +/* +** Starts a timer that will raise a SIGALRM in #numberOfSecs# seconds. +*/ +void +SetRealTimer(unsigned int numberOfSecs); +#define RESETREALTIMER SetRealTimer(0) + +/** + * Locks are handled in a peculiar way: #lock# is a void * passed in by + * the module. If #lock# is NULL, GetNWSLock() will assign to it a mutex + * and then it will lock it. It's up to the module to keep track of the + * different locks. + * Returns 1 if succesfull 0 otherwise. + */ +int +GetNWSLock(void **lock); + +/** + * release the NWS general lock. Returns 1 if succesful, 0 otherwise. + */ +int +ReleaseNWSLock(void **lock); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/nws_portability/Include/predictor.h b/src/nws_portability/Include/predictor.h new file mode 100644 index 0000000000..bdd4b3ce20 --- /dev/null +++ b/src/nws_portability/Include/predictor.h @@ -0,0 +1,128 @@ +/* $Id$ */ + +#include /* time_t */ + +/* linux defines this in /usr/include/values.h as 1.79769313486231570e+308 */ +#ifndef MAXDOUBLE +#define MAXDOUBLE (999999999999.0) +#endif +/* #define HISTORYSIZE 200*/ +/* reduce memory footprint */ +#define HISTORYSIZE 100 +#define MAX_MED_N HISTORYSIZE +#define MIN_DATA_HISTORY 10 + +#define PREDS 14 +#define STATIC_PREDS (PREDS - 6) +#define SECOND_ORDER_PREDS (PREDS - 2) +#define MSE_PRED (STATIC_PREDS) +#define MAE_PRED (STATIC_PREDS+1) +#define WIN_MSE_PRED (STATIC_PREDS+2) +#define WIN_MAE_PRED (STATIC_PREDS+3) +#define TOT_MSE_PRED (SECOND_ORDER_PREDS) +#define TOT_MAE_PRED (SECOND_ORDER_PREDS+1) + +#define DYNPRED TOT_MSE_PRED + +#define LIFETIMES 120 + +#define MED_N 21 +#define MED_ALPHA (0.1) + +#define ERR_WIN 10 + +#define STATES 2 +#define DIM 2 +#define HMAX 10.0 +#define HMIN 0.0 + +/* + * for adaptive window predictors + */ +#define WIN_MIN 5 +#define WIN_MAX 50 +#define WIN_INIT 25 + +/* + * for AR predictor + */ +#define AR_N 50 +#define AR_P 20 + +struct pred_el +{ + float pred; + double error; + double sq_error; + int medwin; + int meanwin; +}; + +struct value_el +{ + time_t time; + float value; + struct pred_el preds[PREDS]; +}; + +struct thruput_pred +{ + int head; + int tail; + struct value_el data[HISTORYSIZE]; + + double mean; + double run_mean; + double total; + + double mses[PREDS]; + double mpes[PREDS]; + double counts[PREDS]; + int pred_nums[PREDS-STATIC_PREDS]; +}; + +#define MODPLUS(a,b,m) (((a) + (b)) % (m)) +#define MODMINUS(a,b,m) (((a) - (b) + (m)) % (m)) + +#define PRED(n,v) ((v).preds[(n)].pred) +#define ERR(n,v) ((v).preds[(n)].error) +#define SQERR(n,v) ((v).preds[(n)].sq_error) +#define MedWIN(n,v) ((v).preds[(n)].medwin) +#define MeanWIN(n,v) ((v).preds[(n)].meanwin) + +#define TPPREDNUM(tp,n) ((tp)->pred_nums[(n)-STATIC_PREDS]) +#define TPMSE(tp,n) ((tp)->mses[(n)]) +#define TPMAE(tp,n) ((tp)->mpes[(n)]) +#define TPCOUNT(tp,n) ((tp)->counts[(n)]) + +#define CURRVAL(tp) ((tp).data[MODMINUS((tp).head,1,HISTORYSIZE)].value) +#define CURRTIME(tp) ((tp).data[MODMINUS((tp).head,1,HISTORYSIZE)].time) +#define CURRPRED(tp) \ + PRED(TOT_MSE_PRED,(tp).data[MODMINUS((tp).head,1,HISTORYSIZE)]) +#define CURRMSEPRED(tp) \ + PRED(TOT_MSE_PRED,(tp).data[MODMINUS((tp).head,1,HISTORYSIZE)]) +#define CURRMAEPRED(tp) \ + PRED(TOT_MAE_PRED,(tp).data[MODMINUS((tp).head,1,HISTORYSIZE)]) +#define CURRMSE(tp) \ + (TPCOUNT(&(tp),TOT_MSE_PRED) != 0.0 ?\ + (TPMSE(&(tp),TOT_MSE_PRED)/TPCOUNT(&(tp),TOT_MSE_PRED)) : 0.0) +#define CURRMAE(tp) \ + (TPCOUNT(&(tp),TOT_MAE_PRED) != 0.0 ?\ + (TPMAE(&(tp),TOT_MAE_PRED)/TPCOUNT(&(tp),TOT_MAE_PRED)) : 0.0) +#define CURRMSEPREDNUM(tp) TPPREDNUM(&(tp),TOT_MSE_PRED) +#define CURRMAEPREDNUM(tp) TPPREDNUM(&(tp),TOT_MAE_PRED) + + +void +InitThruputPrediction(struct thruput_pred *tp); + + +void +UpdateThruputPrediction(struct thruput_pred *tp, + float value, + time_t update_time); + +#define GAIN (0.05) +#define LN_GAIN (0.9) + +#define EL(a,i,j,n) ((a)[(i)*(n)+(j)]) diff --git a/src/nws_portability/Include/protocol.h b/src/nws_portability/Include/protocol.h new file mode 100644 index 0000000000..3aa1d6990c --- /dev/null +++ b/src/nws_portability/Include/protocol.h @@ -0,0 +1,210 @@ +/* $Id$ */ + + +#ifndef PROTOCOL_H +#define PROTOCOL_H + + +/* + * This module defines functions useful in establishing and maintaining + * connections to other processes on local or remote hosts. The name is an + * anachronism. + */ + + +#include /* pid_t */ +#include "dnsutil.h" /* IPAddress */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* A definition for socket call-back functions (see NotifyOnDisconnection()). */ +typedef void (*SocketFunction)(Socket); + + +/* + * Attempts to establish a connection to the server listening to #addr#:#port#. + * If successful within #timeOut# seconds, returns 1 and sets #sock# to the + * socket bound to the connection, else returns 0. A #timeOut# of 0 will + * disable timeouts while a negative value will use adaptive timeouts. + */ +int +CallAddr(IPAddress addr, + short port, + Socket *sock, + double timeOut); + + +/* + * Closes connections opened via calls to this module's functions. Each + * parameter is a boolean value indicated whether that type of connection + * should be included in those closed. + */ +void +CloseConnections(int closeEars, + int closePipes, + int closeSockets); +#define CloseAllConnections() CloseConnections(1, 1, 1) + + +/* + * Tests all connections opened via calls to this module's functions and + * closes any that are no longer connected. Returns the number of connections + * closed. + */ +int +CloseDisconnections(void); + + +/** + * Tears down #sock#. If #waitForPeer# is non-zero, the function waits this + * many seconds for the host on the other end to close the connection and fails + * if no such close is detected. If this parameter is zero, the function + * closes #sock# immediately. Returns 1 and sets #sock# to NO_SOCKET if + * successful, else returns 0. + */ +int +CloseSocket(Socket *sock, + int waitForPeer); +#define DROP_SOCKET(sock) CloseSocket(sock, 0) + + +/** + * Removed all records of #sock# from our FD_SETs + */ +void +ClearSocket(Socket sock); + +/* +** Spawns a new process, a duplicate of the running one. Returns 1 if +** successful, 0 otherwise. Returns in #pid# a 0 to the child process and the +** process id of the child to the parent. Both processes are given a pair of +** connections in the Socket parameters that can be used to communicate between +** the parent and child. The parent process should send information to the +** child via #parentToChild# and receive information via #childToParent#; the +** child reads from the former and writes to the latter. The parameters may be +** NULL indicating that communication is unidirectional (one parameter NULL), +** or that no communication will take place (both NULL). +*/ +int +CreateLocalChild(pid_t *pid, + Socket *parentToChild, + Socket *childToParent); + + +/* +** Attempts to bind to any port between #startingPort# and #endingPort#, +** inclusive. If successful, returns 1 and sets #ear# to the bound socket and +** #earPort# to the port to which it is bound, else returns 0. +*/ +int +EstablishAnEar(unsigned short startingPort, + unsigned short endingPort, + Socket *ear, + unsigned short *earPort); + + +/** + * Checks all connections established via calls to this module for + * incoming messages. If one is detected within #timeOut# seconds, + * returns 1, sets #sd# to the socket containing the message, and sets + * #ldap# to the type of message (0 if NWS, 1 if LDAP). If no message + * detected, returns 0. + * + * NOTE: you have to use SocketIsAvailable to notify IncomingRequest that + * the socket is again available (once the socket is been returned from + * IncomingRequest) */ +int +IncomingRequest(double timeOut, + Socket *sd, + int *ldap); + + +/** + * When a socket is returned by IncomingRequest, that socket won't be + * listen till this function is called. + * Return 0 upon failure. + */ +int +SocketIsAvailable(Socket sd); + +/** + * Tell NWS that a specific socket is still in use and IncomingRequest + * shouldn't listen to it. + */ +int +SocketInUse(Socket sd); + +/* +** Returns 1 or 0 depending on whether or not #sd# is connected to another +** process. +*/ +int +IsOkay(Socket sd); + +/** + * returns 1 or 0 depending on wheter the socket is a pipe or not + */ +int +IsPipe(Socket sd); + + +/* +** Registers a function that should be called whenever a socket is disconnected, +** either directly via a call to CloseSocket(), or indirectly because the peer +** termintes the connection. The function is passed the closed socket after it +** has been closed. +*/ +void +NotifyOnDisconnection(SocketFunction notifyFn); + + +/* +** Pass socket #sock# along to child #child# -- call after a successful call +** to CreateLocalChild(). The parent process will no longer listen for +** activity on #sock#. Closing the socket will be put off until after the +** child dies, just in case the parent and child share descriptors. +*/ +int +PassSocket(Socket *sock, + pid_t child); + + +/** + * Receives #byteSize# bytes from connection #sd# and stores them in the + * memory referenced by #bytes#. The caller must assure that #bytes# is at + * least #byteSize# bytes long. Returns 1 if successful within #timeOut# + * seconds, else 0. If #timeOut# is zero, timeout are disabled alltogether. + */ +int +RecvBytes(Socket sd, + void *byte, + size_t byteSize, + double timeOut); + +/* + * Sends #bytesSize# bytes from the memory pointed to by #bytes# on connection + * #sd#. Returns 1 if successful within #timeOut# seconds, else 0. + * If #timeOut# is zero, timeout are disabled alltogether.. + */ +int +SendBytes(Socket sd, + const void *bytes, + size_t byteSize, + double timeOut); + + +/* +** A signal handler for dealing with signals (specifically SIGPIPE) that +** indicate a bad socket. +*/ +void +SocketFailure(int sig); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/nws_portability/Include/run_mean.h b/src/nws_portability/Include/run_mean.h new file mode 100644 index 0000000000..7fc9e1d0ce --- /dev/null +++ b/src/nws_portability/Include/run_mean.h @@ -0,0 +1,13 @@ +/* $Id$ */ + +#if !defined(RUN_MEAN_H) +#define RUN_MEAN_H + +#include "fbuff.h" + +char *InitRunMean(fbuff series, fbuff time_stamps, char *params); +void FreeRunMean(char *state); +void UpdateRunMean(char *state, double ts, double value); +int ForcRunMean(char *state, double *v); +#endif + diff --git a/src/nws_portability/Include/strutil.h b/src/nws_portability/Include/strutil.h new file mode 100644 index 0000000000..06a7e558fe --- /dev/null +++ b/src/nws_portability/Include/strutil.h @@ -0,0 +1,94 @@ +/* $Id$ */ + + +#ifndef STRUTIL_H +#define STRUTIL_H + + +/* +** This module defines some useful routines for maniputing strings. +*/ + +#include /* strlen() strncpy() */ +#include /* size_t */ + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* +** Replaces the characters in #string# with their lower- or upper-case +** equivalents. #toWhatCase# specifies whether the result to be ENTIRELY +** UPPER, entirely lower, iNITIAL lOWER, or Initial Upper. +*/ +typedef enum {ALL_LOWER, ALL_UPPER, INITIAL_LOWER, INITIAL_UPPER} CaseTypes; +void +strcase(char *string, + CaseTypes toWhatCase); + + +/* +** Returns 1 or 0 depending on whether or not the first #len# characters of +** #string# matches #pattern#, which may contain wildcard characters (*). +*/ +int +strnmatch(const char *string, + const char *pattern, + size_t len); +#define strmatch(string,pattern) strnmatch(string, pattern, strlen(string)) + + +/* +** Copies a "token" -- a series of characters deliminated by one of the chars +** in #delim# -- from #source# to the #len#-long string #dest#. Terminates +** #dest# with a null character. Returns the position within #source# of the +** character after the token in #end#. Skips any leading delimiters in +** #source#. Returns 0 if the end of source is reached without finding any +** non-delimiter characters, 1 otherwise. +*/ +int +strntok(char *dest, + const char *source, + int len, + const char *delim, + const char **end); +#define GETTOK(dest,source,delim,end) strntok(dest,source,sizeof(dest),delim,end) +#define GETWORD(dest,source,end) GETTOK(dest,source," \t\n",end) + + +/* + * Define strnlen in case there is no such a function in the library + * (sometimes there is not the definition in the include so we define it + * anyway). + */ +size_t +strnlen(const char *s, size_t maxlen); + +/* +** Calls strncpy() passing #dest#, #src#, and #len#, then places a terminating +** character in the last (len - 1) byte of #dest#. +*/ +#define zstrncpy(dest,src,len) \ + do {strncpy(dest, src, len); dest[len - 1] = '\0'; if (1) break;} while (0) +#define SAFESTRCPY(dest,src) zstrncpy(dest, src, sizeof(dest)) + + +/* +** Catenates the #count#-long set of source strings into #dest#. Copies at +** most #len# characters, including the null terminator. +*/ +int +vstrncpy(char *dest, + size_t len, + int count, + ...); + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/src/nws_portability/Include/timeouts.h b/src/nws_portability/Include/timeouts.h new file mode 100644 index 0000000000..3783647fac --- /dev/null +++ b/src/nws_portability/Include/timeouts.h @@ -0,0 +1,59 @@ +/* $Id$ */ + +#ifndef TIMEOUTS_H +#define TIMEOUTS_H + +/* + * This modules defines functions used to keep track of adaptive + * timeouts. You can use these functions to (for example) keep track of + * how long you should wait to receive a packet from a remote host. + */ + +#include "dnsutil.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * We reserve timeouts for receive and send packets, connection time and + * we leave space for 3 user definable timeouts. + */ +typedef enum {RECV, SEND, CONN, USER1, USER2, USER3} timeoutTypes; +#define TIMEOUT_TYPES_NUMBER 6 + +/** + * Sets the bounds on a specific class of timeouts. + */ +void +SetDefaultTimeout(timeoutTypes type, double min, double max); + +/** + * get the current defaults timeouts + */ +void +GetDefaultTimeout(timeoutTypes type, double *min, double *max); + + +/** + * Returns the current timeouts value for the specific class given the + * IPAddress and the #size# of the data to be sent/received. If #size# is + * <= 0 it will be ignored. + */ +double +GetTimeOut(timeoutTypes type, IPAddress addr, long size); + +/** + * Reports how long it took to perform the action (say send or receive a + * packet) last time and if it timed out and how many bytes were + * sent/received (if applicable). + */ +void +SetTimeOut(timeoutTypes type, IPAddress addr, double duration, long size, int timedOut); + + +#ifdef __cplusplus +} +#endif + +#endif /* TIMEOUTS_H */ diff --git a/src/nws_portability/Makedefs.in b/src/nws_portability/Makedefs.in new file mode 100644 index 0000000000..ff14ad2b34 --- /dev/null +++ b/src/nws_portability/Makedefs.in @@ -0,0 +1,45 @@ +# +# autoconf variables for the Portability library +# +# $Id$ + +# System we configured for +configured = @host@ + +# Distribution variables +TOP = @TOP@ +DIST_NAME = portability.tar +DIST_ROOT = $(TOP)/Portability + +# System-dependent values determined by the configuration script. +AR = @AR@ +ARFLAGS = @ARFLAGS@ +CC = @CC@ +CFLAGS = @CFLAGS@ +INCLUDES = @INCLUDES@ +LDFLAGS = @LDFLAGS@ +PROFILE = @PROFILE@ +RANLIB = @RANLIB@ +INSTALL = @TOP@/install-sh -c +RM = @RM@ +CP = @CP@ +TAR = @TAR@ +CTAGS = @CTAGS@ +#VERSION = @VERSION@ + +# where we put the objects, libraries, binaries (for the build process) etc ... +builddir = @NWS_TOP@/build-${configured} +buildbindir = $(builddir)/bin +buildlibdir = $(builddir)/lib +buildincdir = $(builddir)/include +buildobjdir = $(builddir)/obj +# ... and for the install process +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +libdir = @libdir@ +incdir = @includedir@ +mandir = @mandir@ + +# which directories we are going to compile +SUBDIRS = Include Forecast diff --git a/src/nws_portability/Makefile b/src/nws_portability/Makefile new file mode 100755 index 0000000000..7794cc3638 --- /dev/null +++ b/src/nws_portability/Makefile @@ -0,0 +1,95 @@ +# +# Makefile for the Portability library +# +# $Id$ + +include Makedefs + +# extra files to be put into the distribution +DIST_FILES = Makedefs.in \ + Makefile \ + config.guess \ + config.sub \ + install-sh \ + configure + +# these are the targets +LIBRARY = $(buildlibdir)/libNwsPortability.a + +# what we are going to put in the library +OBJS = $(buildobjdir)/diagnostic.o \ + $(buildobjdir)/dnsutil.o \ + $(buildobjdir)/formatutil.o \ + $(buildobjdir)/osutil.o \ + $(buildobjdir)/messages.o \ + $(buildobjdir)/strutil.o \ + $(buildobjdir)/timeouts.o \ + $(buildobjdir)/protocol.o + + +.PHONY: clean confclean distclean precondition dist all common + +all: precondition common $(OBJS) + $(AR) $(ARFLAGS) $(LIBRARY) $(OBJS) + $(RANLIB) $(LIBRARY) + +common: + @for subdir in $(SUBDIRS); do \ + (cd $$subdir && $(MAKE) all) || exit $$? ; done + +clean: + @for subdir in $(SUBDIRS); do \ + (cd $$subdir && $(MAKE) clean) || exit $$? ; done + @$(RM) -f $(OBJS) + +confclean: + @echo "Removing configurations files ..." + @$(RM) -f Makedefs Include/config_portability.h config.status config.log config.cache + +distclean: confclean + @echo "Removing build directories ..." + @$(RM) -rf $(builddir) $(DIST_NAME) + +dist: + @$(RM) -rf $(DIST_ROOT) $(DIST_NAME) + @$(INSTALL) -d $(DIST_ROOT) + @for subdir in $(SUBDIRS); do \ + (cd $$subdir && $(MAKE) dist) || exit $$? ; done + @$(CP) $(DIST_FILES) $(DIST_ROOT) + @$(CP) *.c $(DIST_ROOT) + @$(TAR) cf $(TOP)/$(DIST_NAME) Portability + @$(RM) -rf $(DIST_ROOT) + +.PHONY: install +install: all + @$(INSTALL) -d $(prefix) + @$(INSTALL) -d $(exec_prefix) + @$(INSTALL) -d $(bindir) + @$(INSTALL) -d $(libdir) + @$(INSTALL) -d $(incdir) + @$(CP) $(buildbindir)/* $(bindir) + @$(CP) $(buildlibdir)/* $(libdir) + @$(CP) $(buildincdir)/* $(incdir) + +tags: + $(CTAGS) -R + +precondition: + @if test `./config.guess` != "$(configured)"; then \ + echo "Portability was configured for $(configured): run make confclean and reconfigure for the `./config.guess`!";\ + exit 1; fi + @$(INSTALL) -d $(buildobjdir) + @$(INSTALL) -d $(buildlibdir) + @$(INSTALL) -d $(buildincdir) + @$(INSTALL) -d $(buildbindir) + +Makedefs: Makedefs.in config.status + ./config.status + +config.status: configure + ./configure + +$(buildobjdir)/%.o : %.c Include/%.h Include/config_portability.h + $(CC) $(INCLUDES) $(CFLAGS) -g -c $< -o $@ + + diff --git a/src/nws_portability/README b/src/nws_portability/README new file mode 100755 index 0000000000..7aac2ff6f3 --- /dev/null +++ b/src/nws_portability/README @@ -0,0 +1,40 @@ +$Id$ + +Portability +----------- + +Portability is a library used by the Network Weather System (NWS). It +aims to be portable and to mask sockets, threads and other low level, +system dependent calls. It can be used independetly from the NWS, but +documentation is quite scarse: the header files will be your best +friends. + +Compiling and installing +------------------------ + +To compile Portability run + ./configure + make all +and you will find a library libNwsPortability.a and the needed file in +the ./build-/{lib,include}. You can install them with + make install + +You can configure where to install library and includes using --prefix +etc ... (./configure --help for the options). + +You can configure Portability to be used with threads (--enable-threads) +and to disable sigalarm (--disable-sigalarm). + + + +Adaptive Timeouts +----------------- + +Some of Portability's functions take a timeout as argument. Portability +provides a way to use adaptive timeouts: look at timeouts.h for the +interface. In short you can use GetTimeOut to get a timeout estimate that +is more accurate the more information you give Portability through +SetTimeOut. If you call the Send{MessageAnd}Data with a timeout of -1 +you'll get the adaptive timeouts without having to tinker with Get/Set +TimeOut. + diff --git a/src/nws_portability/config.guess b/src/nws_portability/config.guess new file mode 100755 index 0000000000..ed2e03b7f2 --- /dev/null +++ b/src/nws_portability/config.guess @@ -0,0 +1,1321 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002 Free Software Foundation, Inc. + +timestamp='2002-03-20' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c ; + for c in cc gcc c89 c99 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $dummy.c $dummy.o $dummy.rel ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + 2-1307) + UNAME_MACHINE="alphaev68" + ;; + esac + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy + fi ;; + esac + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:3*) + echo i386-pc-interix3 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + rm -f $dummy.c + test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + rm -f $dummy.c + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/src/nws_portability/config.sub b/src/nws_portability/config.sub new file mode 100644 index 0000000000..f3657978c7 --- /dev/null +++ b/src/nws_portability/config.sub @@ -0,0 +1,1443 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002 Free Software Foundation, Inc. + +timestamp='2002-03-07' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dsp16xx \ + | fr30 \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el | mips64vr4300 \ + | mips64vr4300el | mips64vr5000 | mips64vr5000el \ + | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ + | mipsisa32 | mipsisa64 \ + | mn10200 | mn10300 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[34] | sh[34]eb | shbe | shle | sh64 \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c54x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | m32r-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ + | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ + | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3d) + basic_machine=alpha-cray + os=-unicos + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + windows32) + basic_machine=i386-pc + os=-windows32-msvcrt + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh3eb | sh4eb) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/src/nws_portability/configure b/src/nws_portability/configure new file mode 100755 index 0000000000..1ac4ddfd55 --- /dev/null +++ b/src/nws_portability/configure @@ -0,0 +1,2684 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --enable-debug include debugging info when compiling" +ac_help="$ac_help + --enable-threads test for threads support" +ac_help="$ac_help + --disable-sigalarm don't use SIGALRM" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +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' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # 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 ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$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" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) 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) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$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) + 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 ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --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 "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# 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 + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=protocol.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + 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 "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# 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 "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + + +# Checks the host we are running on. +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 + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:560: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + + +# Set paths and common variables and NWS top directory (if compiling with +# NWS) +if test -n "$TOP"; then + NWS_TOP="${TOP}" +else + NWS_TOP=`pwd` +fi +TOP=`pwd` +INCLUDES="-I${TOP}/Include" +ARFLAGS="cr" +test_debug="no" +test_thread="no" +use_alarm_signal="no" + +# Set default for CFLAGS +CFLAGS="-DHAVE_CONFIG_H" + +# test for command line options +# Check whether --enable-debug or --disable-debug was given. +if test "${enable_debug+set}" = set; then + enableval="$enable_debug" + if test "${withval}" != "yes"; then + test_debug="yes" + fi +fi + + +# Check whether --enable-threads or --disable-threads was given. +if test "${enable_threads+set}" = set; then + enableval="$enable_threads" + if test "${enableval}" != "no"; then + test_thread="yes" + fi +fi + + +# Check whether --enable-sigalarm or --disable-sigalarm was given. +if test "${enable_sigalarm+set}" = set; then + enableval="$enable_sigalarm" + if test "${enableval}" != "no"; then + use_alarm_signal="yes" + cat >> confdefs.h <<\EOF +#define USE_ALARM_SIGNAL 1 +EOF + + fi +else + cat >> confdefs.h <<\EOF +#define USE_ALARM_SIGNAL 1 +EOF + + use_alarm_signal="yes" +fi + + +# Checks for programs. +# Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:640: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$AR" in + /*) + ac_cv_path_AR="$AR" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_AR="$AR" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_AR="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +AR="$ac_cv_path_AR" +if test -n "$AR"; then + echo "$ac_t""$AR" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:675: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:705: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:756: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:788: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 799 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:804: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:830: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:835: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:863: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&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 + +# Setting up debug options +if test "${test_debug}" = "yes"; then + CFLAGS="${CFLAGS} -g " +else + CFLAGS="${CFLAGS} -O2" + if test "${GCC}" = "yes" ; then + CFLAGS="${CFLAGS} -finline-functions" + fi +fi + +# 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 +# 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 $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:916: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/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 + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +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 "$ac_t""$INSTALL" 1>&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_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:971: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "rm", so it can be a program name with args. +set dummy rm; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1001: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$RM" in + /*) + ac_cv_path_RM="$RM" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_RM="$RM" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_RM="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +RM="$ac_cv_path_RM" +if test -n "$RM"; then + echo "$ac_t""$RM" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "cp", so it can be a program name with args. +set dummy cp; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1036: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_CP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$CP" in + /*) + ac_cv_path_CP="$CP" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_CP="$CP" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_CP="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +CP="$ac_cv_path_CP" +if test -n "$CP"; then + echo "$ac_t""$CP" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "tar", so it can be a program name with args. +set dummy tar; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1071: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_TAR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$TAR" in + /*) + ac_cv_path_TAR="$TAR" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_TAR="$TAR" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_TAR="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +TAR="$ac_cv_path_TAR" +if test -n "$TAR"; then + echo "$ac_t""$TAR" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "ctags", so it can be a program name with args. +set dummy ctags; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1106: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_CTAGS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$CTAGS" in + /*) + ac_cv_path_CTAGS="$CTAGS" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_CTAGS="$CTAGS" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_CTAGS="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +CTAGS="$ac_cv_path_CTAGS" +if test -n "$CTAGS"; then + echo "$ac_t""$CTAGS" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +# Set compiler and linker switches +if test "${CC}" = "gcc"; then + # Adding all annoying warning compilers message + CFLAGS="${CFLAGS} -Wall -pedantic -Wshadow -Wpointer-arith -Wwrite-strings" + # Extract the first word of "gprof", so it can be a program name with args. +set dummy gprof; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1146: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_PROFILE'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$PROFILE" in + /*) + ac_cv_path_PROFILE="$PROFILE" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_PROFILE="$PROFILE" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_PROFILE="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +PROFILE="$ac_cv_path_PROFILE" +if test -n "$PROFILE"; then + echo "$ac_t""$PROFILE" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + # Extract the first word of "prof", so it can be a program name with args. +set dummy prof; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1182: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_PROFILE'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$PROFILE" in + /*) + ac_cv_path_PROFILE="$PROFILE" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_PROFILE="$PROFILE" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_PROFILE="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +PROFILE="$ac_cv_path_PROFILE" +if test -n "$PROFILE"; then + echo "$ac_t""$PROFILE" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +fi + +# Checks for libraries. +echo $ac_n "checking for inet_ntoa in -lnsl""... $ac_c" 1>&6 +echo "configure:1218: checking for inet_ntoa in -lnsl" >&5 +ac_lib_var=`echo nsl'_'inet_ntoa | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lnsl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + +echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 +echo "configure:1265: checking for socket in -lsocket" >&5 +ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lsocket $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + +if test "${test_thread}" = "yes"; then + echo $ac_n "checking for pthread_mutex_lock in -lpthread""... $ac_c" 1>&6 +echo "configure:1313: checking for pthread_mutex_lock in -lpthread" >&5 +ac_lib_var=`echo pthread'_'pthread_mutex_lock | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lpthread $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo pthread | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + +fi + +# Checks for header files and symbols declared in headers. +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:1363: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1384: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1401: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1418: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1443: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1456: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +cat > conftest.$ac_ext < +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /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 < +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:1523: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 +echo "configure:1547: checking for sys/wait.h that is POSIX.1 compatible" >&5 +if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#ifndef WEXITSTATUS +#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +#endif +#ifndef WIFEXITED +#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif +int main() { +int s; +wait (&s); +s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; +; return 0; } +EOF +if { (eval echo configure:1568: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_sys_wait_h=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_sys_wait_h=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6 +if test $ac_cv_header_sys_wait_h = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_SYS_WAIT_H 1 +EOF + +fi + +for ac_hdr in arpa/inet.h errno.h netdb.h netinet/in.h stddef.h stdlib.h string.h strings.h sys/socket.h sys/time.h unistd.h math.h inttypes.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1592: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1602: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + +if test "${test_thread}" = "yes"; then + for ac_hdr in pthread.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1633: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1643: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + +fi +echo $ac_n "checking for uint32_t""... $ac_c" 1>&6 +echo "configure:1671: checking for uint32_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_uint32_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])uint32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_uint32_t=yes +else + rm -rf conftest* + ac_cv_type_uint32_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_uint32_t" 1>&6 +if test $ac_cv_type_uint32_t = no; then + cat >> confdefs.h <<\EOF +#define uint32_t unsigned long +EOF + +fi + + + + + + +# The third parameter to getpeername() is a pointer to socklen_t, size_t, or +# int on various systems. Worse yet, some systems define socklen_t but use a +# different type in the getpeername() prototype, and Solaris Intel defines +# Psocklen_t, which is a pointer to either socklen_t or void. We use SOCKLEN_T +# in the NWS code, defining it the proper type for the system. +cat > conftest.$ac_ext < + #include +int main() { +extern int getpeername(int socket, struct sockaddr *addr, socklen_t *len); +; return 0; } +EOF +if { (eval echo configure:1722: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + SOCKLEN_T=socklen_t +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat > conftest.$ac_ext < + #include +int main() { +extern int getpeername(int socket, struct sockaddr *addr, size_t *len); +; return 0; } +EOF +if { (eval echo configure:1738: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + SOCKLEN_T=size_t +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat > conftest.$ac_ext < + #include +int main() { +socklen_t len; Psocklen_t lenP = &len; + (void)getpeername(0, 0, lenP); +; return 0; } +EOF +if { (eval echo configure:1755: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + SOCKLEN_T=socklen_t +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + SOCKLEN_T=int + +fi +rm -f conftest* + +fi +rm -f conftest* + +fi +rm -f conftest* + + +# Checks for typedefs, structures, and compiler characteristics. +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:1776: checking for working const" >&5 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if { (eval echo configure:1830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_const=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + +echo $ac_n "checking for mode_t""... $ac_c" 1>&6 +echo "configure:1851: checking for mode_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_mode_t=yes +else + rm -rf conftest* + ac_cv_type_mode_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_mode_t" 1>&6 +if test $ac_cv_type_mode_t = no; then + cat >> confdefs.h <<\EOF +#define mode_t int +EOF + +fi + +echo $ac_n "checking for pid_t""... $ac_c" 1>&6 +echo "configure:1884: checking for pid_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_pid_t=yes +else + rm -rf conftest* + ac_cv_type_pid_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_pid_t" 1>&6 +if test $ac_cv_type_pid_t = no; then + cat >> confdefs.h <<\EOF +#define pid_t int +EOF + +fi + +echo $ac_n "checking for size_t""... $ac_c" 1>&6 +echo "configure:1917: checking for size_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_size_t=yes +else + rm -rf conftest* + ac_cv_type_size_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_size_t" 1>&6 +if test $ac_cv_type_size_t = no; then + cat >> confdefs.h <<\EOF +#define size_t unsigned +EOF + +fi + +echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 +echo "configure:1950: checking whether time.h and sys/time.h may both be included" >&5 +if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +int main() { +struct tm *tp; +; return 0; } +EOF +if { (eval echo configure:1964: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_time=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_time=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_time" 1>&6 +if test $ac_cv_header_time = yes; then + cat >> confdefs.h <<\EOF +#define TIME_WITH_SYS_TIME 1 +EOF + +fi + +echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 +echo "configure:1985: checking whether struct tm is in sys/time.h or time.h" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +int main() { +struct tm *tp; tp->tm_sec; +; return 0; } +EOF +if { (eval echo configure:1998: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_tm=time.h +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_tm=sys/time.h +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_tm" 1>&6 +if test $ac_cv_struct_tm = sys/time.h; then + cat >> confdefs.h <<\EOF +#define TM_IN_SYS_TIME 1 +EOF + +fi + + +# Checks for library functions. +echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 +echo "configure:2021: checking return type of signal handlers" >&5 +if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#ifdef signal +#undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int main() { +int i; +; return 0; } +EOF +if { (eval echo configure:2043: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_type_signal=void +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_type_signal=int +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_type_signal" 1>&6 +cat >> confdefs.h <&6 +echo "configure:2062: checking for vprintf" >&5 +if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char vprintf(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_vprintf) || defined (__stub___vprintf) +choke me +#else +vprintf(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_vprintf=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_vprintf=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_VPRINTF 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +if test "$ac_cv_func_vprintf" != yes; then +echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 +echo "configure:2114: checking for _doprnt" >&5 +if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char _doprnt(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub__doprnt) || defined (__stub____doprnt) +choke me +#else +_doprnt(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2142: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func__doprnt=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func__doprnt=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_DOPRNT 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +fi + + +if test "$use_alarm_signal" != "no"; then + echo $ac_n "checking for alarm""... $ac_c" 1>&6 +echo "configure:2169: checking for alarm" >&5 +if eval "test \"`echo '$''{'ac_cv_func_alarm'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char alarm(); + +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_alarm) || defined (__stub___alarm) +choke me +#else +alarm(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_alarm=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_alarm=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'alarm`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_ALARM 1 +EOF + +else + echo "$ac_t""no" 1>&6 +{ echo "configure: error: Can't do without alarm!! Try to configure with --disable-sigalarm" 1>&2; exit 1; } +fi + +fi + +for ac_func in endpwent ftruncate gethostbyaddr gethostbyaddr_r gethostbyname gethostname uname gettimeofday inet_aton inet_ntoa memset mkdir select socket strcasecmp strchr strdup strerror sysconf getrusage siginterrupt sighold sigrelse strnlen fileno sqrt +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2225: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 +fi +done + + +# Substitute these variables. + + + + +# the following should be automatically substitute by autoconf but for +# consistency we put them here + + + + + + + + + + + +# Define new variables to substitute. +cat >> confdefs.h <> confdefs.h < confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makedefs Include/config_portability.h:Include/config_portability.h.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@AR@%$AR%g +s%@CC@%$CC%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@RANLIB@%$RANLIB%g +s%@RM@%$RM%g +s%@CP@%$CP%g +s%@TAR@%$TAR%g +s%@CTAGS@%$CTAGS%g +s%@PROFILE@%$PROFILE%g +s%@CPP@%$CPP%g +s%@ARFLAGS@%$ARFLAGS%g +s%@INCLUDES@%$INCLUDES%g +s%@PREFIX_DIR@%$PREFIX_DIR%g +s%@TOP@%$TOP%g +s%@NWS_TOP@%$NWS_TOP%g +s%@uint32_t@%$uint32_t%g +s%@SOCKLEN_T@%$SOCKLEN_T%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/src/nws_portability/configure.in b/src/nws_portability/configure.in new file mode 100644 index 0000000000..74fd55d536 --- /dev/null +++ b/src/nws_portability/configure.in @@ -0,0 +1,186 @@ +# +# configure.in for the Portability library used mainly in NWS +# +# $Id$ +# + +# Process this file with autoconf to produce a configure script. +AC_INIT(protocol.c) +AC_CONFIG_HEADER([Include/config_portability.h:Include/config_portability.h.in]) + +# Checks the host we are running on. +AC_CANONICAL_HOST + +# Set paths and common variables and NWS top directory (if compiling with +# NWS) +if test -n "$TOP"; then + NWS_TOP="${TOP}" +else + NWS_TOP=`pwd` +fi +TOP=`pwd` +INCLUDES="-I${TOP}/Include" +ARFLAGS="cr" +test_debug="no" +test_thread="no" +use_alarm_signal="no" + +# Set default for CFLAGS +CFLAGS="-DHAVE_CONFIG_H" + +# test for command line options +AC_ARG_ENABLE(debug, + [ --enable-debug include debugging info when compiling], + [if test "${withval}" != "yes"; then + test_debug="yes" + fi]) + +AC_ARG_ENABLE(threads, + [ --enable-threads test for threads support], + [if test "${enableval}" != "no"; then + test_thread="yes" + fi]) + +AC_ARG_ENABLE(sigalarm, + [ --disable-sigalarm don't use SIGALRM], + [if test "${enableval}" != "no"; then + use_alarm_signal="yes" + AC_DEFINE(USE_ALARM_SIGNAL) + fi], + [AC_DEFINE(USE_ALARM_SIGNAL) + use_alarm_signal="yes"]) + +# Checks for programs. +AC_PATH_PROG(AR, ar) +AC_PROG_CC +# Setting up debug options +if test "${test_debug}" = "yes"; then + CFLAGS="${CFLAGS} -g " +else + CFLAGS="${CFLAGS} -O2" + if test "${GCC}" = "yes" ; then + CFLAGS="${CFLAGS} -finline-functions" + fi +fi + +AC_PROG_INSTALL +AC_PROG_RANLIB +AC_PATH_PROG(RM, rm) +AC_PATH_PROG(CP, cp) +AC_PATH_PROG(TAR, tar) +AC_PATH_PROG(CTAGS, ctags) + +# Set compiler and linker switches +if test "${CC}" = "gcc"; then + # Adding all annoying warning compilers message + CFLAGS="${CFLAGS} -Wall -pedantic -Wshadow -Wpointer-arith -Wwrite-strings" + AC_PATH_PROG(PROFILE, gprof) +else + AC_PATH_PROG(PROFILE, prof) +fi + +# Checks for libraries. +dnl LDFLAGS="${LDFLAGS} -lm" +AC_CHECK_LIB(nsl, inet_ntoa) +AC_CHECK_LIB(socket, socket) +if test "${test_thread}" = "yes"; then + AC_CHECK_LIB(pthread, pthread_mutex_lock) +fi + +# Checks for header files and symbols declared in headers. +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS([arpa/inet.h errno.h netdb.h netinet/in.h stddef.h stdlib.h string.h strings.h sys/socket.h sys/time.h unistd.h math.h inttypes.h]) +if test "${test_thread}" = "yes"; then + AC_CHECK_HEADERS(pthread.h) +fi +dnl TYPES is only for autoconf2.50 and 2.13 has a broken TYPE: cheap workaround +dnl AC_CHECK_TYPES(uint32_t) +AC_CHECK_TYPE(uint32_t, unsigned long) + +dnl IPADDRESS="unsigned int" +dnl if test "${SIZEOF_LONG}" = "4" ; then +dnl IPADDRESS="unsigned long" +dnl fi + +dnl end workaround + + + +# The third parameter to getpeername() is a pointer to socklen_t, size_t, or +# int on various systems. Worse yet, some systems define socklen_t but use a +# different type in the getpeername() prototype, and Solaris Intel defines +# Psocklen_t, which is a pointer to either socklen_t or void. We use SOCKLEN_T +# in the NWS code, defining it the proper type for the system. +AC_TRY_COMPILE( + [#include + #include ], + [extern int getpeername(int socket, struct sockaddr *addr, socklen_t *len);], + SOCKLEN_T=socklen_t, + AC_TRY_COMPILE( + [#include + #include ], + [extern int getpeername(int socket, struct sockaddr *addr, size_t *len);], + SOCKLEN_T=size_t, + AC_TRY_COMPILE( + [#include + #include ], + [socklen_t len; Psocklen_t lenP = &len; + (void)getpeername(0, 0, lenP);], + SOCKLEN_T=socklen_t, + SOCKLEN_T=int + ) + ) +) + + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_MODE_T +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_HEADER_TIME +AC_STRUCT_TM + +# Checks for library functions. +dnl AC_FUNC_FORK +dnl AC_FUNC_MALLOC +dnl AC_FUNC_STAT +AC_TYPE_SIGNAL +AC_FUNC_VPRINTF + +if test "$use_alarm_signal" != "no"; then + AC_CHECK_FUNC(alarm, AC_DEFINE(HAVE_ALARM), AC_MSG_ERROR([Can't do without alarm!! Try to configure with --disable-sigalarm])) +fi + +AC_CHECK_FUNCS([endpwent ftruncate gethostbyaddr gethostbyaddr_r gethostbyname gethostname uname gettimeofday inet_aton inet_ntoa memset mkdir select socket strcasecmp strchr strdup strerror sysconf getrusage siginterrupt sighold sigrelse strnlen fileno sqrt]) + +# Substitute these variables. +AC_SUBST(AR) +AC_SUBST(ARFLAGS) +AC_SUBST(INCLUDES) +AC_SUBST(PREFIX_DIR) +# the following should be automatically substitute by autoconf but for +# consistency we put them here +AC_SUBST(CC) +AC_SUBST(CFLAGS) +AC_SUBST(LDFLAGS) +AC_SUBST(RM) +AC_SUBST(TAR) +AC_SUBST(CP) +AC_SUBST(CTAGS) +AC_SUBST(TOP) +AC_SUBST(NWS_TOP) +AC_SUBST(uint32_t) + +# Define new variables to substitute. +AC_DEFINE_UNQUOTED(SOCKLEN_T, ${SOCKLEN_T}) +AC_SUBST(SOCKLEN_T) + +dnl AC_DEFINE_UNQUOTED(IPADDRESS, ${IPADDRESS}) +dnl AC_SUBST(IPADDRESS) + +AC_DEFINE_UNQUOTED(TOP, "$TOP") + + +AC_OUTPUT([Makedefs]) diff --git a/src/nws_portability/diagnostic.c b/src/nws_portability/diagnostic.c new file mode 100644 index 0000000000..533c2180e2 --- /dev/null +++ b/src/nws_portability/diagnostic.c @@ -0,0 +1,129 @@ +/* $Id$ */ + +#include "config_portability.h" + +#include +#include +#include +#include +#include +#include + +#include "diagnostic.h" +#include "osutil.h" +#include "strutil.h" + +#define MAXRECORDS 2500 + +static FILE *diagDestinations[] = + {DIAGSUPPRESS, DIAGSUPPRESS, DIAGSUPPRESS, + DIAGSUPPRESS, DIAGSUPPRESS, DIAGSUPPRESS}; +static long recordCounts[] = + {0, 0, 0, 0, 0, 0}; +static void *lock = NULL; /* mutex for this modules */ + +/* we look quite extensively because I'm not quite sure what fprintf will + * do if the FILE* changes on the way */ +static void +PrintDiagnostic(DiagLevels level, + const char *message, + va_list arguments) { + + static const char *level_tags[] = {"", "", "Warning: ", "Error: ", "Fatal: ", "Debug: " }; + + /* we need a lock because we write recordCounts and we use + * diagDestinations[] */ + if (GetNWSLock(&lock) == 0) { + fprintf(stderr, "PrintDiagnostic: Error: Couldn't obtain the lock\n"); + } + if(diagDestinations[level] != DIAGSUPPRESS) { + if( (recordCounts[level]++ >= MAXRECORDS) && + (diagDestinations[level] != stdout) && + (diagDestinations[level] != stderr) ) { + /* We want to avoid filling up the disk space when the + * system is running for weeks at a time. It might be + * nice to save the old file under another name (maybe in + * /tmp), then reopen. That requires changing the + * DirectDiagnostics() interface to take a file name + * instead of a FILE *. */ + rewind(diagDestinations[level]); + recordCounts[level] = 0; + } + + fprintf(diagDestinations[level], "%.0f %d ", CurrentTime(), (int)getpid()); + fprintf(diagDestinations[level], level_tags[level]); + vfprintf(diagDestinations[level], message, arguments); + fflush(diagDestinations[level]); + } + if (ReleaseNWSLock(&lock) == 0) { + fprintf(stderr, "PrintDiagnostic: Error: Couldn't release the lock\n"); + } +} + + +void +DirectDiagnostics(DiagLevels level, + FILE *whereTo) { + +#ifdef HAVE_FILENO + int f = 0; + + /* just an extra check */ + if (whereTo != NULL) { + f = fileno(whereTo); + } + if (f < 0) { + PrintDiagnostic(DIAGERROR, "DirectDiagnostic: fileno failed", NULL); + return; + } +#endif + GetNWSLock(&lock); + diagDestinations[level] = whereTo; + ReleaseNWSLock(&lock); +} + + +FILE * +DiagnosticsDirection(DiagLevels level) { + return diagDestinations[level]; +} + + +void +PositionedDiagnostic(DiagLevels level, + const char *fileName, + int line, + const char *message, + ...) { + + va_list arguments; + char *extendedMessage; + + /* we assume that NWS lines won't be past 10 digits */ + extendedMessage = (char *)MALLOC(strnlen(fileName, MAX_FILENAME_LENGTH) + + strnlen(message, MAX_MESSAGE_LENGTH) + 11); + if (extendedMessage == NULL) { + /* out of memory */ + PrintDiagnostic(DIAGERROR, "PositionedDiagnostic: out of memory", NULL); + return; + } + + va_start(arguments, message); + sprintf(extendedMessage, "%s:%d %s", fileName, line, message); + PrintDiagnostic(level, extendedMessage, arguments); + va_end(arguments); + + free(extendedMessage); +} + + +void +Diagnostic(DiagLevels level, + const char *message, + ...) { + va_list arguments; + + va_start(arguments, message); + PrintDiagnostic(level, message, arguments); + va_end(arguments); +} diff --git a/src/nws_portability/dnsutil.c b/src/nws_portability/dnsutil.c new file mode 100644 index 0000000000..39e9a7f557 --- /dev/null +++ b/src/nws_portability/dnsutil.c @@ -0,0 +1,613 @@ +/* $Id$ */ + +#include "config_portability.h" + +#include +#include /* REALLOC() */ +#include +#include /* sometimes required for #include */ +#include /* AF_INET */ +#include /* struct in_addr */ +#include /* inet_addr() inet_ntoa() */ +#include /* {end,set}hostent() gethostby{addr,name}() */ + +#include "diagnostic.h" +#include "osutil.h" +#include "dnsutil.h" +#include "protocol.h" + + +/* +** NOTE: The man pages for {end,set}hostent() seem to imply that endhostent() +** needs/should only be called after sethostent(1). Below, we call +** endhostent() after calling sethostent(0). So far, this hasn't seemed to +** cause any problems, and it also appears to have squished a bug on some +** version of Unix where the O/S DNS cache was losing entries. +*/ + +static void *lock = NULL; /* local lock */ + +/* + * We cache host entries locally to avoid going to the DNS too often. This + * also gets around an old Solaris bug which leaks memory whenever dlopen is + * called (such as on the dynamic DNS lookup library). + * + * Cached values timeout after CACHE_TIMEOUT seconds. + */ +#define CACHE_TIMEOUT 1800 +static unsigned int cacheCount = 0; +static struct hostent **cache = NULL; +static double *cacheTimeout = NULL; + + +/* +** Looks in the name and alias entries of #hostEntry# for a fully-qualified +** name. Returns the fqn if found; otherwise, returns the name entry. +*/ +static const char * +BestHostName(const struct hostent *hostEntry) { + int i; + + if (hostEntry == NULL) { + return NULL; + } + + if (!strchr(hostEntry->h_name, '.')) { + for (i = 0; hostEntry->h_aliases[i] != NULL; i++) { + if (strchr(hostEntry->h_aliases[i], '.')) + return hostEntry->h_aliases[i]; /* found! */ + } + } + + /* If we don't have a fully-qualified name, do the best we can. */ + return hostEntry->h_name; +} + +/* + * free a struct hostent *. + */ +void +FreeStructHostent(struct hostent *toFree) { + int i; + + /* sanity check */ + if (toFree == NULL) { + return; + } + + /* let's start to free */ + if (toFree->h_aliases != NULL) { + for (i=0; toFree->h_aliases[i] != NULL; i++) { + free(toFree->h_aliases[i]); + } + free(toFree->h_aliases); + } + if (toFree->h_name != NULL) { + free(toFree->h_name); + } + if (toFree->h_addr_list != NULL) { + for (i=0; toFree->h_addr_list[i] != NULL; i++) { + free(toFree->h_addr_list[i]); + } + free(toFree->h_addr_list); + } + free(toFree); + + return; +} + +/* + * copy a struct hostent * into a newly allocated struct hostent * that + * you need to free when you are done using. Returns NULL in case of + * errors. + */ +struct hostent * +CopyStructHostent(const struct hostent *orig) { + struct hostent *ret; + int i,j; + + /* sanity check */ + if (orig == NULL) { + return NULL; + } + + ret = (struct hostent *)MALLOC(sizeof(struct hostent)); + if (ret == NULL) { + ERROR("Out of memory\n"); + return NULL; /* out of memory */ + } + memset((void *)ret, 0, sizeof(struct hostent)); + + /* make room for the name */ + ret->h_name = strdup(orig->h_name); + if (ret->h_name == NULL) { + free(ret); + ERROR("Out of memory\n"); + return NULL; /* out of memory */ + } + + /* count aliases and copy them */ + for (i=0; orig->h_aliases != NULL && orig->h_aliases[i] != NULL; i++) { + ; + } + ret->h_aliases = (char **)MALLOC(sizeof(char *) * (i+1)); + if (ret->h_aliases == NULL) { + FreeStructHostent(ret); + ERROR("Out of memory\n"); + return NULL; + } + for (j=0; j < i; j++) { + ret->h_aliases[j] = strdup(orig->h_aliases[j]); + if (ret->h_aliases[j] == NULL) { + FreeStructHostent(ret); + ERROR("Out of memory\n"); + return NULL; + } + } + ret->h_aliases[i] = NULL; + + /* copy the easy stuff */ + ret->h_addrtype = orig->h_addrtype; + ret->h_length = orig->h_length; + + /* copy the addresses */ + for (i=0; orig->h_addr_list != NULL && orig->h_addr_list[i] != NULL; i++) { + ; + } + ret->h_addr_list = (char **)MALLOC(sizeof(struct in_addr *) * (i+1)); + if (ret->h_addr_list == NULL) { + FreeStructHostent(ret); + ERROR("Out of memory\n"); + return NULL; + } + for (j=0; j < i; j++) { + ret->h_addr_list[j] = (char *)MALLOC(ret->h_length + 1); + if (ret->h_addr_list[j] == NULL) { + FreeStructHostent(ret); + ERROR("Out of memory\n"); + return NULL; + } + memcpy(ret->h_addr_list[j], orig->h_addr_list[j], ret->h_length); + } + ret->h_addr_list[i] = NULL; + + /* done */ + return ret; +} + + +/* + * Appends #hostEntry# (not a copy) to the global map cache. + * + * cache is a global structure and need to be protected by locks to be + * thread safe. + */ +void +CacheHostent(struct hostent *hostEntry) { + int ind; + struct hostent **extendedCache; + double *tmp_touts, now; + + + /* sanity check */ + if (hostEntry == NULL) { + return; + } + + /* look for an expired entry */ + now = CurrentTime(); + if (!GetNWSLock(&lock)) { + ERROR("CacheHostent: couldn't obtain the lock\n"); + } + for (ind=0; ind < cacheCount; ind++) { + if (now > cacheTimeout[ind]) { + FreeStructHostent(cache[ind]); + break; + } + } + + if (ind >= cacheCount) { + /* no found, we need to add memory */ + extendedCache = (struct hostent**)REALLOC(cache, sizeof(struct hostent *) * (cacheCount + 1)); + if(extendedCache == NULL) { + ReleaseNWSLock(&lock); + ERROR("Out of memory\n"); + return; + } + cache = extendedCache; + tmp_touts = (double *)REALLOC(cacheTimeout, sizeof(double) * (cacheCount +1)); + if(tmp_touts == NULL) { + ReleaseNWSLock(&lock); + ERROR("Out of memory\n"); + return; + } + cacheTimeout = tmp_touts; + ind = cacheCount++; + } + + cache[ind] = CopyStructHostent(hostEntry); + if (cache[ind] == NULL) { + cacheTimeout[ind] = 1; + } else { + cacheTimeout[ind] = now + CACHE_TIMEOUT; + } + ReleaseNWSLock(&lock); + + return; +} + + +/* + * Searches the DNS mapping cache for #address#, adding a new entry + * if needed. Returns a copy of the the mapping entry, or + * NULL on error. The memory returned needs to be freed. + */ +struct hostent* +LookupByAddress(IPAddress address) { + struct in_addr addr; + struct hostent *tmp, *addrEntry; + struct in_addr **cachedAddr; + int i; + double now; + + /* look if we have it in the cache and it's not expired */ + now = CurrentTime(); + if (!GetNWSLock(&lock)) { + ERROR("LookupByAddress: couldn't obtain the lock\n"); + } + for(i = 0; i < cacheCount; i++) { + if (now > cacheTimeout[i]) { + continue; + } + for(cachedAddr = (struct in_addr**)cache[i]->h_addr_list; + *cachedAddr != NULL; + cachedAddr++) { + if((**cachedAddr).s_addr == address) { + tmp = CopyStructHostent(cache[i]); + ReleaseNWSLock(&lock); + return tmp; + } + } + } + + addr.s_addr = address; + sethostent(0); + tmp = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET); + addrEntry = CopyStructHostent(tmp); + endhostent(); + + ReleaseNWSLock(&lock); + + if(addrEntry != NULL && addrEntry->h_length != sizeof(struct in_addr)) { + /* We don't (yet) handle non-in_addr addresses. */ + FreeStructHostent(addrEntry); + addrEntry = NULL; + } + + /* the NULL case is handled by the functions directly */ + CacheHostent(addrEntry); + + /* addrEntry will need to be freed after */ + return addrEntry; +} + + +/* + * Searches the DNS mapping cache for #name#, adding a new entry if needed. + * Returns a pointer to the mapping entry, or NULL on error. The returned + * value need to be freed. + */ +struct hostent* +LookupByName(const char *name) { + + char **cachedName; + char **extendedAliases; + struct hostent *tmp, *nameEntry; + double now; + int i, listLen; + + /* look in the cache for non expired entry */ + now = CurrentTime(); + if (!GetNWSLock(&lock)) { + ERROR("LookupByName: failed to obtain the lock\n"); + } + for(i = 0; i < cacheCount; i++) { + if (now > cacheTimeout[i]) { + continue; + } + if(strcasecmp(name, cache[i]->h_name) == 0) { + tmp = CopyStructHostent(cache[i]); + ReleaseNWSLock(&lock); + return tmp; + } + for(cachedName = cache[i]->h_aliases; *cachedName != NULL; cachedName++) { + if(strcasecmp(*cachedName, name) == 0) { + tmp = CopyStructHostent(cache[i]); + ReleaseNWSLock(&lock); + return tmp; + } + } + } + + sethostent(0); + tmp = gethostbyname(name); + nameEntry = CopyStructHostent(tmp); + endhostent(); + + ReleaseNWSLock(&lock); + + if(nameEntry == NULL) { + return NULL; + } else if(nameEntry->h_length != sizeof(struct in_addr)) { + FreeStructHostent(nameEntry); + return NULL; /* We don't (yet) handle non-in_addr addresses. */ + } + + /* We extend cached entries' h_aliases lists to include nicknames. */ + for(listLen = 0; nameEntry->h_aliases[listLen] != NULL; listLen++) { + ; + } + extendedAliases = (char **)REALLOC(nameEntry->h_aliases, sizeof(char **) * (listLen + 2)); + if(extendedAliases != NULL) { + extendedAliases[listLen] = strdup(name); + if (extendedAliases[listLen] != NULL) { + extendedAliases[listLen + 1] = NULL; + nameEntry->h_aliases = extendedAliases; + } + } + + /* let's invalidate the old (if there is) entry in the cache */ + if (!GetNWSLock(&lock)) { + ERROR("LookupByName: failed to obtain the lock\n"); + } + for(i = 0; i < cacheCount; i++) { + if (now > cacheTimeout[i]) { + continue; + } + if(strcmp(nameEntry->h_name, cache[i]->h_name) == 0) { + cacheTimeout[i] = 1; + break; + } + } + ReleaseNWSLock(&lock); + + /* update the cache entry */ + CacheHostent(nameEntry); + + /* nameEntry will need to be freed */ + return nameEntry; +} + +/* thread safe */ +IPAddress +Peer(Socket sd) { + struct sockaddr peer; + SOCKLEN_T peer_size = sizeof(peer); + int returnValue = 0; + + if (!IsPipe(sd) && (getpeername(sd, &peer, &peer_size) == 0)) { + if (peer.sa_family == AF_INET) { + returnValue = (((struct sockaddr_in *)&peer)->sin_addr.s_addr); + } + } + + return returnValue; +} + +/* thread safe */ +char * +PeerName_r(Socket sd) { + struct sockaddr peer; + SOCKLEN_T peer_size = sizeof(peer); + char *returnValue; + + if (IsPipe(sd)) { + returnValue = strdup("pipe"); + } else if (getpeername(sd, &peer, &peer_size) < 0) { + returnValue = strdup("unknown"); + } else { + if (peer.sa_family != AF_INET) { + returnValue = strdup("unknown"); + } else { + returnValue = IPAddressImage_r(((struct sockaddr_in *)&peer)->sin_addr.s_addr); + } + } + + if (returnValue == NULL) { + ERROR("PeerName_r: out of memory\n"); + } + return returnValue; +} + + +/* thread safe */ +unsigned short +PeerNamePort(Socket sd) { + unsigned short tmp; + struct sockaddr peer; + SOCKLEN_T peer_size = sizeof(peer); + + /* connectedPipes is global */ + if (!GetNWSLock(&lock)) { + ERROR("PeerNamePort: failed to obtain the lock\n"); + } + tmp = (IsPipe(sd) ? -1 : (getpeername(sd, &peer, &peer_size) < 0) ? -1 + : ((struct sockaddr_in *)&peer)->sin_port); + ReleaseNWSLock(&lock); + return tmp; +} + + +/* thread safe: we allocate memory for the returned char * */ +char * +IPAddressImage_r(IPAddress addr) { + struct in_addr addrAsInAddr; + char *returned, *tmp; + + addrAsInAddr.s_addr = addr; + + if (!GetNWSLock(&lock)) { + ERROR("IPAddressImage_r: failed to obtain the lock\n"); + } + tmp = inet_ntoa(addrAsInAddr); + if (tmp != NULL) { + returned = strdup(inet_ntoa(addrAsInAddr)); + } else { + returned = strdup("unknown"); + } + ReleaseNWSLock(&lock); + + if (returned == NULL) { + ERROR("IPAddressImage_r: out of memory\n"); + } + + return returned; +} + + +/* thread safe: we allocate memory for the returned char. NULL have to be + * checked by the caller. */ +char * +IPAddressMachine_r(IPAddress addr) { + struct hostent *hostEntry; + char *returnValue; + + hostEntry = LookupByAddress(addr); + if (hostEntry == NULL) { + return NULL; + } + + returnValue = strdup(BestHostName(hostEntry)); + + /* free allocated memory */ + FreeStructHostent(hostEntry); + + return returnValue; +} + + +/* thread safe. */ +int +IPAddressValues(const char *machineOrAddress, + IPAddress *addressList, + unsigned int atMost) { + struct hostent *hostEntry; + int i = 0, itsAnAddress = 0; + IPAddress temp = 0; +#ifdef HAVE_INET_ATON + struct in_addr in; + + if (inet_aton(machineOrAddress, &in) != 0) { + itsAnAddress = 1; + temp = in.s_addr; + } +#else + /* inet_addr() has the weird behavior of returning an unsigned + * quantity but using -1 as an error value. Furthermore, the + * value returned is sometimes int and sometimes long, + * complicating the test. Once inet_aton() is more widely + * available, we should switch to using it instead. */ + temp = inet_addr(machineOrAddress); + if (temp != -1) { + itsAnAddress = 1; + } +#endif + if(itsAnAddress && (atMost == 1)) { + *addressList = temp; + return 1; + } + + hostEntry = itsAnAddress ? LookupByAddress(temp) : LookupByName(machineOrAddress); + + /* sanity check */ + if(hostEntry == NULL) { + return 0; + } + + /* if atMost == 0 means we are checking if the address is + * correct. It is */ + if(atMost == 0) { + i = 1; + } + + for(; i < atMost && hostEntry->h_addr_list[i] != NULL; i++) { + memcpy(&addressList[i], hostEntry->h_addr_list[i], hostEntry->h_length); + } + + FreeStructHostent(hostEntry); + return i; +} + + +/* well, the name is always the same so we can use a static variable. + * Changed to never return NULL but at the very worse localhost. */ +const char * +MyMachineName(void) { + + struct hostent *myEntry; + static char returnValue[255] = ""; + + /* If we have a value in returnValue, done */ + if(returnValue[0] != '\0') { + return returnValue; + } + + /* try the simple case first */ + if(gethostname(returnValue, sizeof(returnValue)) == -1) { + ERROR("gethostname() failed! using localhost instead.\n"); + /* setting the name to a safe bet */ + if (!GetNWSLock(&lock)) { + ERROR("MyMachineName: failed to obtain the lock\n"); + } + strncpy(returnValue, "localhost", sizeof(returnValue)); + ReleaseNWSLock(&lock); + } else if(!strchr(returnValue, '.')) { + /* Okay, that didn't work; try the DNS. */ + myEntry = LookupByName(returnValue); + if(myEntry != NULL) { + if (!GetNWSLock(&lock)) { + ERROR("MyMachineName: failed to obtain the lock\n"); + } + strncpy(returnValue,BestHostName(myEntry),sizeof(returnValue)); + returnValue[sizeof(returnValue) - 1] = '\0'; + ReleaseNWSLock(&lock); + FreeStructHostent(myEntry); + } + } + + return returnValue; +} + + +/* DEPRECATED: these are not thread-safe */ +const char * +IPAddressImage(IPAddress addr) { + struct in_addr addrAsInAddr; + addrAsInAddr.s_addr = addr; + return inet_ntoa(addrAsInAddr); +} +const char * +IPAddressMachine(IPAddress addr) { + struct hostent *hostEntry; + static char returnValue[63 + 1]; + hostEntry = LookupByAddress(addr); + strncpy(returnValue, + (hostEntry == NULL) ? "" : BestHostName(hostEntry), + sizeof(returnValue)); + FreeStructHostent(hostEntry); + return returnValue; +} + +const char * +PeerName(Socket sd) { + struct sockaddr peer; + SOCKLEN_T peer_size = sizeof(peer); + static char returnValue[200]; + strcpy(returnValue, IsPipe(sd) ? "pipe" : + (getpeername(sd, &peer, &peer_size) < 0) ? + "(unknown)" : + inet_ntoa(((struct sockaddr_in *)&peer)->sin_addr)); + return returnValue; +} + + diff --git a/src/nws_portability/formatutil.c b/src/nws_portability/formatutil.c new file mode 100644 index 0000000000..937ac1f244 --- /dev/null +++ b/src/nws_portability/formatutil.c @@ -0,0 +1,533 @@ +/* $Id$ */ + + +#include /* memcpy() */ +#include "diagnostic.h" +#include "formatutil.h" +#include "osutil.h" + + +#ifndef NORMAL_FP_FORMAT +#define INCLUDE_FORMAT_CHECKING +#else +#ifndef NORMAL_INT_FORMAT +#define INCLUDE_FORMAT_CHECKING +#endif +#endif + + +static void *lock = NULL; /* local mutex */ +static const size_t HOST_SIZE[SIMPLE_TYPE_COUNT] = + {sizeof(char), sizeof(double), sizeof(float), sizeof(int), sizeof(long), + sizeof(short), sizeof(unsigned int), sizeof(unsigned long), + sizeof(unsigned short)}; +static const size_t NETWORK_SIZE[SIMPLE_TYPE_COUNT] = + {1, 8, 4, 4, 4, 2, 4, 4, 2}; + +/* how this host treat int, floats and big/little endianness */ +static int unusualFPFormat = 0; +static int unusualIntFormat = 0; +static int bytesReversed = -1; + +#ifndef NORMAL_FP_FORMAT +/* +** Copies #source# to #destination#, converting between IEEE and host floating- +** point format. #whatType# must be DOUBLETYPE or FLOATTYPE. #hostToIEEE# +** indicates whether the conversion is from host format to IEEE or vice versa. +** The IEEE version of the data will be in big-endian byte order even if the +** host machine is little-endian. For IEEE 754 floating point info, look at +** http://www.research.microsoft.com/~hollasch/cgindex/coding/ieeefloat.html +*/ +/* It should be thread safe */ +void +ConvertIEEE( const void *destination, + const void *source, + DataTypes whatType, + int hostToIEEE) { + +#define DOUBLEBIAS 1023 +#define QUADBIAS 16383 +#define SINGLEBIAS 127 + + struct DoublePrecision { + unsigned sign : 1; + unsigned exponent : 11; + unsigned leading : 4; + unsigned char mantissa[6]; + } doublePrecision; + + struct Expanded { + unsigned char sign; + int exponent; + unsigned char mantissa[16]; + } expanded; + + struct QuadPrecision { + unsigned sign : 1; + unsigned exponent : 15; + unsigned char mantissa[14]; + }; /* For future reference. */ + + struct SinglePrecision { + unsigned sign : 1; + unsigned exponent : 8; + unsigned leading : 7; + unsigned char mantissa[2]; + } singlePrecision; + + double doubleValue; + unsigned exponentBias; + double factor; + int i; + size_t mantissaLength; + + if(whatType == DOUBLE_TYPE) { + exponentBias = DOUBLEBIAS; + mantissaLength = sizeof(doublePrecision.mantissa) + 1; + factor = 16.0; /* 2.0 ^ bitsize(doublePrecision.leading) */ + } else { + exponentBias = SINGLEBIAS; + mantissaLength = sizeof(singlePrecision.mantissa) + 1; + factor = 128.0; /* 2.0 ^ bitsize(singlePrecision.leading) */ + } + + if(hostToIEEE) { + if(whatType == DOUBLE_TYPE) + doubleValue = *(double *)source; + else + doubleValue = *(float *)source; + + if(doubleValue < 0.0) { + expanded.sign = 1; + doubleValue = -doubleValue; + } else { + expanded.sign = 0; + } + expanded.exponent = 0; + if(doubleValue != 0.0) { + /* Determine the exponent value by iterative shifts + * (mult/div by 2) */ + while(doubleValue >= 2.0) { + expanded.exponent += 1; + doubleValue /= 2.0; + } + while(doubleValue < 1.0) { + expanded.exponent -= 1; + doubleValue *= 2.0; + } + expanded.exponent += exponentBias; + doubleValue -= 1.0; + } + + /* Set the bytes of the mantissa by iterative shift and + * truncate. */ + for(i = 0; i < 16; i++) { + doubleValue *= factor; + expanded.mantissa[i] = (int)doubleValue; + doubleValue -= expanded.mantissa[i]; + factor = 256.0; + } + /* Pack the expanded version into the destination. */ + if(whatType == DOUBLE_TYPE) { + memcpy(doublePrecision.mantissa, &expanded.mantissa[1], sizeof(doublePrecision.mantissa)); + doublePrecision.leading = expanded.mantissa[0]; + doublePrecision.exponent = expanded.exponent; + doublePrecision.sign = expanded.sign; + *(struct DoublePrecision *)destination = doublePrecision; + } else { + memcpy(singlePrecision.mantissa, &expanded.mantissa[1], sizeof(singlePrecision.mantissa)); + singlePrecision.leading = expanded.mantissa[0]; + singlePrecision.exponent = expanded.exponent; + singlePrecision.sign = expanded.sign; + *(struct SinglePrecision *)destination = singlePrecision; + } + } else { + /* Unpack the source into the expanded version. */ + if(whatType == DOUBLE_TYPE) { + doublePrecision = *(struct DoublePrecision *)source; + expanded.sign = doublePrecision.sign; + expanded.exponent = doublePrecision.exponent; + expanded.mantissa[0] = doublePrecision.leading; + memcpy(&expanded.mantissa[1], doublePrecision.mantissa, sizeof(doublePrecision.mantissa)); + } else { + singlePrecision = *(struct SinglePrecision *)source; + expanded.sign = singlePrecision.sign; + expanded.exponent = singlePrecision.exponent; + expanded.mantissa[0] = singlePrecision.leading; + memcpy(&expanded.mantissa[1], singlePrecision.mantissa, sizeof(singlePrecision.mantissa)); + } + /* Set mantissa by via shifts and adds; allow for + * denormalized values. */ + doubleValue = (expanded.exponent == 0) ? 0.0 : 1.0; + + for(i = 0; i < mantissaLength; i++) { + doubleValue += (double)expanded.mantissa[i] / factor; + factor *= 256.0; + } + /* Set the exponent by iterative mults/divs by 2. */ + if(expanded.exponent == 0) + ; /* Nothing to do. */ + else if(expanded.exponent == (exponentBias * 2 + 1)) + /* + * An exponent of all ones represents one of + * three things: Infinity: mantissa of all zeros + * Indeterminate: sign of 1, mantissa leading one + * followed by all zeros NaN: all other values + * None of these can be reliably produced by C + * operations. We might be able to get Infinity + * by dividing by zero, but, on a non-IEEE + * machine, we're more likely to cause some sort + * of floating-point exception. + */ + ; + else + expanded.exponent -= exponentBias; + + if(expanded.exponent < 0) { + for(i = expanded.exponent; i < 0; i++) + doubleValue /= 2.0; + } else { + for(i = 0; i < expanded.exponent; i++) + doubleValue *= 2.0; + } + + if(expanded.sign) + doubleValue *= -1.0; + + if(whatType == DOUBLE_TYPE) + *(double *)destination = doubleValue; + else + *(float *)destination = doubleValue; + } +} +#endif + + +/* + * Copies the integer value of size #sourceSize# stored in #source# to the + * #destinationSize#-long area #destination#. #signedType# indicates whether + * or not the source integer is signed; #lowOrderFirst# whether or not the + * bytes run least-significant to most-significant. + * + * It should be thread safe (operates on local variables and calls mem*) + */ +void +ResizeInt( void *destination, + size_t destinationSize, + const void *source, + size_t sourceSize, + int signedType, + int lowOrderFirst) { + + unsigned char *destinationSign; + int padding; + int sizeChange = destinationSize - sourceSize; + unsigned char *sourceSign; + + if(sizeChange == 0) { + memcpy(destination, source, destinationSize); + } else if(sizeChange < 0) { + /* Truncate high-order bytes. */ + memcpy(destination, lowOrderFirst?source:((char*)source-sizeChange), destinationSize); + if(signedType) { + /* Make sure the high order bit of source and + * destination are the same */ + destinationSign = lowOrderFirst ? ((unsigned char*)destination + destinationSize - 1) : (unsigned char*)destination; + sourceSign = lowOrderFirst ? ((unsigned char*)source + sourceSize - 1) : (unsigned char*)source; + if((*sourceSign > 127) != (*destinationSign > 127)) { + if(*sourceSign > 127) + *destinationSign += 128; + else + *destinationSign -= 128; + } + } + } else { + /* Pad with zeros or extend sign, as appropriate. */ + if(!signedType) + padding = 0; + else { + sourceSign = lowOrderFirst ? ((unsigned char*)source + sourceSize - 1) : (unsigned char*)source; + padding = (*sourceSign > 127) ? 0xff : 0; + } + memset(destination, padding, destinationSize); + memcpy(lowOrderFirst ? destination : ((char *)destination + sizeChange), source, sourceSize); + } +} + + +/* + * Copies #length# bytes from #from# to #to# in reverse order. Will work + * properly if #from# and #to# are the same address. + * + * It should be thread safe. + */ +void +ReverseBytes( void *to, + const void *from, + size_t length) { + + char charBegin; + const char *fromBegin; + const char *fromEnd; + char *toBegin; + char *toEnd; + + for(fromBegin = (const char *)from, fromEnd = fromBegin + length - 1, toBegin = (char *)to, toEnd = toBegin + length - 1; fromBegin <= fromEnd; fromBegin++, fromEnd--, toBegin++, toEnd--) { + charBegin = *fromBegin; + *toBegin = *fromEnd; + *toEnd = charBegin; + } +} + + +void +ConvertData( void *destination, + const void *source, + const DataDescriptor *description, + size_t length, + FormatTypes sourceFormat) { + + size_t destStructSize; + int i; + int j; + size_t networkBytesConverted; + char *nextDest; + const char *nextSource; + size_t sourceStructSize; + + networkBytesConverted = 0; + + for(i = 0; i < length; i++, description++) { + if(sourceFormat == HOST_FORMAT) { + nextDest = (char *)destination + networkBytesConverted; + nextSource = (char *)source + description->offset; + } else { + nextDest = (char *)destination + description->offset; + nextSource = (char *)source + networkBytesConverted; + } + if(description->type == STRUCT_TYPE) { + if(sourceFormat == HOST_FORMAT) { + destStructSize = DataSize(description->members, description->length, NETWORK_FORMAT); + sourceStructSize = DataSize(description->members, description->length, HOST_FORMAT) + description->tailPadding; + } else { + destStructSize = DataSize(description->members, description->length, HOST_FORMAT) + description->tailPadding; + sourceStructSize = DataSize(description->members, description->length, NETWORK_FORMAT); + } + for(j = 0; j < description->repetitions; j++) { + ConvertData(nextDest, nextSource, description->members, description->length, sourceFormat); + nextDest += destStructSize; + nextSource += sourceStructSize; + } + } else { + HomogenousConvertData(nextDest, nextSource, description->type, description->repetitions, sourceFormat); + } + networkBytesConverted += DataSize(description, 1, NETWORK_FORMAT); + } +} + + +/* I believe is thread safe (HomogenousDataSize is thread safe) */ +size_t +DataSize( const DataDescriptor *description, + size_t length, + FormatTypes format) { + + int i; + const DataDescriptor *lastMember; + size_t totalSize; + + if(format == HOST_FORMAT) { + lastMember = description; + for(i = 0; i < length; i++) { + if(description[i].offset > lastMember->offset) { + lastMember = &description[i]; + } + } + return lastMember->offset + ((lastMember->type == STRUCT_TYPE) ? ((DataSize(lastMember->members, lastMember->length, HOST_FORMAT) + lastMember->tailPadding) * lastMember->repetitions) : HomogenousDataSize(lastMember->type, lastMember->repetitions, HOST_FORMAT)); + } else { + totalSize = 0; + for(i = 0; i < length; i++, description++) { + totalSize += (description->type == STRUCT_TYPE) ? (DataSize(description->members, description->length, NETWORK_FORMAT) * description->repetitions) : HomogenousDataSize(description->type, description->repetitions, NETWORK_FORMAT); + } + return totalSize; + } +} + + +/* + * Internal call to be done only once. We find the fomrat of this host: + * once done we re-use the results + * + * Some of the checking could have been done at compile time, but to be + * sure and to cover exoteric machine (doesn't ppc can behave as little + * and bin endian?) we do it at runtime. + * + * I believe it is thread safe (uses the lock if it modifies global + * variables) + */ +void +FirstCall() { + + /* we do the checking only once: next time bytesReversed will be + * set */ + if (bytesReversed == -1) { + /* I think we could avoid this lock, but just to be safe */ + GetNWSLock(&lock); + + /* check endiannes */ + { + typedef int IntTestType; + union { + IntTestType testInt; + unsigned char bytes[sizeof(IntTestType)]; + } orderTester; + + orderTester.testInt = 1; + bytesReversed = (orderTester.bytes[0] == 1); + } + +#ifdef INCLUDE_FORMAT_CHECKING +# ifndef NORMAL_FP_FORMAT + { + typedef double FPTestType; + union { + FPTestType testFP; + unsigned char bytes[sizeof(FPTestType)]; + } fpTester; + + memset(&fpTester, 0, sizeof(fpTester)); + /* Set sign, low-order bit of exponent and high-order bit + * of mantissa. */ + fpTester.bytes[bytesReversed ? sizeof(FPTestType) - 1 : 0]=192; + fpTester.bytes[bytesReversed ? sizeof(FPTestType) - 2 : 1] = + (sizeof(FPTestType) == 4) ? 128 : + (sizeof(FPTestType) == 8) ? 16 : + (sizeof(FPTestType) == 16) ? 1 : 0; + unusualFPFormat = fpTester.testFP != -4.0; + } +# endif + +# ifndef NORMAL_INT_FORMAT + /* Converting non-twos-compliment is a pain, but + * detecting it is easy, so we go ahead and include a + * check and leave it to the caller to handle. */ + { + typedef int IntTestType; + union { + IntTestType testInt; + unsigned char bytes[sizeof(IntTestType)]; + } intTester; + + intTester.testInt = -2; + unusualIntFormat = ((unsigned int)intTester.bytes[0] + + (unsigned int)intTester.bytes[sizeof(IntTestType) - 1]) != 509; + } +# endif +#endif + + ReleaseNWSLock(&lock); + } + return; +} + +/* I believe is thread safe (FirstCall is thread safe and we just read + * the global variables) */ +int +DifferentFormat(DataTypes whatType) { + + FirstCall(); + return ((whatType == DOUBLE_TYPE) || (whatType == FLOAT_TYPE)) ? + unusualFPFormat : unusualIntFormat; +} + + +/* I believe is thread safe (FirstCall is thread safe and we just read + * the global variable) */ +int +DifferentOrder(void) { + + FirstCall(); + return bytesReversed; +} + + +/* It should be thread sage (only reads global variables) */ +int +DifferentSize(DataTypes whatType) { + return HOST_SIZE[whatType] != NETWORK_SIZE[whatType]; +} + + +/* It should be thread safe (ConvertIEEE, ReverseData + * and mem* are thread safe) */ +void +HomogenousConvertData( void *destination, + const void *source, + DataTypes whatType, + size_t repetitions, + FormatTypes sourceFormat) { + + int bytesReverse = DifferentOrder(); + FormatTypes destFormat; + const void *from; + size_t fromSize; + int i; + void *to; + size_t toSize; + + destFormat = (sourceFormat == HOST_FORMAT) ? NETWORK_FORMAT : HOST_FORMAT; + fromSize = (sourceFormat == HOST_FORMAT) ? + HOST_SIZE[whatType] : NETWORK_SIZE[whatType]; + toSize = (destFormat == HOST_FORMAT) ? + HOST_SIZE[whatType] : NETWORK_SIZE[whatType]; + +#ifndef NORMAL_FP_FORMAT + if(((whatType == DOUBLE_TYPE) || (whatType == FLOAT_TYPE)) && + (DifferentFormat(whatType) || (fromSize != toSize))) { + for(i = 0, from = source, to = destination; i < repetitions; i++, from = (char *)from + fromSize, to = (char *)to + toSize) { + ConvertIEEE(to, from, whatType, (sourceFormat == HOST_FORMAT)); + } + /* Note: ConvertIEEE also handles byte ordering. */ + return; + } +#endif + + if(fromSize != toSize) { + for(i = 0, from = source, to = destination; i < repetitions; i++, from = (char *)from + fromSize, to = (char *)to + toSize) { + ResizeInt(to, toSize, from, fromSize, whatType < UNSIGNED_INT_TYPE, (sourceFormat == HOST_FORMAT) && bytesReverse); + } + if(bytesReverse && (toSize > 1)) + ReverseData(destination, destination, whatType, repetitions, destFormat); + } else if(bytesReverse && (toSize > 1)) + ReverseData(destination, source, whatType, repetitions, destFormat); + else if(destination != source) + memcpy(destination, source, fromSize * repetitions); +} + + +/* I believe is thread safe (*_SIZE are static and global but are + * constant and initialize when created) */ +size_t +HomogenousDataSize( DataTypes whatType, + size_t repetitions, + FormatTypes format) { + return ((format == HOST_FORMAT) ? + HOST_SIZE[whatType] : NETWORK_SIZE[whatType]) * repetitions; +} + + +/* It should be thread safe (ReverseByte is thread safe */ +void +ReverseData( void *destination, + const void *source, + DataTypes whatType, + int repetitions, + FormatTypes format) { + int i; + size_t size; + + size = (format == HOST_FORMAT) ? HOST_SIZE[whatType] : NETWORK_SIZE[whatType]; + for(i = 0; i < repetitions; i++, destination = (char *)destination + size, source = (char *)source + size) { + ReverseBytes(destination, source, size); + } +} diff --git a/src/nws_portability/install-sh b/src/nws_portability/install-sh new file mode 100755 index 0000000000..ebc66913e9 --- /dev/null +++ b/src/nws_portability/install-sh @@ -0,0 +1,250 @@ +#! /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=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/src/nws_portability/messages.c b/src/nws_portability/messages.c new file mode 100644 index 0000000000..b0bbf5b649 --- /dev/null +++ b/src/nws_portability/messages.c @@ -0,0 +1,508 @@ +/* $Id$ */ + + +#include "config_portability.h" + +#include /* offsetof() */ +#include /* free() malloc() REALLOC() */ +#ifdef WITH_LDAP +#include +#endif +#ifdef WITH_THREAD +#include +#endif + +#include "diagnostic.h" /* FAIL() LOG() */ +#include "protocol.h" /* Socket functions */ +#include "messages.h" +#include "osutil.h" +#include "timeouts.h" + +#if defined(WITH_THREAD) +pthread_mutex_t Message_lock = PTHREAD_MUTEX_INITIALIZER; +pthread_cond_t Message_wait = PTHREAD_COND_INITIALIZER; +int Message_busy = 0; +pthread_t Message_holding = (pthread_t)-1; +#endif + +static void *lock = NULL; /* local mutex */ + +/* + * Info on registered listeners. #message# is the message for which #listener# + * is registered; #image# the message image. Note that, since we provide no + * way to terminate listening for messages, we can simply expand the list by + * one every time a new listener is registered. + */ +typedef struct { + MessageType message; + const char *image; + ListenFunction listener; +} ListenerInfo; + +static ListenerInfo *listeners = NULL; +static unsigned listenerCount = 0; +#ifdef WITH_LDAP +static LdapListenFunction ldapListener = NULL; +#endif + +/* + * A header sent with messages. #version# is the NWS version and is presently + * ignored, but it could be used for compatibility. #message# is the actual + * message. #dataSize# is the number of bytes that accompany the message. + */ +static const DataDescriptor headerDescriptor[] = + {SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(MessageHeader, version)), + SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(MessageHeader, message)), + SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(MessageHeader, dataSize))}; +#define headerDescriptorLength 3 + + +#if defined(WITH_THREAD) + /* + * ** uses mutex (which might spin) to test and set a global variable + * ** + * ** note that the pthread condition variable allows waiting under a lock + * ** and will block the calling thread + * */ +void LockMessageSystem() +{ + pthread_mutex_lock(&Message_lock); + while(Message_busy == 1) + { + pthread_cond_wait(&Message_wait,&Message_lock); + } + + Message_busy = 1; + Message_holding = pthread_self(); /* debugging info only */ + + pthread_mutex_unlock(&Message_lock); + + return; +} + +void UnlockMessageSystem() +{ + pthread_mutex_lock(&Message_lock); + + Message_busy = 0; + Message_holding = (pthread_t)-1; /* debugging info only */ + pthread_cond_signal(&Message_wait); + + pthread_mutex_unlock(&Message_lock); + return; +} +#else +#define LockMessageSystem() +#define UnlockMessageSystem() +#endif + +/* + * Returns 1 or 0 depending on whether or not format conversion is required for + * data with the format described by the #howMany#-long array #description#. + * + * I believe is thread safe (DataSize & DifferentFOrmat are thread safe) + */ +static int +ConversionRequired( const DataDescriptor *description, + size_t howMany) { + int i; + + if(DataSize(description, howMany, HOST_FORMAT) != + DataSize(description, howMany, NETWORK_FORMAT)) { + return 1; + } + + for(i = 0; i < howMany; i++) { + if(description[i].type == STRUCT_TYPE) { + if(ConversionRequired(description[i].members, description[i].length)) { + return 1; + } + } else if(DifferentFormat(description[i].type)) + return 1; + } + + return 0; +} + + +/* it should be thread safe (all the conversions routines should be + * thread safe). + * */ +int +RecvData( Socket sd, + void *data, + const DataDescriptor *description, + size_t howMany, + double timeOut) { + + void *converted; + int convertIt; + void *destination; + int recvResult; + size_t totalSize = DataSize(description, howMany, NETWORK_FORMAT); + + LockMessageSystem(); + + converted = NULL; + convertIt = ConversionRequired(description, howMany); + + if(convertIt) { + converted = malloc(totalSize); + if(converted == NULL) { + UnlockMessageSystem(); + FAIL1("RecvData: memory allocation of %d bytes failed\n", totalSize); + } + destination = converted; + } else { + destination = data; + } + + /* use adaptive timeouts? */ + if (timeOut < 0) { + double start; + + /* adaptive timeout */ + start = CurrentTime(); + + recvResult = RecvBytes(sd, destination, totalSize, GetTimeOut(RECV, Peer(sd), totalSize)); + /* we assume a failure is a timeout ... Shouldn't hurt + * too much getting a bigger timeout anyway */ + SetTimeOut(RECV, Peer(sd), CurrentTime()-start, totalSize, !recvResult); + } else { + recvResult = RecvBytes(sd, destination, totalSize, timeOut); + } + if (recvResult != 0) { + if(DifferentOrder() || convertIt) + ConvertData(data, destination, description, + howMany, NETWORK_FORMAT); + + if(converted != NULL) + free(converted); + } + UnlockMessageSystem(); + + return recvResult; +} + + +/* It should be thread safe (just read headerDescriptor[Lenght] and + * RecvByte is thread safe) */ +int +RecvMessage(Socket sd, + MessageType message, + size_t *dataSize, + double timeOut) { + char *garbage; + MessageHeader header; + + if(!RecvData( sd, + (void *)&header, + headerDescriptor, + headerDescriptorLength, + timeOut)) { + FAIL("RecvMessage: no message received\n"); + } + + LockMessageSystem(); + + if(header.message != message) { + garbage = malloc(2048); + if (garbage == NULL) { + FAIL("RecvMessage: out of memory!"); + } + /* get the rigth timeout */ + if (timeOut < 0) { + timeOut = GetTimeOut(RECV, Peer(sd), 1); + } + while(header.dataSize > 0) { + /* if we time out let's drop the socket */ + if (!RecvBytes(sd, garbage, (header.dataSize > sizeof(garbage)) ? sizeof(garbage) : header.dataSize, timeOut)) { + DROP_SOCKET(&sd); + WARN("RecvMessage: timeout on receiving non-handled message: dropping socket\n"); + break; + } + header.dataSize -= sizeof(garbage); + } + free(garbage); + + UnlockMessageSystem(); + FAIL1("RecvMessage: unexpected message %d received\n", header.message); + } + *dataSize = header.dataSize; + UnlockMessageSystem(); + return(1); +} + +/* it should be thread safe */ +int +RecvMessageAndDatas(Socket sd, + MessageType message, + void *data1, + const DataDescriptor *description1, + size_t howMany1, + void *data2, + const DataDescriptor *description2, + size_t howMany2, + double timeOut) { + size_t dataSize; + + if (RecvMessage(sd, message, &dataSize, timeOut) != 1) { + /* failed to receive message: errors already printed out + * by RecvMessage() */ + return 0; + } + + if(data1 != NULL) { + if(!RecvData(sd, data1, description1, howMany1, timeOut)) { + FAIL("RecvMessageAndDatas: data receive failed\n"); + } + } + + if(data2 != NULL) { + if(!RecvData(sd, data2, description2, howMany2, timeOut)) { + FAIL("RecvMessageAndDatas: data receive failed\n"); + } + } + + return(1); +} + +/* + * waits for timeOut seconds for incoming messages and calls the + * appropriate (registered) listener function. + */ +void +ListenForMessages(double timeOut) { + + MessageHeader header; + int i, ldap; + Socket sd; + + if(!IncomingRequest(timeOut, &sd, &ldap)) + return; + +#ifdef WITH_LDAP + /* + ** WARNING! Not sure if ldapListener is thread safe (yet) + */ + if (ldap) { + if (ldapListener == NULL) { + WARN2("Unexpected LDAP message received from %s on %d\n", + PeerName(sd), sd); + SendLdapDisconnect(&sd, LDAP_UNAVAILABLE); + } + else { + LOG2("Received LDAP message from %s on %d\n", PeerName(sd), sd); + ldapListener(&sd); + } + } else { +#endif + + /* let's use the adaptive timeouts on receiving the header */ + if(!RecvData(sd, (void *)&header, headerDescriptor, headerDescriptorLength, -1)) { + /* Likely a connection closed by the other side. There + * doesn't seem to be any reliable way to detect this, + * and, for some reason, select() reports it as a + * connection ready for reading. */ + DROP_SOCKET(&sd); + return; + } + + LockMessageSystem(); + + for(i = 0; i < listenerCount; i++) { + if(listeners[i].message == header.message) { + LOG3("Received %s message from %s on %d\n", listeners[i].image, PeerName(sd), sd); + listeners[i].listener(&sd, header); + break; + } + } + + if(i == listenerCount) { + WARN3("Unknown message %d received from %s on %d\n", header.message, PeerName(sd), sd); + DROP_SOCKET(&sd); + } +#ifdef WITH_LDAP + } +#endif +} + + + +/* regsiters the functions which should be called upon the receive of the + * messageType message. Should be thread safe */ +void +RegisterListener(MessageType message, + const char *image, + ListenFunction listener) { + LockMessageSystem(); + if (!GetNWSLock(&lock)) { + ERROR("RegisterListener: couldn't obtain the lock\n"); + } + listeners = REALLOC(listeners, (listenerCount+1)*sizeof(ListenerInfo)); + listeners[listenerCount].message = message; + listeners[listenerCount].image = image; + listeners[listenerCount].listener = listener; + listenerCount++; + ReleaseNWSLock(&lock); + UnlockMessageSystem(); +} + + +#ifdef WITH_LDAP +void +RegisterLdapListener(LdapListenFunction listener) { + ldapListener = listener; +} + + +void +SendLdapDisconnect (Socket *sd, + ber_int_t resultCode) +{ + /* + ** Send an unsolicitied notice of disconnection, in compliance with the + ** LDAP RFC. This notice is pre-created to allow us to send it + ** even if the lber libraries have failed (for example, due to a memory + ** shortage). + ** + ** abortMessage contains the unsolicited notice of disconnection. + ** abortMessageLength gives the length of the message, needed + ** due to the message's embedded NULLs. errorOffset gives the location + ** of the error code within the message. + ** + ** To create this message using the ber libraries, call ber_print as follows: + ** ber_printf(ber, "{it{essts}}", 0, LDAP_RES_EXTENDED, resultCode, + ** "", "", LDAP_TAG_EXOP_RES_OID, LDAP_NOTICE_OF_DISCONNECTION); + ** The components of an unsolicited disconnect message (and hence the + ** parameters for the above ber_printf) are as follows: + ** messageID (must be zero for unsoliticed notification), protocolOp, + ** resultCode, matchedDN, errorMessage, responseName (optional, and omitted + ** for an unsolicited disconnect), response (with tag) + ** + */ + static char abortMessage[] = "0$\x02\x01\x00x\x1f\x0a\x01\x02\x04\x00\x04" + "\x00\x8a\x16" "1.3.6.1.4.1.1466.20036"; + int abortMessageLength = 38; + int errorOffset = 9; + abortMessage[errorOffset] = resultCode; + SendBytes(*sd, abortMessage, abortMessageLength, -1); + DROP_SOCKET(sd); +} +#endif + +/* it should be thread safe (Convert*, SendBytes, DataSize abd + * DifferentOrder are thread safe) */ +int +SendData(Socket sd, + const void *data, + const DataDescriptor *description, + size_t howMany, + double timeOut) { + + void *converted; + int sendResult; + const void *source; + size_t totalSize = DataSize(description, howMany, NETWORK_FORMAT); + + LockMessageSystem(); + converted = NULL; + + if(DifferentOrder() || ConversionRequired(description, howMany)) { + converted = malloc(totalSize); + if(converted == NULL) { + UnlockMessageSystem(); + FAIL("SendData: memory allocation failed\n"); + } + ConvertData(converted, data, description, howMany, HOST_FORMAT); + source = converted; + } else { + source = data; + } + + /* use adaptive timeouts? */ + if (timeOut < 0) { + double start; + + /* adaptive timeout */ + start = CurrentTime(); + sendResult = SendBytes(sd, source, totalSize, GetTimeOut(SEND, Peer(sd),totalSize)); + /* we assume a failure is a timeout ... Shouldn't hurt + * too much getting a bigger timeout anyway */ + SetTimeOut(SEND, Peer(sd), CurrentTime()-start, totalSize, !sendResult); + } else { + sendResult = SendBytes(sd, source, totalSize, timeOut); + } + if(converted != NULL) + free((void *)converted); + + UnlockMessageSystem(); + return sendResult; +} + +/* it should be thread safe (SendData, DataSize are thread safe) */ +int +SendMessageAndDatas(Socket sd, + MessageType message, + const void *data1, + const DataDescriptor *description1, + size_t howMany1, + const void *data2, + const DataDescriptor *description2, + size_t howMany2, + double timeOut) { + + MessageHeader header; + + LockMessageSystem(); + + header.version = NWS_VERSION; + header.message = message; + header.dataSize = 0; + if(data1 != NULL) + header.dataSize += DataSize(description1, howMany1, NETWORK_FORMAT); + if(data2 != NULL) + header.dataSize += DataSize(description2, howMany2, NETWORK_FORMAT); + + UnlockMessageSystem(); + + if(!SendData(sd, + &header, + headerDescriptor, + headerDescriptorLength, + timeOut)) { + FAIL("SendMessageAndDatas: header send failed \n"); + } + if((data1 != NULL) && !SendData(sd, data1, description1, howMany1, timeOut)) { + FAIL("SendMessageAndDatas: data1 send failed\n"); + } + if((data2 != NULL) && !SendData(sd, data2, description2, howMany2, timeOut)) { + FAIL("SendMessageAndDatas: data2 send failed\n"); + } + return 1; +} + +/* + * reads the NWS header associated with in incoming message and returns + * the message type. returns -1 if the read fails + * + * it should be thread safe (RecvData is thread safe and header* are only + * read) + */ +int RecvMsgType(Socket sd, double timeout) +{ + int status; + MessageHeader header; + + status = RecvData(sd, + &header, + headerDescriptor, + headerDescriptorLength, + timeout); + + if(status <= 0) { + return(-1); + } + + return((int)header.message); +} diff --git a/src/nws_portability/osutil.c b/src/nws_portability/osutil.c new file mode 100644 index 0000000000..9296fd2c5c --- /dev/null +++ b/src/nws_portability/osutil.c @@ -0,0 +1,348 @@ +/* $Id$ */ + + +#include "config_portability.h" + +#include /* isspace() */ +#include /* errno values */ +#include /* endpwent() getpwuid() */ +#include /* sig{add,empty}set() sigprocmask() */ +#include /* file functions */ +#include /* getenv() */ +#include /* memset() strchr() strlen() */ +#include /* alarm() getuid() sysconf() (where available) */ +#include /* stat() */ +#include /* gettimeofday() */ +#include /* size_t time_t */ +#include /* time() */ + +#include "osutil.h" + +#ifdef HAVE_PTHREAD_H +#include + +/* this is the lock for this module. Every other module will use a void * + * as a variable as mutex. */ +pthread_mutex_t nwsLock = PTHREAD_MUTEX_INITIALIZER; +#endif + + +/* + * These are defined here only becasue they are not found (sometimes) in + * the headers but only in libraries. To avoid annoying compilation warnings + */ +#ifdef HAVE_SIGHOLD +int sighold(int sig); +#endif +#ifdef HAVE_SIGRELSE +int sigrelse(int sig); +#endif + + +int +CPUCount( ) { +#ifdef HAVE_SYSCONF +# ifdef _SC_CRAY_NCPU +# define SYSCONF_PROCESSOR_COUNT_PARAMETER _SC_CRAY_NCPU +# elif defined(_SC_NPROC_CONF) +# define SYSCONF_PROCESSOR_COUNT_PARAMETER _SC_NPROC_CONF +# elif defined(_SC_NPROCESSORS_CONF) +# define SYSCONF_PROCESSOR_COUNT_PARAMETER _SC_NPROCESSORS_CONF +# endif +# ifdef SYSCONF_PROCESSOR_COUNT_PARAMETER + /* Try to gracefully handle mis-configuration. */ + int sysconfCount = sysconf(SYSCONF_PROCESSOR_COUNT_PARAMETER); + return (sysconfCount == 0) ? 1 : sysconfCount; +# else + return 1; +# endif +#else + return 1; +#endif +} + + +/* It should be thread safe (time should be thread safe) */ +double +CurrentTime(void) { + return((double)time(NULL)); +} + + +const char * +GetEnvironmentValue(const char *name, + const char *rcDirs, + const char *rcName, + const char *defaultValue) { + + const char *dirEnd; + const char *dirStart; + char *from; + const char *homeDir; + size_t nameLen; + FILE *rcFile; + static char rcLine[255 + 1]; + char rcPath[255 + 1]; + const char *returnValue; + char *to; + + returnValue = getenv(name); + if(returnValue != NULL) { + /* easy way out: we got the environmental variable */ + return returnValue; + } + + if(*rcName != '\0') { + nameLen = strlen(name); + + for(dirStart = rcDirs, dirEnd = dirStart; dirEnd != NULL; dirStart = dirEnd + 1) { + /* Construct a file path from the next dir in + * rcDirs and rcName. */ + dirEnd = strchr(dirStart, ':'); + memset(rcPath, '\0', sizeof(rcPath)); + strncpy(rcPath, dirStart, (dirEnd == NULL) ? strlen(dirStart) : (dirEnd - dirStart)); + if((strcmp(rcPath, "~") == 0) || (strcmp(rcPath, "~/") == 0)) { + homeDir = getenv("HOME"); + if(homeDir != NULL) { + strcpy(rcPath, homeDir); + } + } + strcat(rcPath, "/"); + strcat(rcPath, rcName); + rcFile = fopen(rcPath, "r"); + + if(rcFile == NULL) { + /* no luck, try the next one */ + continue; + } + + while(fgets(rcLine, sizeof(rcLine), rcFile) != NULL) { + /* Test against pattern " *#name# =". */ + for(from = rcLine; (*from != '\0') && isspace((int)*from); from++) + ; /* Nothing more to do. */ + if(strncmp(from, name, nameLen) != 0) { + continue; + } + for(from += nameLen; (*from != '\0') && isspace((int)*from); from++) + ; /* Nothing more to do. */ + if(*from != '=') { + continue; + } + + /* We found a line that sets the variable. */ + (void)fclose(rcFile); + for(from++; (*from != '\0') && isspace((int)*from); from++) + ; /* Nothing more to do. */ + + /* Return a single word to allow for + * future free-format input. */ + if(*from == '"') { + returnValue = from + 1; + for(from++, to = from; (*from != '\0') && (*from != '"'); from++, to++) { + if(*from == '\\') { + from++; + switch(*from) { + case 'b': + *to = '\b'; + break; + case 'f': + *to = '\f'; + break; + case 'n': + *to = '\n'; + break; + case 'r': + *to = '\r'; + break; + case 't': + *to = '\t'; + break; + case 'v': + *to = '\v'; + break; + default: + *to = *from; + break; + } + } else { + *to = *from; + } + } + } else { + returnValue = from; + for(to = from; (*to != '\0') && !isspace((int)*to); to++) + ; /* Nothing more to do. */ + } + *to = '\0'; + + if (returnValue != NULL) + return(returnValue); + else + break; + } + (void)fclose(rcFile); + } + } + return(defaultValue); +} + + +int +GetUserName(char *name, + size_t length) { + struct passwd *myPasswd; + myPasswd = getpwuid(getuid()); + if(myPasswd != NULL) { + strncpy(name, myPasswd->pw_name, length); + name[length - 1] = '\0'; + } + endpwent(); + return(myPasswd != NULL); +} + +void +HoldSignal(int sig) { +#ifdef HAVE_SIGHOLD + sighold(sig); +#else + sigset_t set, oset; + sigemptyset(&set); + sigaddset(&set, sig);\ + sigprocmask(SIG_BLOCK, &set, &oset); +#endif +} + + +int +MakeDirectory(const char *path, + mode_t mode, + int makeEntirePath) { + + const char *endSubPath; + struct stat pathStat; + char subPath[255 + 1]; + + if(makeEntirePath) { + endSubPath = path; /* This will ignore leading '/' */ + while((endSubPath = strchr(endSubPath + 1, '/')) != NULL) { + memset(subPath, '\0', sizeof(subPath)); + strncpy(subPath, path, endSubPath - path); + if((stat(subPath, &pathStat) == -1) && (errno == ENOENT)) { + if(mkdir(subPath, mode) == -1) { + return 0; + } + } + else if(!S_ISDIR(pathStat.st_mode)) { + return 0; + } + } + } + + if((stat(path, &pathStat) == -1) && (errno == ENOENT)) { + return(mkdir(path, mode) != -1); + } + else { + return(S_ISDIR(pathStat.st_mode)); + } +} + + + +int +GetNWSLock(void **lock) { +#ifdef HAVE_PTHREAD_H + int ret; + + if (lock == NULL) { + return 0; + } + if (*lock == NULL) { + /* let's play it safe: let's do one mutex at the time (in + * case multiple threads are running on the same lock */ + if (pthread_mutex_lock(&nwsLock) != 0) { + return 0; + } + /* there is no mutex yet: let's create it. We double + * check in the pretty rare condition of having 2 threads + * creating lock at the same time */ + if (*lock == NULL) { + *lock = (void *)MALLOC(sizeof(pthread_mutex_t)); + pthread_mutex_init((pthread_mutex_t *)(*lock), NULL); + } + if (*lock == NULL || pthread_mutex_unlock(&nwsLock) != 0) { + return 0; + } + } + ret = pthread_mutex_lock((pthread_mutex_t *)(*lock)); + if (ret != 0) { + fprintf(stderr, "GetNWSLock: Unable to lock (errno = %d)!\n", ret); + return 0; + } +#endif + return 1; +} + +int +ReleaseNWSLock(void **lock) { + +#ifdef HAVE_PTHREAD_H + if (lock == NULL || pthread_mutex_unlock((pthread_mutex_t *)*lock) != 0) { + return 0; + } +#endif + return 1; +} + +long +MicroTime(void) { + struct timeval tv; + gettimeofday(&tv, NULL); + return(tv.tv_sec * 1000000 + tv.tv_usec); +} + + +void +ReleaseSignal(int sig) { +#ifdef HAVE_SIGRELSE + sigrelse(sig); +#else + sigset_t set, oset; + sigemptyset(&set); + sigaddset(&set, sig); + sigprocmask(SIG_UNBLOCK, &set, &oset); +#endif +} + + +int +SignalAlarm( handler h, + handler *old) { +#ifdef USE_ALARM_SIGNAL + handler tmp; + + tmp = signal(SIGALRM, h); + if (tmp == SIG_ERR) { + return 0; + } + if (old != NULL) + *old = tmp; + +#endif + return 1; +} + +/* It should be thread safe (alarm is thread safe) */ +void +SetRealTimer(unsigned int numberOfSecs) { +#ifdef USE_ALARM_SIGNAL +#ifdef HAVE_SIGINTERRUPT + if (numberOfSecs > 0) { + /* just interrupt a system call upon receipt of interrupt */ + siginterrupt(SIGALRM, 1); + } +#endif + + alarm(numberOfSecs); +#endif +} + diff --git a/src/nws_portability/protocol.c b/src/nws_portability/protocol.c new file mode 100644 index 0000000000..75a5509e30 --- /dev/null +++ b/src/nws_portability/protocol.c @@ -0,0 +1,1107 @@ +/* $Id$ */ + +#include "config_portability.h" + +#include /* close() pipe() read() write() */ +#include /* close() pipe() read() write() */ +#include /* sometimes required for #include */ +#include /* TCP_NODELAY */ +#ifdef HAVE_INTTYPES_H +# include +#endif +#include /* inet_ntoa() */ +#include /* getprotobyname() */ +#include /* struct timeval */ +#include /* errno */ +#include /* waitpid() */ +#include /* getpeername() socket() */ +#include +#ifdef WITH_LDAP +#include +#endif + +#include "diagnostic.h" +#include "osutil.h" +#include "protocol.h" +#include "strutil.h" +#include "dnsutil.h" +#include "timeouts.h" + + +static void *lock = NULL; /* local mutex */ + +/* Global variables: they need to be protected with locks when accessed */ +#define MAX_NOTIFIES 40 +static SocketFunction disconnectFunctions[MAX_NOTIFIES]; +static fd_set connectedEars; +static fd_set connectedPipes; +static fd_set connectedSockets; +static fd_set inUse; + +/* IncomingRequest requires some care in case we have thread. I + * don't want multiple IncomingRequest called at the same time: + * if that happens you may need to rewrite your code. Just to be + * sure this doesn't happen I use a cheat test-and-set relying + * upon the global lock. It may be easier to use semaphores, but + * given that we don't use them anywhere else .... + */ +#ifdef HAVE_PTHREAD_H +static short running = 0; +#endif + +/* This is used when it's time to call CloseDisconnections(): when + * receiving a SIGPIPE, this flag is set to 1 so that IncomingRequest, + * SendBytes and RecvBytes (the functions which operates on sockets) will + * call CloseDisconnections to pick up the disconnected socket */ +static short needDisconnect = 0; + +#ifdef WITH_THREAD +extern void LockMessageSystem(); +extern void UnlockMessageSystem(); +#else +#define LockMessageSystem() +#define UnlockMessageSystem() +#endif + + +/* + * Beginning of connection functions. + */ + + +static int +TcpProtoNumber(void); + + +/* + * Remove #sock# from all maintained socket sets. + * + * It should be thread safe. + */ +void +ClearSocket(Socket sock) { + /* operates on global variables */ + GetNWSLock(&lock); + FD_CLR(sock, &connectedPipes); + FD_CLR(sock, &connectedSockets); + FD_CLR(sock, &connectedEars); + /* clear also the inUse state */ + FD_CLR(sock, &inUse); + ReleaseNWSLock(&lock); +} + + +/* It should be thread safe */ +int +ConditionSocket(Socket sd) { + int one = 1; + + if(setsockopt(sd, SOL_SOCKET, SO_KEEPALIVE, (char *)&one, sizeof(int)) < 0) { + WARN("ConditionSocket: keepalive option failed\n"); + } + + if(setsockopt(sd, TcpProtoNumber(), TCP_NODELAY, (char *)&one, sizeof(int)) < 0) { + WARN("ConditionSocket: couldn't set NODELAY flag\n"); + } + + return (1); +} + + +/* + * Time-out signal handler for CallAddr(). + */ +void +ConnectTimeOut(int sig) { + WARN("Connect timed out\n"); +} + + +/* + * Notifies all registered functions that #sock# has been closed. + * + * We should lock the call ... + */ +static void +DoDisconnectNotification(Socket sock) { + int i; + + for(i = 0; i < MAX_NOTIFIES; i++) { + if(disconnectFunctions[i] != NULL) { + disconnectFunctions[i](sock); + } + } +} + + +/* + * Time-out signal handler for RecvBytes(). + */ +void +RecvTimeOut(int sig) { + WARN("Send/Receive timed out\n"); +} + + +/* + * Returns the tcp protocol number from the network protocol data base. + * + * getprotobyname() is not thread safe. We need to lock it. + */ +static int +TcpProtoNumber(void) { + struct protoent *fetchedEntry; + static int returnValue = 0; + + if(returnValue == 0) { + GetNWSLock(&lock); + fetchedEntry = getprotobyname("tcp"); + if(fetchedEntry != NULL) { + returnValue = fetchedEntry->p_proto; + } + ReleaseNWSLock(&lock); + } + + return returnValue; +} + + +/* thread safe */ +int +CallAddr(IPAddress addr, + short port, + Socket *sock, + double timeOut) { + + struct sockaddr_in server; /* remote host address */ + Socket sd; + double start; + double ltimeout = 0; + void (*was)(int); + int tmp_errno, ret = 0; + char *peer; + + memset((char *)&server, 0, sizeof(server)); + server.sin_addr.s_addr = addr; + server.sin_family = AF_INET; + server.sin_port = htons((u_short)port); + + sd = socket(AF_INET, SOCK_STREAM, 0); + + if(sd < 0) { + *sock = NO_SOCKET; + ERROR("CallAddr: cannot create socket to server\n"); + return 0; + } + + ConditionSocket(sd); + + /* set the adaptive timeout or the user selected one */ + if (timeOut >= 0) { + ltimeout = timeOut; + } else { + /* adaptive timeouts */ + ltimeout = GetTimeOut(CONN, addr, 0); + } + if (ltimeout > 0) { + DDEBUG1("CallAddr: setting timer to %.2f\n", ltimeout); + if (SignalAlarm(ConnectTimeOut, &was) == 0) { + WARN("Failed to set the alarm signal! exiting\n"); + return 0; + } + SetRealTimer((unsigned int)ltimeout); + } + + /* let's time it */ + start = CurrentTime(); + + if(connect(sd, (struct sockaddr *)&server, sizeof(server)) < 0) { + GetNWSLock(&lock); + /* save a copy or errno */ + tmp_errno = errno; + ReleaseNWSLock(&lock); + + shutdown(sd, 2); + close(sd); + + /* get how long it took to get it wrong */ + start = CurrentTime() - start; + + if(tmp_errno == EINTR) { + WARN("CallAddr: connect timed out\n"); + } else { + ERROR1("CallAddr: connect failed (errno=%d)\n", tmp_errno); + } + *sock = NO_SOCKET; + } else { + /* get how long it took */ + start = CurrentTime() - start; + + *sock = sd; + + /* print log message */ + peer = IPAddressMachine_r(addr); + LOG4("CallAddr: connected socket %d to %s:%d in %.2f seconds\n", + sd, peer, port, start); + FREE(peer); + + GetNWSLock(&lock); + FD_SET(sd, &connectedSockets); + ReleaseNWSLock(&lock); + + /* everything is cool */ + ret = 1; + } + + if (timeOut != 0) { + RESETREALTIMER; + SignalAlarm(was, NULL); + if (timeOut < 0) { + /* adaptive timeouts */ + SetTimeOut(CONN, addr, start, 0, (ret==0)); + } + } + + return ret; +} + + +/* it should be thread safe (we lock up access to connected*) */ +void +CloseConnections(int closeEars, + int closePipes, + int closeSockets) { + Socket dead; + int i, tmp; + + if(closeEars) { + for(i = 0; i < FD_SETSIZE; i++) { + GetNWSLock(&lock); + tmp = FD_ISSET(i, &connectedEars); + ReleaseNWSLock(&lock); + if(tmp) { + dead = i; + DROP_SOCKET(&dead); + } + } + } + if(closePipes) { + for(i = 0; i < FD_SETSIZE; i++) { + GetNWSLock(&lock); + tmp = FD_ISSET(i, &connectedPipes); + ReleaseNWSLock(&lock); + if(tmp) { + dead = i; + DROP_SOCKET(&dead); + } + } + } + if(closeSockets) { + for(i = 0; i < FD_SETSIZE; i++) { + GetNWSLock(&lock); + tmp = FD_ISSET(i, &connectedSockets); + ReleaseNWSLock(&lock); + if(tmp) { + dead = i; + DROP_SOCKET(&dead); + } + } + } +} + + +/* + * Returns 1 or 0 depending on whether or not #sd# is a connected socket. + * + * it should be thread safe. + */ +static int +IsConnected(Socket sd) { + struct sockaddr peer_name_buff; + + SOCKLEN_T peer_name_buff_size = sizeof(peer_name_buff); + return(getpeername(sd, &peer_name_buff, &peer_name_buff_size) >= 0); +} + + +/* thread safe */ +int +CloseDisconnections(void) { + Socket dead, i; + int returnValue = 0, tmp; + + for(i = 0; i < FD_SETSIZE; i++) { + GetNWSLock(&lock); + tmp = FD_ISSET(i, &connectedSockets); + ReleaseNWSLock(&lock); + if(tmp && !IsConnected(i)) { + dead = i; + DROP_SOCKET(&dead); + returnValue++; + } + } + + return(returnValue); +} + + +/* (cross finger): thread safe */ +int +CloseSocket(Socket *sock, + int waitForPeer) { + + fd_set readFDs; + Socket sd = *sock; + struct timeval timeout; + int tmp_errno; + + DDEBUG1("CloseSocket: Closing connection %d\n", *sock); + + if(*sock == NO_SOCKET) { + return 1; /* Already closed; nothing to do. */ + } + + if(waitForPeer > 0) { + FD_ZERO(&readFDs); + FD_SET(sd, &readFDs); + timeout.tv_sec = waitForPeer; + timeout.tv_usec = 0; + + if(select(FD_SETSIZE, &readFDs, NULL, NULL, &timeout) < 0) { + ERROR2("CloseSocket: no response on select %d %d\n", sd, errno); + return 0; + } + } + + GetNWSLock(&lock); + tmp_errno = FD_ISSET(sd, &connectedPipes); + ReleaseNWSLock(&lock); + if(!tmp_errno) { + if(shutdown(sd, 2) < 0) { + GetNWSLock(&lock); + tmp_errno = errno; + ReleaseNWSLock(&lock); + + /* The other side may have beaten us to the reset. */ + if ((tmp_errno!=ENOTCONN) && (tmp_errno!=ECONNRESET)) { + WARN1("CloseSocket: shutdown error %d\n", tmp_errno); + } + } + } + + if(close(sd) < 0) { + GetNWSLock(&lock); + tmp_errno = errno; + ReleaseNWSLock(&lock); + + WARN2("CloseSocket: close error %d (%s)\n", tmp_errno, strerror(tmp_errno)); + } + + ClearSocket(sd); + DoDisconnectNotification(sd); + *sock = NO_SOCKET; + + return(1); +} + + +#define READ_END 0 +#define WRITE_END 1 + +int +CreateLocalChild(pid_t *pid, + Socket *parentToChild, + Socket *childToParent) { + + int childWrite[2]; + int parentWrite[2]; + int myEnd; + + if(parentToChild != NULL) { + if(pipe(parentWrite) == -1) { + FAIL1("CreateLocalChild: couldn't get pipe, errno: %d\n", errno); + } + } + if(childToParent != NULL) { + if(pipe(childWrite) == -1) { + if(parentToChild != NULL) { + close(parentWrite[0]); + close(parentWrite[1]); + } + FAIL1("CreateLocalChild: couldn't get pipe, errno: %d\n", errno); + } + } + + *pid = fork(); + + if(*pid == -1) { + if(parentToChild != NULL) { + close(parentWrite[0]); + close(parentWrite[1]); + } + if(childToParent != NULL) { + close(childWrite[0]); + close(childWrite[1]); + } + FAIL2("CreateLocalChild: couldn't fork, errno: %d (%s)\n", + errno, strerror(errno)); + } + + /* Close descriptors that this process won't be using. */ + if(parentToChild != NULL) { + myEnd = (*pid == 0) ? READ_END : WRITE_END; + close(parentWrite[1 - myEnd]); + FD_SET(parentWrite[myEnd], &connectedPipes); + *parentToChild = parentWrite[myEnd]; + } + + if(childToParent != NULL) { + myEnd = (*pid == 0) ? WRITE_END : READ_END; + close(childWrite[1 - myEnd]); + FD_SET(childWrite[myEnd], &connectedPipes); + *childToParent = childWrite[myEnd]; + } + + return(1); + +} + + +/* it should be thread safe (provided that setsockopt, bind and listen + * are thread safe) */ +int +EstablishAnEar(unsigned short startingPort, + unsigned short endingPort, + Socket *ear, + unsigned short *earPort) { + + int k32 = 32 * 1024; + int on = 1; + unsigned short port; + Socket sd = NO_SOCKET; + struct sockaddr_in server; + + for(port = startingPort; port <= endingPort; port++) { + server.sin_port = htons((u_short)port); + server.sin_addr.s_addr = INADDR_ANY; + server.sin_family = AF_INET; + if((sd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { + ERROR("EstablishAnEar: socket allocation failed\n"); + return 0; + } + (void)setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on)); + /* Set the socket buffer sizes to 32k, which just happens + * to correspond to the most common option value for + * tcpMessageMonitor activities. This allows us to use a + * client connection to conduct the experiment, rather + * than needing to configure and open a new connection. + * */ + (void)setsockopt(sd, SOL_SOCKET, SO_RCVBUF, (char *)&k32, sizeof(k32)); + (void)setsockopt(sd, SOL_SOCKET, SO_SNDBUF, (char *)&k32, sizeof(k32)); + if(bind(sd, (struct sockaddr *)&server, sizeof(server)) != -1 && + listen(sd, 5) != -1) { + break; + } + close(sd); + } + + if(port > endingPort) { + FAIL2("EstablishAnEar: couldn't find a port between %d and %d\n", startingPort, endingPort); + } + + GetNWSLock(&lock); + FD_SET(sd, &connectedEars); + DDEBUG1("Openned an ear on sock %d\n",sd); + ReleaseNWSLock(&lock); + + *ear = sd; + *earPort = port; + + DDEBUG1("EstablistAnEar: connected socket %d\n", sd); + + return(1); +} + + +/* thread safe ... hopefully. We #ifdef HAVE_THREAD_H for performance + * reasons when threads are not required. */ +int +IncomingRequest(double timeOut, + Socket *sd, + int *ldap) { + + Socket dead; + Socket i; + char lookahead; + Socket newSock; + double now; + struct sockaddr_in peer_in; + SOCKLEN_T peer_in_len = sizeof(peer_in); + fd_set readFds; + struct timeval tout; + double wakeup; + int tmp_errno, done = -1; + + /* nextToService is used to make sure that every connection gets + * a chance to be serviced. If we always started checking at 0, + * very active connections with small descriptor numbers could + * starve larger-descriptor connections. */ + /* static Socket nextToService = 0; */ + /* Obi: I don't use the "static" approach since may be trouble + * with thread. Instead of locking I use the CurrentTime() to + * (hopefully) start from a different place each time */ + Socket nextToService = ((int)CurrentTime() % FD_SETSIZE); + + /* let's check we are the only one running here ... */ +#ifdef HAVE_PTHREAD_H + GetNWSLock(&lock); + if (running != 0) { + ReleaseNWSLock(&lock); + ERROR("IncomingRequest: another instance is running!\n"); + return 0; + } + running = 1; + ReleaseNWSLock(&lock); +#endif + + *sd = NO_SOCKET; + tout.tv_usec = 0; + wakeup = CurrentTime() + timeOut; + + while (done == -1) { + + /* let's see if we need to check disconnected socket */ + if (needDisconnect == 1) { + needDisconnect = 0; + (void)CloseDisconnections(); + } + + /* is the timeout expired? */ + now = CurrentTime(); + if (now == -1 || now >= wakeup) { + if (now == -1) { + WARN("IncomingRequest: time() failed.\n"); + } + done = 0; /* didn't find anything */ + break; /* let's get out of here */ + } + + /* Construct in readFds the union of connected ears, + * pipes, and sockets. */ + /* connected* are global variables and even though we + * only read them we play safe and we lock */ + FD_ZERO(&readFds); + GetNWSLock(&lock); + for(i = 0; i < FD_SETSIZE; i++) { + if (FD_ISSET(i, &connectedSockets) && !FD_ISSET(i, &inUse)) { + FD_SET(i, &readFds); + } + if(FD_ISSET(i, &connectedPipes)) { + FD_SET(i, &readFds); + } + if(FD_ISSET(i, &connectedEars)) { + FD_SET(i, &readFds); + } + } + ReleaseNWSLock(&lock); + + /* set the timeout */ + tout.tv_sec = (unsigned int)wakeup - (unsigned int)now; + tout.tv_usec = 0; + + tmp_errno = select(FD_SETSIZE, &readFds, NULL, NULL, &tout); + if (tmp_errno == -1) { + /* save the errno value */ + GetNWSLock(&lock); + tmp_errno = errno; + ReleaseNWSLock(&lock); + + /* EINTR we have to go ahead and retry: nothing + * to do here */ + if(tmp_errno == EINTR) { + continue; + } else if(tmp_errno == EINVAL) { + /* we blew it somehow -- (osf likely) */ + /* can be because (from man page): + [EINVAL] The time limit specified by the + timeout parameter is invalid. The nfds + parameter is less than 0, or greater than + or equal to FD_SETSIZE. One of the + specified file descriptors refers to a + STREAM or multiplexer that is linked + (directly or indirectly) downstream from + a multiplexer. */ + + ERROR4("IncomingRequest: invalid select - nfds: %d, rfds: %d, timeout: %d.%d", FD_SETSIZE, readFds, tout.tv_sec, tout.tv_usec); + } else { + ERROR1("IncomingRequest: select error %d\n", tmp_errno); + } + done = 0; /* didn't find anything */ + break; /* done here */ + } else if (tmp_errno == 0) { + /* this was a timeout */ + continue; + } + + /* let's find out what socket is available and for what */ + + /* we do an all around loop to check all sockets + * starting from nextToService until we have one + * to service */ + for (i = -1; i != nextToService; i=(i+1) % FD_SETSIZE) { + if (i == -1) { + /* first time around */ + i = nextToService; + } + + if(!FD_ISSET(i, &readFds)) { + /* nothing to do here */ + continue; + } + + if(FD_ISSET(i, &connectedEars)) { + /* Add the new connection + * to connectedSockets. */ + newSock = accept(i, (struct sockaddr *)&peer_in, &peer_in_len); + if(newSock == -1) { + SocketFailure(SIGPIPE); + } else { + char *peer; + + ConditionSocket(newSock); + peer = PeerName_r(newSock); + + DDEBUG2("IncomingRequest: connected socket %d to %s\n", newSock, peer); + FREE(peer); + + /* operating on a global variable */ + GetNWSLock(&lock); + FD_SET(newSock, &connectedSockets); + ReleaseNWSLock(&lock); + } + } else if(FD_ISSET(i, &connectedPipes)) { + /* we found a good one */ + *sd = i; + *ldap = 0; + done = 1; + break; + } else { + /* Existing socket connection. */ + if(recv(i, &lookahead, 1, MSG_PEEK) > 0) { + *sd = i; +#ifdef WITH_LDAP + *ldap = ((int) lookahead == LBER_SEQUENCE); +#else + *ldap = 0; +#endif +#ifdef HAVE_PTHREAD_H + /* the socket is in use: + * client needs to call + * SocketIsAvailable to + * free it */ + /* it only makes sense in + * a threaded environment */ + GetNWSLock(&lock); + FD_SET(i, &inUse); + ReleaseNWSLock(&lock); +#endif + done = 1; + break; + } else { + /* This is how we find + * out about connections + * closed by a peer. + * Drop it from our list + * of known connections. + */ + DDEBUG1("IncomingRequest: Dropping closed connection %d\n", i); + + dead = i; + DROP_SOCKET(&dead); + } + } + } + } + + /* done */ +#ifdef HAVE_PTHREAD_H + GetNWSLock(&lock); + running = 0; + ReleaseNWSLock(&lock); +#endif + + return done; +} + + +/* thread safe */ +int +SocketIsAvailable(Socket sd) { + int ret = 1; + + /* sanity check */ + if (sd < 0) { + WARN("SocketIsAvailable: socket is negative\n"); + return 0; + } + + /* check if the socket is in connectedSockets and is in use */ + GetNWSLock(&lock); + FD_CLR(sd, &inUse); + ReleaseNWSLock(&lock); + + return ret; +} + +/* thread safe */ +int +SocketInUse(Socket sd) { + + /* sanity check */ + if (sd < 0) { + WARN("SocketInUse: socket is negative\n"); + return 0; + } + + GetNWSLock(&lock); + FD_SET(sd, &inUse); + ReleaseNWSLock(&lock); + + return 1; +} + +/* thread safe */ +int +IsOkay(Socket sd) { + fd_set readFds; + fd_set writeFds; + struct timeval timeout; + + if(sd < 0) { + return 0; + } + + FD_ZERO(&readFds); + FD_ZERO(&writeFds); + FD_SET(sd, &readFds); + FD_SET(sd, &writeFds); + timeout.tv_sec = GetTimeOut(SEND, Peer(sd), 1); + timeout.tv_usec = 0; + + return(select(FD_SETSIZE, NULL, &writeFds, NULL, &timeout) == 1); + +} + + +/* thread safe */ +void +NotifyOnDisconnection(SocketFunction notifyFn) { + int i; + + /* operating on global variables */ + GetNWSLock(&lock); + for(i = 0; i < MAX_NOTIFIES; i++) { + if(disconnectFunctions[i] == NULL) { + disconnectFunctions[i] = notifyFn; + break; + } + } + ReleaseNWSLock(&lock); +} + + +#define MAXPASSES 40 +static pid_t passedPids[MAXPASSES]; +static Socket passedSockets[MAXPASSES]; + + +int +PassSocket(Socket *sock, + pid_t child) { + + int i, childStat; + + /* Clean up any sockets previously passed to children who have exited. */ + for(i = 0; i < MAXPASSES; i++) { + if(passedPids[i] != 0) { + if((waitpid(passedPids[i], &childStat, WNOHANG) < 0) || + WIFEXITED(childStat)) { + LOG1("PassSocket: Reclaiming connection %d\n", passedSockets[i]); + (void)shutdown(passedSockets[i], 2); + (void)close(passedSockets[i]); + DoDisconnectNotification(passedSockets[i]); + passedPids[i] = 0; + } + } + } + + /* Record this socket in passedSockets and remove all other memory of it. */ + for(i = 0; i < MAXPASSES; i++) { + if(passedPids[i] == 0) { + LOG2("PassSocket: Passing connection %d to %d\n", *sock, child); + passedPids[i] = child; + passedSockets[i] = *sock; + ClearSocket(*sock); + *sock = NO_SOCKET; + return(1); + } + } + + return(0); + +} + + +/* here to be used by dnsutil.c (GetPeerName) */ +int +IsPipe(Socket sd) { + int ret = 0; + + GetNWSLock(&lock); + if (FD_ISSET(sd, &connectedPipes)) { + ret = 1; + } + ReleaseNWSLock(&lock); + + return ret; +} + +int +RecvBytes(Socket sd, + void *bytes, + size_t byteSize, + double timeOut) { + + double start = 0, myTimeOut = 0; + int isPipe, tmp, done=1; + char *nextByte; + fd_set readFds; + int recvd = 0, totalRecvd=0; + struct timeval tout, *tv; + void (*was)(int); + + /* let's see if we need to check disconnected socket */ + if (needDisconnect == 1) { + needDisconnect = 0; + (void)CloseDisconnections(); + } + + /* sanity check */ + if (sd < 0 || bytes == NULL) { + WARN("RecvBytes: parameters out of range!\n"); + return 0; + } + + /* connectedPipes is global */ + GetNWSLock(&lock); + isPipe = FD_ISSET(sd, &connectedPipes); + ReleaseNWSLock(&lock); + + FD_ZERO(&readFds); + FD_SET(sd, &readFds); + + /* select the adaptive timeouts or the passed in one. */ + if (timeOut > 0) { + myTimeOut = (int)timeOut; + if (SignalAlarm(RecvTimeOut, &was) == 0) { + WARN("Failed to set the alarm signal! Exiting\n"); + exit(1); + } + /* let's start the clock */ + start = CurrentTime(); + } + + for(nextByte=(char*)bytes; totalRecvd < byteSize; totalRecvd += recvd) { + recvd = 0; + UnlockMessageSystem(); + + /* set the timeout if requested by the user */ + if (timeOut > 0) { + myTimeOut = timeOut - (CurrentTime() - start); + if (myTimeOut < 0) { + done = 0; + break; + } + tout.tv_usec = 0; + tout.tv_sec = (int) myTimeOut; + tv = &tout; + } else { + /* 0 is the special flag for don't use touts */ + tv = NULL; + } + + tmp = select(FD_SETSIZE, &readFds, NULL, NULL, tv); + if (tmp == -1) { + LockMessageSystem(); + + /* just in case another call modify errno */ + GetNWSLock(&lock); + tmp = errno; + ReleaseNWSLock(&lock); + + /* if interrupted, let's try again */ + if(tmp == EINTR) { + continue; + } + + ERROR2("RecvBytes: select on %d failed (%s)\n", sd, strerror(tmp)); + done = 0; + break; + } else if (tmp == 0) { + LockMessageSystem(); + + /* timed out */ + ERROR1("RecvBytes: Socket %d timed out\n", sd); + + done = 0; + break; + } + + /* let's read the data */ + if (timeOut > 0) { + myTimeOut = timeOut - (CurrentTime() - start); + /* should always be > 0 since we didn't + * timed out on select */ + if (myTimeOut > 0) { + SetRealTimer((unsigned int)myTimeOut); + } else { + ERROR1("RecvBytes: trying to set negative timeout on socket %d\n", sd); + done = 0; + break; + } + } + + if (isPipe) { + /* pipe */ + recvd = read(sd, nextByte, byteSize - totalRecvd); + } else { + /* socket */ + recvd = recv(sd, nextByte, byteSize - totalRecvd, 0); + } + /* just in case another call modify errno */ + GetNWSLock(&lock); + tmp = errno; + ReleaseNWSLock(&lock); + + if (timeOut > 0) { + RESETREALTIMER; + } + LockMessageSystem(); + + if(recvd <= 0) { + WARN2("RecvBytes: read failed errno:%d, %s\n", tmp, strerror(tmp)); + ERROR3("RecvBytes: socket %d failed after %d of %d bytes\n", sd, totalRecvd, byteSize); + done = 0; + break; + } + nextByte += recvd; + } + + /* resetting the sigalarm */ + if (timeOut > 0) { + SignalAlarm(was, NULL); + } + + return totalRecvd; +} + + +/* it should be thread safe. */ +int +SendBytes( Socket sd, + const void *bytes, + size_t byteSize, + double timeOut) { + + char *nextByte; + int sent =0, totalSent = 0; + int isPipe, tmp, done = 1; + struct timeval tout, *tv; + double start, myTimeOut = 0; + void (*was)(int); + + + /* let's see if we need to check disconnected socket */ + if (needDisconnect == 1) { + needDisconnect = 0; + (void)CloseDisconnections(); + } + + /* connectedPipes is global */ + GetNWSLock(&lock); + isPipe = FD_ISSET(sd, &connectedPipes); + ReleaseNWSLock(&lock); + + /* select the adaptive timeouts or the passed in one. */ + if (timeOut > 0) { + myTimeOut = (double) timeOut; + if (SignalAlarm(RecvTimeOut, &was) == 0) { + ERROR("Failed to set the alarm signal! Exiting\n"); + exit(1); + } + } + + /* let's start the timer */ + start = CurrentTime(); + + for(nextByte = (char*)bytes; totalSent < byteSize; totalSent += sent) { + UnlockMessageSystem(); + + /* set the timeout, and if we timed out get out */ + if (timeOut > 0) { + /* 0 is the special flag for don't use touts */ + myTimeOut = timeOut - (CurrentTime() - start); + if (myTimeOut < 0) { + done = 0; + break; + } + tout.tv_usec = 0; + tout.tv_sec = (int) myTimeOut; + tv = &tout; + SetRealTimer((unsigned int)myTimeOut); + } + + if (isPipe) { + /* pipe */ + sent = write(sd, nextByte, byteSize - totalSent); + } else { + /* socket */ + sent = send(sd, nextByte, byteSize - totalSent, 0); + } + + /* errno could be modified by another thread */ + GetNWSLock(&lock); + tmp = errno; + ReleaseNWSLock(&lock); + + if (timeOut > 0) { + RESETREALTIMER; + } + + LockMessageSystem(); + if(sent <= 0) { + ERROR3("SendBytes: send on socket %d failed (errno=%d %s)\n", sd, tmp, strerror(tmp)); + done = 0; + break; + } + nextByte += sent; + } + + /* reset sigalalrm */ + if (timeOut > 0) { + SignalAlarm(was, NULL); + } + + return done; +} + + +void +SocketFailure(int sig) { + HoldSignal(SIGPIPE); + needDisconnect = 1; + if(signal(SIGPIPE, SocketFailure) == SIG_ERR) { + WARN("SocketFailure: error resetting signal\n"); + } + ReleaseSignal(SIGPIPE); +} diff --git a/src/nws_portability/strutil.c b/src/nws_portability/strutil.c new file mode 100644 index 0000000000..c01291ace0 --- /dev/null +++ b/src/nws_portability/strutil.c @@ -0,0 +1,151 @@ +/* $Id$ */ + +#include +#include +#include + +#include "strutil.h" + + +#define EOS '\0' + + +void +strcase(char *string, + CaseTypes toWhatCase) { + + char *c; + int raiseIt; + + raiseIt = (toWhatCase == ALL_UPPER) || (toWhatCase == INITIAL_UPPER); + + for(c = string; *c != EOS; c++) { + *c = raiseIt ? toupper((int)*c) : tolower((int)*c); + raiseIt = (toWhatCase == ALL_UPPER) || + ((toWhatCase == INITIAL_UPPER) && !isalpha((int)*c)); + } + +} + + +int +strnmatch(const char *string, + const char *pattern, + size_t len) { + + const char *lastChance; + const char *nextWild; + int tameLen; + + if(*pattern == '*') { + do pattern++; while (*pattern == '*'); + if(*pattern == '\0') + return 1; /* Trailing star matches everything. */ + nextWild = strchr(pattern, '*'); + tameLen = (nextWild == NULL) ? strlen(pattern) : nextWild - pattern; + /* + ** The wildcard we're processing can match any string of characters up to + ** an occurrence of the following non-wild subpattern. For each subpattern + ** occurrence, see if the remaining string matches the remaining pattern. + */ + lastChance = string + len - tameLen; + for(; string <= lastChance; string++) { + if((strncmp(string, pattern, tameLen) == 0) && + strnmatch(string + tameLen, pattern + tameLen, lastChance - string)) { + return 1; + } + } + return 0; + } + else { + nextWild = strchr(pattern, '*'); + if(nextWild == NULL) + /* No wildcards in pattern; check for exact match. */ + return (strlen(pattern) == len) && (strncmp(string, pattern, len) == 0); + else { + /* Check for leading exact match followed by a wildcard match. */ + tameLen = nextWild - pattern; + return (tameLen <= len) && + (strncmp(string, pattern, tameLen) == 0) && + strnmatch(string + tameLen, nextWild, len - tameLen); + } + } + +} + + +#ifndef HAVE_STRNLEN +size_t +strnlen( const char *s, + size_t maxlen) { + size_t i; + + if (maxlen <= 0 || s == NULL) { + return 0; + } + + for (i=0; i +#include +#ifdef HAVE_MATH_H +#include +#endif + +#include "timeouts.h" +#include "diagnostic.h" +#include "forecast_api.h" +#include "osutil.h" + +/* the default MAX timeout */ +#define DEFAULT_MAX_TIMEOUT (120.0) +#define DEFAULT_MIN_TIMEOUT (5.0) + +/* we have this number of entries */ +#define HOW_MANY_ENTRIES (1024) + +/* keep track of the measurements we got */ +typedef struct { + IPAddress addr; + FORECASTAPI_ForecastState *state[TIMEOUT_TYPES_NUMBER]; +} timeOutStruct; + +static void *lock = NULL; /* local mutex */ + +/* we have few types to keep track of */ +static timeOutStruct timeOuts[HOW_MANY_ENTRIES]; + +/* keep track of the current limits on the timeouts */ +static double to_limits[TIMEOUT_TYPES_NUMBER*2]; + +/* helper to work with modulo HOW_MANY_ENTRIES */ +#define MODPLUS(a,b,m) (((a) + (b)) % (m)) +#define MODMINUS(a,b,m) (((a) - (b) + (m)) % (m)) + +/* + * Initialize the Hash structure + */ +static void +InitHashStructure() { + unsigned int i,j; + static int initialized = 0; + + /* let's do it only once */ + if (initialized != 0) { + return; + } + + GetNWSLock(&lock); + initialized = 1; + + for (i=0; i < HOW_MANY_ENTRIES; i++) { + timeOuts[i].addr = 0; + for (j=0; j < TIMEOUT_TYPES_NUMBER; j++) { + timeOuts[i].state[j] = NULL; + } + } + ReleaseNWSLock(&lock); + + for (j=0; j < TIMEOUT_TYPES_NUMBER; j++) { + /* set defaults to sane state */ + SetDefaultTimeout(j, DEFAULT_MIN_TIMEOUT, DEFAULT_MAX_TIMEOUT); + } +} + +/* we use a simple hash table structure to speed up the access to the + * timeout structures. If #addr# is not in the table it is added and if + * the table is full, space is made for the addr. + * Returns # the index at which addr is been found + */ +static int +HashIndex(IPAddress addr) { + unsigned int i, end; + + /* initialize the structure */ + InitHashStructure(); + + i = addr % HOW_MANY_ENTRIES; + end = MODMINUS(i, 1, HOW_MANY_ENTRIES); + + GetNWSLock(&lock); + for (; i != end; i = MODPLUS(i, 1, HOW_MANY_ENTRIES)) { + if ((timeOuts[i].addr == addr) || (timeOuts[i].addr == 0)) { + /* either we found it, or emtpy slot: is good */ + break; + } + + } + if (i == end) { + /* table is full: emtpying one slot */ + i = addr % HOW_MANY_ENTRIES; + timeOuts[i].addr = 0; + } + + /* if this is the first time we have the item, get it to a sane + * state */ + if (timeOuts[i].addr == 0) { + timeOuts[i].addr = addr; + for (end=0; end < TIMEOUT_TYPES_NUMBER; end++) { + /* Initialize the forecaster state */ + if (timeOuts[i].state[end] != NULL) { + FORECASTAPI_FreeForecastState(&timeOuts[i].state[end]); + } + timeOuts[i].state[end] = FORECASTAPI_NewForecastState(); + } + } + + ReleaseNWSLock(&lock); + + return i; +} + +void +SetDefaultTimeout(timeoutTypes type, double min, double max) { + /* sanity check */ + if (type < RECV || type > USER3) { + WARN("SetDefaultTimeout: unknown type\n"); + return; + } + if (min < 0) { + min = 1; + } + if (max < min) { + max = 2*min; + } + + GetNWSLock(&lock); + to_limits[type*2] = min; + to_limits[type*2 + 1] = max; + ReleaseNWSLock(&lock); +} + +void +GetDefaultTimeout(timeoutTypes type, double *min, double *max) { + /* sanity check */ + if (type < RECV || type > USER3) { + WARN("SetDefaultTimeout: unknown type\n"); + return; + } + GetNWSLock(&lock); + *min = to_limits[type*2]; + *max = to_limits[type*2 + 1]; + ReleaseNWSLock(&lock); +} + + +double +GetTimeOut(timeoutTypes type, IPAddress addr, long size) { + unsigned int i = -1; + double ret; + FORECASTAPI_ForecastCollection forecast; + + /* sanity check */ + if (type < 0 || type > USER3) { + WARN("GetTimeOut: type out of range\n"); + return 0; + } + + /* if addr is 0 (for example if it's a pipe) we pick the minimums + * timeout */ + if (addr == 0) { + return to_limits[type*2]; + } + + i = HashIndex(addr); + + /* let's get a forecast */ + GetNWSLock(&lock); + if (FORECASTAPI_ComputeForecast(timeOuts[i].state[type], &forecast) != 0) { + forecast.forecasts[type].forecast = to_limits[type*2 + 1]; + } + ReleaseNWSLock(&lock); + + /* let's get 3 standard deviations (if we have sqrt) */ +#ifdef HAVE_SQRT + ret = forecast.forecasts[0].forecast + 3 * sqrt(forecast.forecasts[FORECASTAPI_MSE_FORECAST].error); +#else + ret = forecast.forecasts[0].forecast + 2 * forecast.forecasts[FORECASTAPI_MAE_FORECAST].error; +#endif + + /* adjust for the size of the packet */ + if (size > 0) { + ret = ret * size; + } + + if (ret > to_limits[type*2 + 1]) { + ret = to_limits[type*2 + 1]; + } else if (ret < to_limits[type*2]) { + ret = to_limits[type*2]; + } + + return ret; +} + +void +SetTimeOut(timeoutTypes type, IPAddress addr, double duration, long size, int timedOut) { + unsigned int i; + FORECASTAPI_Measurement m; + + /* sanity check */ + if (type < 0 || type > USER3) { + WARN("SetTimeOut: type out of range\n"); + return; + } + if (duration < 0) { + WARN("SetTimeOut: duration negative?\n"); + return; + } + + /* if addr is 0 (for example if it's a pipe) we return */ + if (addr == 0) { + return; + } + + i = HashIndex(addr); + + m.timeStamp = CurrentTime(); + /* adjust for the size of the packet */ + if (size > 0) { + m.measurement = duration / size; + } else { + m.measurement = duration; + } + + /* adjustments if we timed out before */ + if (timedOut) { + m.measurement += 5; + } + GetNWSLock(&lock); + FORECASTAPI_UpdateForecast(timeOuts[i].state[type], &m, 1); + ReleaseNWSLock(&lock); +} diff --git a/testsuite/.cvsignore b/testsuite/.cvsignore new file mode 100644 index 0000000000..e0a2126249 --- /dev/null +++ b/testsuite/.cvsignore @@ -0,0 +1,4 @@ +.deps .libs Makefile Makefile.in dict_usage dict_crash dynar_int dynar_double dynar_string +multidict_crash +test_log +gs_example gs_example_receive gs_example_send diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am new file mode 100644 index 0000000000..624147767e --- /dev/null +++ b/testsuite/Makefile.am @@ -0,0 +1,37 @@ +INCLUDES = -I$(top_srcdir)/src/include +AM_CFLAGS=-g -Wno-unused-function +AM_LDFLAGS=-g + +CLEANFILES = *~ test a.out *.o +DISTCLEANFILES=Makefile.in *~ + +# Test stuff + +TESTS_PROGS= \ + dynar_int dynar_double dynar_string \ + dict_usage dict_crash \ + test_log \ + config_usage + +# multidict_crash + + +noinst_PROGRAMS = $(TESTS_PROGS) gs_example_send gs_example_receive +noinst_SCRIPTS = gs_example + +dynar_int_LDADD= $(top_srcdir)/src/base/libgrasutils.a +dynar_double_LDADD= $(top_srcdir)/src/base/libgrasutils.a +dynar_string_LDADD= $(top_srcdir)/src/base/libgrasutils.a + +dict_usage_LDADD= $(top_srcdir)/src/base/libgrasutils.a +dict_crash_LDADD= $(top_srcdir)/src/base/libgrasutils.a +multidict_crash_LDADD= $(top_srcdir)/src/base/libgrasutils.a + +config_usage_LDADD= $(top_srcdir)/src/base/libgrasutils.a + +test_log_LDADD= $(top_srcdir)/src/base/libgrasutils.a + +gs_example_send_LDADD= $(top_srcdir)/src/base/libgrasutils.a +gs_example_receive_LDADD= $(top_srcdir)/src/base/libgrasutils.a + +TESTS=$(TESTS_PROGS) #gs_example diff --git a/testsuite/gras/gras_dummy.c b/testsuite/gras/gras_dummy.c new file mode 100644 index 0000000000..9e9112c38b --- /dev/null +++ b/testsuite/gras/gras_dummy.c @@ -0,0 +1,94 @@ +/* $Id$ */ + +/* gras_dummy - dummy implementation of function depending on the RL or SG, */ +/* so that we can build a dummy library to test the Utils */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + + +#include "gras_private.h" + +gras_error_t gras_process_init() { + return unknown_error; +} + +gras_error_t gras_process_finalize() { + return unknown_error; +} + +gras_error_t gras_sock_client_open(const char *host, short port, + /* OUT */ gras_sock_t **sock) { + return unknown_error; +} + + +gras_error_t gras_sock_server_open(unsigned short startingPort, + unsigned short endingPort, + /* OUT */ gras_sock_t **sock) { + + return unknown_error; +} + +gras_error_t gras_sock_close(gras_sock_t *sock) { + return unknown_error; +} + +unsigned short gras_sock_get_my_port(gras_sock_t *sd) { + return -1; +} + +unsigned short gras_sock_get_peer_port(gras_sock_t *sd) { + return -1; +} + +char * gras_sock_get_peer_name(gras_sock_t *sd) { + return NULL; +} + +gras_error_t grasMsgRecv(gras_msg_t **msg, + double timeOut) { + return unknown_error; +} +gras_error_t gras_msg_send(gras_sock_t *sd, + gras_msg_t *msg, + e_gras_free_directive_t freeDirective) { + return unknown_error; +} +gras_error_t gras_rawsock_server_open(unsigned short startingPort, + unsigned short endingPort, + unsigned int bufSize, gras_rawsock_t **sock) { + return unknown_error; +} +gras_error_t gras_rawsock_client_open(const char *host, short port, + unsigned int bufSize, gras_rawsock_t **sock) { + return unknown_error; +} +gras_error_t gras_rawsock_close(gras_rawsock_t *sd) { + return unknown_error; +} +unsigned short gras_rawsock_get_peer_port(gras_rawsock_t *sd) { + return -1; +} +gras_error_t +gras_rawsock_recv(gras_rawsock_t *sd, unsigned int expSize, unsigned int msgSize, + unsigned int timeout) { + return unknown_error; +} +gras_error_t +gras_rawsock_send(gras_rawsock_t *sd, unsigned int expSize, unsigned int msgSize){ + return unknown_error; +} +grasProcessData_t *grasProcessDataGet() { + return NULL; +} + +double gras_time() { + return 0; +} + +void gras_sleep(unsigned long sec,unsigned long usec) {} + diff --git a/testsuite/gras/gs_example.in b/testsuite/gras/gs_example.in new file mode 100644 index 0000000000..d0a6ed2497 --- /dev/null +++ b/testsuite/gras/gs_example.in @@ -0,0 +1,4 @@ +#! @BASH@ -e + +./gs_example_send | ./gs_example_receive + diff --git a/testsuite/gras/gs_example_receive.c b/testsuite/gras/gs_example_receive.c new file mode 100644 index 0000000000..a510cd1ade --- /dev/null +++ b/testsuite/gras/gs_example_receive.c @@ -0,0 +1,167 @@ +/* gs_example_receive.c */ + +#include +#include +#include +#include + +/* structs */ +struct list { + int v; + struct list *l; +}; + +struct s_pair { + int *pa; + int *pb; +}; + +struct s_mixed { + unsigned char c1; + unsigned long int l1; + unsigned char c2; + unsigned long int l2; +}; + +/* prototypes */ +void disp_l(struct list *l); +long int +string_size_callback(void *vars, + struct s_gs_type *p_type, + void *data); + +/* local functions */ +void +disp_l(struct list *l) { + if (l) { + printf("%d ", l->v); + disp_l(l->l); + } +} + +long int +string_size_callback(void *vars, + struct s_gs_type *p_type, + void *data) { + return 1+(long int)strlen(data); +} + +/* main */ +int +main(int argc, char **argv) { + struct list **pl = NULL; + int *array = NULL; + struct s_pair *p_pair = NULL; + char *str = NULL; + struct s_mixed *mixed = NULL; + + struct s_gs_type_driver *t_driver = NULL; + struct s_gs_net_driver *n_driver = NULL; + struct s_gs_type_bag *bag = NULL; + struct s_gs_connection *cnx = NULL; + + struct s_gs_type_bag_ops *bag_ops = NULL; + + struct s_gs_type *t_signed_int = NULL; + struct s_gs_type *t_list = NULL; + struct s_gs_type *t_ref_list = NULL; + + struct s_gs_type *t_array = NULL; + + struct s_gs_type *t_ref_sint = NULL; + struct s_gs_type *t_pair = NULL; + + struct s_gs_type *t_char = NULL; + struct s_gs_type *t_string = NULL; + + struct s_gs_type *t_u_char = NULL; + struct s_gs_type *t_u_long_int = NULL; + struct s_gs_type *t_mixed = NULL; + + struct s_gs_message_instance *mi = NULL; + + gs_init(argc, argv); + gs_purge_cmd_line(&argc, argv); + + t_driver = gs_type_driver_init("rl"); + n_driver = gs_net_driver_init("fd"); + + bag = gs_type_bag_alloc(t_driver); + bag_ops = bag->bag_ops; + + { + int fd = 0; + cnx = gs_net_connection_accept(n_driver, &fd); + } + + bag_ops->register_incoming_connection(bag, cnx); + + /* sequence 1 */ + t_signed_int = bag_ops->get_type_by_name(bag, NULL, "signed int"); + t_list = gs_type_new_struct(bag, NULL, "list"); + t_ref_list = gs_type_new_ref(bag, NULL, "p_list", t_list); + + gs_type_struct_append_field(t_list, "v", t_signed_int); + gs_type_struct_append_field(t_list, "l", t_ref_list); + + /* sequence 2 */ + t_array = gs_type_new_array(bag, NULL, "array", 5, t_signed_int); + + /* sequence 3 */ + t_ref_sint = gs_type_new_ref(bag, NULL, "p_ref_sint", t_signed_int); + t_pair = gs_type_new_struct(bag, NULL, "pair"); + + gs_type_struct_append_field(t_pair, "pa", t_ref_sint); + gs_type_struct_append_field(t_pair, "pb", t_ref_sint); + + /* sequence 4 */ + t_char = bag_ops->get_type_by_name(bag, NULL, "signed char"); + t_string = gs_type_new_array_with_callback(bag, NULL, "string", -1, t_char, string_size_callback, NULL); + + /* sequence 5 */ + t_u_char = bag_ops->get_type_by_name(bag, NULL, "unsigned char"); + t_u_long_int = bag_ops->get_type_by_name(bag, NULL, "unsigned long int"); + t_mixed = gs_type_new_struct(bag, NULL, "mixed"); + + gs_type_struct_append_field(t_mixed, "c1", t_u_char); + gs_type_struct_append_field(t_mixed, "l1", t_u_long_int); + gs_type_struct_append_field(t_mixed, "c2", t_u_char); + gs_type_struct_append_field(t_mixed, "l2", t_u_long_int); + + /* message receive */ + mi = gs_message_init_receive(bag, cnx); + fprintf(stderr, "\nreceiving sequence 1\n----------------\n"); + pl = gs_message_receive_next_sequence(mi); + + printf("( "); + disp_l(*pl); + printf(")\n"); + + fprintf(stderr, "\nreceiving sequence 2\n----------------\n"); + array = gs_message_receive_next_sequence(mi); + + { + int i = 0; + for (i = 0; i < 5; i++) { + printf("array[%d] = %d\n", i, array[i]); + } + } + + fprintf(stderr, "\nreceiving sequence 3\n----------------\n"); + p_pair = gs_message_receive_next_sequence(mi); + printf("pair.pa = %p, *pair.pa = %d\n", (*p_pair).pa, *((*p_pair).pa)); + printf("pair.pb = %p, *pair.pb = %d\n", (*p_pair).pb, *((*p_pair).pb)); + + fprintf(stderr, "\nreceiving sequence 4\n----------------\n"); + str = gs_message_receive_next_sequence(mi); + printf("str = %s\n", str); + + fprintf(stderr, "\nreceiving sequence 5\n----------------\n"); + mixed = gs_message_receive_next_sequence(mi); + printf("c1=%c c2=%c; l1=%ld l2=%ld\n", + mixed->c1, mixed->c2, mixed->l1, mixed->l2); + + gs_exit(); + + return 0; +} diff --git a/testsuite/gras/gs_example_send.c b/testsuite/gras/gs_example_send.c new file mode 100644 index 0000000000..54ff8a6c86 --- /dev/null +++ b/testsuite/gras/gs_example_send.c @@ -0,0 +1,197 @@ +/* gs_example_send */ + +#include +#include +#include +#include + +//#define PARSING + +/* structs */ +struct list { + int v; + struct list *l; +}; + +struct s_pair { + int *pa; + int *pb; +}; + +#ifdef PARSING +GRAS_DEFINE_TYPE(struct_s_mixed, + struct s_mixed { + unsigned char c1; + unsigned long int l1; + unsigned char c2; + unsigned long int l2; + } +); +#else + struct s_mixed { + unsigned char c1; + unsigned long int l1; + unsigned char c2; + unsigned long int l2; + }; +#endif + +/* prototypes */ +struct list * cons(int v, struct list *l); +long int +string_size_callback(void *vars, + struct s_gs_type *p_type, + void *data); + +/* local functions */ +struct list * +cons(int v, struct list *l) { + struct list *nl = malloc(sizeof (struct list)); + + nl->v = v; + nl->l = l; + + return nl; +} + +long int +string_size_callback(void *vars, + struct s_gs_type *p_type, + void *data) { + return 1+(long int)strlen(data); +} + +/* main */ +int +main(int argc, char **argv) { + struct list *l = NULL; + + struct s_pair pair; + + int array[5] = + { + 11, 12, 13, 14, 15, + }; + + struct s_mixed mixed = + { + 'a',1.0,'b',2.0 + }; + + struct s_gs_type_driver *t_driver = NULL; + struct s_gs_net_driver *n_driver = NULL; + struct s_gs_type_bag *bag = NULL; + struct s_gs_connection *cnx = NULL; + + struct s_gs_type_bag_ops *bag_ops = NULL; + + struct s_gs_type *t_signed_int = NULL; + struct s_gs_type *t_list = NULL; + struct s_gs_type *t_ref_list = NULL; + + struct s_gs_type *t_array = NULL; + + struct s_gs_type *t_ref_sint = NULL; + struct s_gs_type *t_pair = NULL; + + struct s_gs_type *t_char = NULL; + struct s_gs_type *t_string = NULL; + +#ifndef PARSING + struct s_gs_type *t_u_char = NULL; + struct s_gs_type *t_u_long_int = NULL; +#endif + + struct s_gs_type *t_mixed = NULL; + + struct s_gs_message *m = NULL; + struct s_gs_message_instance *mi = NULL; + + + gs_init(argc, argv); + gs_purge_cmd_line(&argc, argv); + gras_log_control_set("NDR.thresh=debug"); + + t_driver = gs_type_driver_init("rl"); + n_driver = gs_net_driver_init("fd"); + + bag = gs_type_bag_alloc(t_driver); + bag_ops = bag->bag_ops; + + { + int fd = 1; + cnx = gs_net_connection_connect(n_driver, &fd); + } + + bag_ops->register_outgoing_connection(bag, cnx); + + /* sequence 1 */ + t_signed_int = bag_ops->get_type_by_name(bag, NULL, "signed int"); + t_list = gs_type_new_struct(bag, NULL, "list"); + t_ref_list = gs_type_new_ref(bag, NULL, "p_list", t_list); + + gs_type_struct_append_field(t_list, "v", t_signed_int); + gs_type_struct_append_field(t_list, "l", t_ref_list); + + /* sequence 2 */ + t_array = gs_type_new_array(bag, NULL, "array", 5, t_signed_int); + + /* sequence 3 */ + t_ref_sint = gs_type_new_ref(bag, NULL, "p_ref_sint", t_signed_int); + t_pair = gs_type_new_struct(bag, NULL, "pair"); + + gs_type_struct_append_field(t_pair, "pa", t_ref_sint); + gs_type_struct_append_field(t_pair, "pb", t_ref_sint); + + /* sequence 4 */ + t_char = bag_ops->get_type_by_name(bag, NULL, "signed char"); + t_string = gs_type_new_array_with_callback(bag, NULL, "string", -1, t_char, string_size_callback, NULL); + + /* sequence 5 */ +#ifdef PARSING + t_mixed = gs_type_get_by_symbol(bag,struct_s_mixed); +#else + t_u_char = bag_ops->get_type_by_name(bag, NULL, "unsigned char"); + t_u_long_int = bag_ops->get_type_by_name(bag, NULL, "unsigned long int"); + t_mixed = gs_type_new_struct(bag, NULL, "s_mixed"); + + gs_type_struct_append_field(t_mixed, "c1", t_u_char); + gs_type_struct_append_field(t_mixed, "l1", t_u_long_int); + gs_type_struct_append_field(t_mixed, "c2", t_u_char); + gs_type_struct_append_field(t_mixed, "l2", t_u_long_int); +#endif + + /* message declaration */ + m = gs_message_new(bag, NULL, "my msg"); + gs_message_append_new_sequence(m, t_ref_list); + gs_message_append_new_sequence(m, t_array); + gs_message_append_new_sequence(m, t_pair); + gs_message_append_new_sequence(m, t_string); + gs_message_append_new_sequence(m, t_mixed); + + /* data setup */ + l = cons (1, l); + l = cons (2, l); + l = cons (3, l); + + pair.pa = malloc(sizeof(int)); + pair.pb = pair.pa; + *(pair.pa) = 17; + + /* message send */ + mi = gs_message_init_send_by_name(bag, cnx, "my msg"); + fprintf(stderr, "\nsending sequence 1\n----------------\n"); + gs_message_send_next_sequence(mi, &l); + fprintf(stderr, "\nsending sequence 2\n----------------\n"); + gs_message_send_next_sequence(mi, (void*)array); + fprintf(stderr, "\nsending sequence 3\n----------------\n"); + gs_message_send_next_sequence(mi, &pair); + fprintf(stderr, "\nsending sequence 4\n----------------\n"); + gs_message_send_next_sequence(mi, (void*)"Hello, World"); + fprintf(stderr, "\nsending sequence 5\n----------------\n"); + gs_message_send_next_sequence(mi, (void*)&mixed); + + gs_exit(); + + return 0; +} diff --git a/testsuite/gras/test_log.c b/testsuite/gras/test_log.c new file mode 100644 index 0000000000..3a6f8644d6 --- /dev/null +++ b/testsuite/gras/test_log.c @@ -0,0 +1,57 @@ +// $Id$ +// Copyright (c) 2001, Bit Farm, Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +/** + * + * Run it w/o arguments, and also try: + * + * ./test_l4c Test.thresh=0 + * + * which should print out the DEBUG message. + * + * 'make test' will run various test cases. + * + */ + +#include +#include + +GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(Test, Top); +GRAS_LOG_NEW_CATEGORY(Top); + +int main(int ac, char **av) { + gras_error_t errcode; + + if (ac > 1) { + TRYFAIL(gras_log_control_set(av[1])); + } else { + TRYFAIL(gras_log_control_set("root.thresh=debug log.thresh=debug")); + } + DEBUG1("val=%d", 1); + WARNING1("val=%d", 2); + CDEBUG2(Top, "val=%d%s", 3, "!"); + CRITICAL6("false alarm%s%s%s%s%s%s", "","","","","","!"); + + return 0; +} diff --git a/testsuite/xbt/config_usage.c b/testsuite/xbt/config_usage.c new file mode 100644 index 0000000000..05a605f651 --- /dev/null +++ b/testsuite/xbt/config_usage.c @@ -0,0 +1,92 @@ +/* $Id$ */ + +/* test config - test code to the config set */ + +#include +#include + +/*====[ Prototypes ]=========================================================*/ +gras_cfg_t *make_set(void); /* build a minimal set */ +int test3(void); /* validate=>not enought */ +int test4(void); /* validate=> too many */ +int test5(void); /* get users list */ + + +/*====[ Code ]===============================================================*/ +gras_cfg_t *make_set(){ + gras_cfg_t *set=NULL; + gras_error_t errcode; + + TRYFAIL(gras_cfg_new(&set)); + gras_cfg_register_str(set,"hostname:1_to_1_string"); + gras_cfg_register_str(set,"user:1_to_10_string"); + gras_cfg_register_str(set,"speed:1_to_1_int"); + + gras_cfg_set_parse(set, + "hostname:veloce " + "user:mquinson\nuser:ecaron\tuser:fsuter"); + return set; +} + + +/*----[ get users list ]-----------------------------------------------------*/ +int test5() +{ + gras_dynar_t *dyn; + char *str; + int i; + + gras_cfg_t *set=make_set(); + gras_cfg_set_parse(set,"speed:42"); + gras_cfg_check(set); + gras_cfg_get_dynar(set,"user",&dyn); + printf("Count: %d; Options: \n",gras_dynar_length(dyn)); + gras_dynar_foreach(dyn,i,str) { + printf("%s\n",str); + } + gras_cfg_free(&set); + return 1; +} + +int main() { + gras_error_t errcode; + gras_cfg_t *set; + int ival; + + gras_log_control_set("config.thresh=debug root.thresh=info"); + + fprintf(stderr,"==== Alloc and free a config set.\n"); + set=make_set(); + gras_cfg_dump("test set","",set); + gras_cfg_free(&set); + + + fprintf(stderr,"==== Try to use an unregistered option (err msg expected).\n"); + set=make_set(); + TRYEXPECT(mismatch_error,gras_cfg_set_parse(set,"color:blue")); + gras_cfg_free(&set); + + + fprintf(stderr, + "\n==== Validation test (err msg about not enough values expected)\n"); + set=make_set(); + gras_cfg_check(set); + gras_cfg_free(&set); + + fprintf(stderr,"\n==== Validation test (too many elements)\n"); + set=make_set(); + gras_cfg_set_parse(set,"hostname:toto:42"); + gras_cfg_set_parse(set,"speed:42 speed:24"); + gras_cfg_check(set); + gras_cfg_get_int(set,"speed",&ival); + printf("speed value: %d\n",ival); + gras_cfg_free(&set); + + fprintf(stderr,"\n§§§§§§§§§ %s §§§§§§§§§\n§§§ Expected: %s\n", + "TEST5", + "Count: 3; Options:\\nmquinson\\necaron\\nfsuter"); + test5(); + + return 0; +} + diff --git a/testsuite/xbt/dict_crash.c b/testsuite/xbt/dict_crash.c new file mode 100644 index 0000000000..71fd12090a --- /dev/null +++ b/testsuite/xbt/dict_crash.c @@ -0,0 +1,158 @@ +/* $Id$ */ + +/* dict_crash - A crash test for dictionnaries */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#include +#include +#include + +#define NB_ELM 200000 +#define SIZEOFKEY 1024 + +static void print_str(void *str); +static void print_str(void *str) { + printf("%s",(char*)str); +} + + +static gras_error_t traverse(gras_dict_t *head) { + gras_error_t errcode; + gras_dict_cursor_t *cursor=NULL; + char *key; + char *data; + + //gras_dict_dump(head,(void (*)(void*))&printf); + TRY(gras_dict_cursor_new(head,&cursor)); + + while (gras_dict_cursor_next(cursor) == no_error) { + TRY(gras_dict_cursor_get_key(cursor,&key)); + TRY(gras_dict_cursor_get_data(cursor,(void**)&data)); + // printf(" Seen: %s=%s\n",key,data); + if (strcmp(key,data)) { + printf("Key(%s) != value(%s). Abording\n",key,data); + abort(); + } + } + gras_dict_cursor_free(cursor); + return no_error; +} + +static gras_error_t countelems(gras_dict_t *head,int*count) { + gras_dict_cursor_t *cursor; + gras_error_t errcode; + char *key; + void *data; + *count=0; + + TRY(gras_dict_cursor_new(head,&cursor)); + + while ((errcode=gras_dict_cursor_next(cursor))==no_error) { + TRY(gras_dict_cursor_get_data(cursor,&data)); + TRY(gras_dict_cursor_get_key(cursor,&key)); + (*count)++; + } + return no_error; +} + +int main() { + gras_error_t errcode; + gras_dict_t *head=NULL; + int i,j,k, nb; + char *key; + void *data; + + TRY(gras_log_control_set("root.thresh=info")); + srand((unsigned int)time(NULL)); + + printf("Dictionnary: CRASH test:\n"); + printf(" Fill the struct, count its elems and frees the structure (x20)\n"); + printf(" using 1000 elements with %d chars long randomized keys.\n",SIZEOFKEY); + printf(" (a point is a test)\n"); + + for (i=0;i<20;i++) { + TRYFAIL(gras_dict_new(&head)); + if (i%10) printf("."); else printf("%d",i/10); fflush(stdout); + nb=0; + for (j=0;j<1000;j++) { + if (!(key=malloc(SIZEOFKEY))) { + fprintf(stderr,"Out of memory\n"); + return 1; + } + + for (k=0;k +#include + +#include + +GRAS_LOG_EXTERNAL_CATEGORY(dict); + +static gras_error_t fill(gras_dict_t **head); +static gras_error_t debuged_add(gras_dict_t *head,const char*key); +static gras_error_t search(gras_dict_t *head,const char*key); +static gras_error_t debuged_remove(gras_dict_t *head,const char*key); +static gras_error_t traverse(gras_dict_t *head); + +static void print_str(void *str); +static void print_str(void *str) { + printf("%s",(char*)str); +} + +static gras_error_t fill(gras_dict_t **head) { + gras_error_t errcode; + printf("\n Fill in the dictionnary\n"); + + TRY(gras_dict_new(head)); + TRY(debuged_add(*head,"12")); + TRY(debuged_add(*head,"12a")); + TRY(debuged_add(*head,"12b")); + TRY(debuged_add(*head,"123")); + TRY(debuged_add(*head,"123456")); + // Child becomes child of what to add + TRY(debuged_add(*head,"1234")); + // Need of common ancestor + TRY(debuged_add(*head,"123457")); + + return no_error; +} + +static gras_error_t debuged_add(gras_dict_t *head,const char*key) +{ + gras_error_t errcode; + char *data=strdup(key); + + printf(" - Add %s\n",key); + errcode=gras_dict_insert(head,key,data,&free); + if (GRAS_LOG_ISENABLED(dict,gras_log_priority_debug)) { + gras_dict_dump(head,(void (*)(void*))&printf); + fflush(stdout); + } + return errcode; +} + +static gras_error_t search(gras_dict_t *head,const char*key) { + void *data; + gras_error_t errcode; + + + errcode=gras_dict_retrieve(head,key,&data); + printf(" - Search %s. Found %s\n",key,data?(char*)data:"(null)");fflush(stdout); + if (strcmp((char*)data,key)) + return mismatch_error; + return errcode; +} + +static gras_error_t debuged_remove(gras_dict_t *head,const char*key) +{ + gras_error_t errcode; + + printf(" Remove '%s'\n",key);fflush(stdout); + errcode=gras_dict_remove(head,key); + // gras_dict_dump(head,(void (*)(void*))&printf); + return errcode; +} + + +static gras_error_t traverse(gras_dict_t *head) { + gras_error_t errcode; + gras_dict_cursor_t *cursor=NULL; + char *key; + char *data; + + // gras_dict_dump(head,&print_str); + TRY(gras_dict_cursor_new(head,&cursor)); + + while (gras_dict_cursor_next(cursor) == no_error) { + TRY(gras_dict_cursor_get_key(cursor,&key)); + TRY(gras_dict_cursor_get_data(cursor,(void**)&data)); + printf(" - Seen: %s->%s\n",key,data); + if (strcmp(key,data)) { + printf("Key(%s) != value(%s). Abording\n",key,data); + abort(); + } + } + gras_dict_cursor_free(cursor); + return no_error; +} + +int main() { + gras_error_t errcode; + gras_dict_t *head=NULL; + char *data; + + // TRY(gras_log_control_set("root.thresh=info dict_collapse.thresh=debug")); + //TRY(gras_log_control_set("root.thresh=info")); + // TRY(gras_log_control_set("root.thresh=info dict_search.thresh=info dict.thresh=debug dict_collapse.thresh=debug log.thresh=debug")); + + printf("\nGeneric dictionnary: USAGE test:\n"); + + printf(" Traverse the empty dictionnary\n"); + TRYFAIL(traverse(head)); + + TRYFAIL(fill(&head)); + printf(" Free the dictionnary\n"); + gras_dict_free(&head); + + TRYFAIL(fill(&head)); + + printf(" - Change some values\n"); + printf(" - Change 123 to 'Changed 123'\n"); + TRYFAIL(gras_dict_insert(head,"123",strdup("Changed 123"),&free)); + printf(" - Change 123 back to '123'\n"); + TRYFAIL(gras_dict_insert(head,"123",strdup("123"),&free)); + printf(" - Change 12a to 'Dummy 12a'\n"); + TRYFAIL(gras_dict_insert(head,"12a",strdup("Dummy 12a"),&free)); + printf(" - Change 12a to '12a'\n"); + TRYFAIL(gras_dict_insert(head,"12a",strdup("12a"),&free)); + + // gras_dict_dump(head,(void (*)(void*))&printf); + printf(" - Traverse the resulting dictionnary\n"); + TRYFAIL(traverse(head)); + + printf(" - Retrive values\n"); + TRYFAIL(gras_dict_retrieve(head,"123",(void**)&data)); + assert(data); + TRYFAIL(strcmp("123",data)); + + TRYEXPECT(gras_dict_retrieve(head,"Can't be found",(void**)&data),mismatch_error); + TRYEXPECT(gras_dict_retrieve(head,"123 Can't be found",(void**)&data),mismatch_error); + TRYEXPECT(gras_dict_retrieve(head,"12345678 NOT",(void**)&data),mismatch_error); + + TRYFAIL(search(head,"12a")); + TRYFAIL(search(head,"12b")); + TRYFAIL(search(head,"12")); + TRYFAIL(search(head,"123456")); + TRYFAIL(search(head,"1234")); + TRYFAIL(search(head,"123457")); + + printf(" - Traverse the resulting dictionnary\n"); + TRYFAIL(traverse(head)); + + // gras_dict_dump(head,(void (*)(void*))&printf); + + printf(" Free the dictionnary (twice)\n"); + gras_dict_free(&head); + gras_dict_free(&head); // frees it twice to see if it triggers an error + + printf(" - Traverse the resulting dictionnary\n"); + TRYFAIL(traverse(head)); + + printf("\n"); + TRYFAIL(fill(&head)); + printf(" - Remove the data (traversing the resulting dictionnary each time)\n"); + TRYEXPECT(debuged_remove(head,"Does not exist"),mismatch_error); + TRYFAIL(traverse(head)); + + TRYCATCH(debuged_remove(head,"12345"),mismatch_error); + TRYFAIL(traverse(head)); + + TRYFAIL(debuged_remove(head,"12a")); TRYFAIL(traverse(head)); + TRYFAIL(debuged_remove(head,"12b")); TRYFAIL(traverse(head)); + TRYFAIL(debuged_remove(head,"12")); TRYFAIL(traverse(head)); + TRYFAIL(debuged_remove(head,"123456")); TRYFAIL(traverse(head)); + TRYEXPECT(debuged_remove(head,"12346"),mismatch_error); TRYFAIL(traverse(head)); + TRYFAIL(debuged_remove(head,"1234")); TRYFAIL(traverse(head)); + TRYFAIL(debuged_remove(head,"123457")); TRYFAIL(traverse(head)); + TRYFAIL(debuged_remove(head,"123")); TRYFAIL(traverse(head)); + TRYEXPECT(debuged_remove(head,"12346"),mismatch_error); TRYFAIL(traverse(head)); + + gras_dict_free(&head); + gras_dict_free(&head); + + return 0; +} diff --git a/testsuite/xbt/dynar_double.c b/testsuite/xbt/dynar_double.c new file mode 100644 index 0000000000..9449e7d9b2 --- /dev/null +++ b/testsuite/xbt/dynar_double.c @@ -0,0 +1,123 @@ +/* $Id$ */ + +/* dynar_double: A test case for the dynar using doubles as content */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#include +#include + +int main(int argc,char *argv[]) { + gras_dynar_t *d; + gras_error_t errcode; + int cpt; + double d1,d2; + + fprintf(stderr,"==== Push/shift 5000 doubles\n"); + TRYFAIL(gras_dynar_new(&d,sizeof(double),NULL)); + for (cpt=0; cpt< 5000; cpt++) { + d1=(double)cpt; + TRYFAIL(gras_dynar_push(d,&d1)); + } + for (cpt=0; cpt< 5000; cpt++) { + d1=(double)cpt; + gras_dynar_shift(d,&d2); + if (d1 != d2) { + fprintf(stderr, + "The retrieved value is not the same than the injected one (%f!=%f)\n", + d1,d2); + abort(); + } + } + gras_dynar_free(d); + + + fprintf(stderr,"==== Unshift/pop 5000 doubles\n"); + TRYFAIL(gras_dynar_new(&d,sizeof(double),NULL)); + for (cpt=0; cpt< 5000; cpt++) { + d1=(double)cpt; + TRYFAIL(gras_dynar_unshift(d,&d1)); + } + for (cpt=0; cpt< 5000; cpt++) { + d1=(double)cpt; + gras_dynar_pop(d,&d2); + if (d1 != d2) { + fprintf(stderr, + "The retrieved value is not the same than the injected one (%f!=%f)\n", + d1,d2); + abort(); + } + } + gras_dynar_free(d); + + + + fprintf(stderr,"==== Push 5000 doubles, insert 1000 doubles in the middle, shift everything\n"); + TRYFAIL(gras_dynar_new(&d,sizeof(double),NULL)); + for (cpt=0; cpt< 5000; cpt++) { + d1=(double)cpt; + TRYFAIL(gras_dynar_push(d,&d1)); + } + for (cpt=0; cpt< 1000; cpt++) { + d1=(double)cpt; + TRYFAIL(gras_dynar_insert_at(d,2500,&d1)); + } + + for (cpt=0; cpt< 2500; cpt++) { + d1=(double)cpt; + gras_dynar_shift(d,&d2); + if (d1 != d2) { + fprintf(stderr, + "The retrieved value is not the same than the injected one at the begining (%f!=%f)\n", + d1,d2); + abort(); + } + // fprintf (stderr,"Pop %d, length=%d \n",cpt, gras_dynar_length(d)); + } + for (cpt=999; cpt>=0; cpt--) { + d1=(double)cpt; + gras_dynar_shift(d,&d2); + if (d1 != d2) { + fprintf(stderr, + "The retrieved value is not the same than the injected one in the middle (%f!=%f)\n", + d1,d2); + abort(); + } + } + for (cpt=2500; cpt< 5000; cpt++) { + d1=(double)cpt; + gras_dynar_shift(d,&d2); + if (d1 != d2) { + fprintf(stderr, + "The retrieved value is not the same than the injected one at the end (%f!=%f)\n", + d1,d2); + abort(); + } + } + gras_dynar_free(d); + + + fprintf(stderr,"==== Push 5000 double, remove 2000-4000. free the rest\n"); + TRYFAIL(gras_dynar_new(&d,sizeof(double),NULL)); + for (cpt=0; cpt< 5000; cpt++) { + d1=(double)cpt; + TRYFAIL(gras_dynar_push(d,&d1)); + } + for (cpt=2000; cpt< 4000; cpt++) { + d1=(double)cpt; + gras_dynar_remove_at(d,2000,&d2); + if (d1 != d2) { + fprintf(stderr, + "Remove a bad value. Got %f, expected %f\n", + d2,d1); + abort(); + } + } + gras_dynar_free(d); + + return 0; +} diff --git a/testsuite/xbt/dynar_int.c b/testsuite/xbt/dynar_int.c new file mode 100644 index 0000000000..51e3e989f1 --- /dev/null +++ b/testsuite/xbt/dynar_int.c @@ -0,0 +1,148 @@ +/* $Id$ */ + +/* dynar_int: A test case for the dynar using integers as content */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#include +#include + +#define NB_ELEM 5000 + +int main(int argc,char *argv[]) { + gras_dynar_t *d; + gras_error_t errcode; + int i,cpt,cursor; + + // TRYFAIL(gras_log_control_set("root.thresh=debug dynar.thresh=info")); + TRYFAIL(gras_log_control_set("root.thresh=info")); + fprintf(stderr,"==== Push %d int, set them again 3 times, traverse them, shift them\n",NB_ELEM); + TRYFAIL(gras_dynar_new(&d,sizeof(int),NULL)); + for (cpt=0; cpt< NB_ELEM; cpt++) { + TRYFAIL(gras_dynar_push(d,&cpt)); + // fprintf (stderr,"Push %d, length=%d \n",cpt, gras_dynar_length(d)); + } + for (cpt=0; cpt< NB_ELEM; cpt++) { + TRYFAIL(gras_dynar_set(d,cpt,&cpt)); + } + for (cpt=0; cpt< NB_ELEM; cpt++) { + TRYFAIL(gras_dynar_set(d,cpt,&cpt)); + } + for (cpt=0; cpt< NB_ELEM; cpt++) { + TRYFAIL(gras_dynar_set(d,cpt,&cpt)); + } + cpt=0; + gras_dynar_foreach(d,cursor,i){ + if (i != cpt) { + fprintf(stderr, + "The retrieved value is not the same than the injected one (%d!=%d)\n", + i,cpt); + abort(); + } + cpt++; + } + if (cpt !=NB_ELEM) { + fprintf(stderr, + "Cannot retrieve my %d values. Last got one is %d\n",NB_ELEM, + cpt); + abort(); + } + + for (cpt=0; cpt< NB_ELEM; cpt++) { + gras_dynar_shift(d,&i); + if (i != cpt) { + fprintf(stderr, + "The retrieved value is not the same than the injected one (%d!=%d)\n", + i,cpt); + abort(); + } + // fprintf (stderr,"Pop %d, length=%d \n",cpt, gras_dynar_length(d)); + } + gras_dynar_free(d); + + + fprintf(stderr,"==== Unshift/pop %d int\n",NB_ELEM); + TRYFAIL(gras_dynar_new(&d,sizeof(int),NULL)); + for (cpt=0; cpt< NB_ELEM; cpt++) { + TRYFAIL(gras_dynar_unshift(d,&cpt)); + // fprintf (stderr,"Push %d, length=%d \n",cpt, gras_dynar_length(d)); + } + for (cpt=0; cpt< NB_ELEM; cpt++) { + gras_dynar_pop(d,&i); + if (i != cpt) { + fprintf(stderr, + "The retrieved value is not the same than the injected one (%d!=%d)\n", + i,cpt); + abort(); + } + // fprintf (stderr,"Pop %d, length=%d \n",cpt, gras_dynar_length(d)); + } + gras_dynar_free(d); + + + + fprintf(stderr,"==== Push %d int, insert 1000 int in the middle, shift everything\n",NB_ELEM); + TRYFAIL(gras_dynar_new(&d,sizeof(int),NULL)); + for (cpt=0; cpt< NB_ELEM; cpt++) { + TRYFAIL(gras_dynar_push(d,&cpt)); + // fprintf (stderr,"Push %d, length=%d \n",cpt, gras_dynar_length(d)); + } + for (cpt=0; cpt< 1000; cpt++) { + TRYFAIL(gras_dynar_insert_at(d,2500,&cpt)); + // fprintf (stderr,"Push %d, length=%d \n",cpt, gras_dynar_length(d)); + } + + for (cpt=0; cpt< 2500; cpt++) { + gras_dynar_shift(d,&i); + if (i != cpt) { + fprintf(stderr, + "The retrieved value is not the same than the injected one at the begining (%d!=%d)\n", + i,cpt); + abort(); + } + // fprintf (stderr,"Pop %d, length=%d \n",cpt, gras_dynar_length(d)); + } + for (cpt=999; cpt>=0; cpt--) { + gras_dynar_shift(d,&i); + if (i != cpt) { + fprintf(stderr, + "The retrieved value is not the same than the injected one in the middle (%d!=%d)\n", + i,cpt); + abort(); + } + } + for (cpt=2500; cpt< NB_ELEM; cpt++) { + gras_dynar_shift(d,&i); + if (i != cpt) { + fprintf(stderr, + "The retrieved value is not the same than the injected one at the end (%d!=%d)\n", + i,cpt); + abort(); + } + } + gras_dynar_free(d); + + + fprintf(stderr,"==== Push %d int, remove 2000-4000. free the rest\n",NB_ELEM); + TRYFAIL(gras_dynar_new(&d,sizeof(int),NULL)); + for (cpt=0; cpt< NB_ELEM; cpt++) { + TRYFAIL(gras_dynar_push(d,&cpt)); + } + for (cpt=2000; cpt< 4000; cpt++) { + gras_dynar_remove_at(d,2000,&i); + if (i != cpt) { + fprintf(stderr, + "Remove a bad value. Got %d, expected %d\n", + i,cpt); + abort(); + } + // fprintf (stderr,"remove %d, length=%d \n",cpt, gras_dynar_length(d)); + } + gras_dynar_free(d); + + return 0; +} diff --git a/testsuite/xbt/dynar_string.c b/testsuite/xbt/dynar_string.c new file mode 100644 index 0000000000..6b82126a6f --- /dev/null +++ b/testsuite/xbt/dynar_string.c @@ -0,0 +1,155 @@ +/* $Id$ */ + +/* dynar_string: A test case for the dynar using strings as content */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#include +#include + +void free_string(void *d); + +void free_string(void *d){ + free(*(void**)d); +} + +int main(int argc,char *argv[]) { + gras_dynar_t *d; + gras_error_t errcode; + int cpt; + char buf[1024]; + char *s1,*s2; + + fprintf(stderr,"==== Push 5000 strings, set them again 3 times, shift them\n"); + TRYFAIL(gras_dynar_new(&d,sizeof(char*),&free_string)); + for (cpt=0; cpt< 5000; cpt++) { + sprintf(buf,"%d",cpt); + s1=strdup(buf); + TRYFAIL(gras_dynar_push(d,&s1)); + } + for (cpt=0; cpt< 5000; cpt++) { + sprintf(buf,"%d",cpt); + s1=strdup(buf); + TRYFAIL(gras_dynar_remplace(d,cpt,&s1)); + } + for (cpt=0; cpt< 5000; cpt++) { + sprintf(buf,"%d",cpt); + s1=strdup(buf); + TRYFAIL(gras_dynar_remplace(d,cpt,&s1)); + } + for (cpt=0; cpt< 5000; cpt++) { + sprintf(buf,"%d",cpt); + s1=strdup(buf); + TRYFAIL(gras_dynar_remplace(d,cpt,&s1)); + } + for (cpt=0; cpt< 5000; cpt++) { + sprintf(buf,"%d",cpt); + gras_dynar_shift(d,&s2); + if (strcmp(buf,s2)) { + fprintf(stderr, + "The retrieved value is not the same than the injected one (%s!=%s)\n", + buf,s2); + abort(); + } + free(s2); + } + gras_dynar_free(d); + + + fprintf(stderr,"==== Unshift/pop 5000 strings\n"); + TRYFAIL(gras_dynar_new(&d,sizeof(char**),&free_string)); + for (cpt=0; cpt< 5000; cpt++) { + sprintf(buf,"%d",cpt); + s1=strdup(buf); + TRYFAIL(gras_dynar_unshift(d,&s1)); + } + for (cpt=0; cpt< 5000; cpt++) { + sprintf(buf,"%d",cpt); + gras_dynar_pop(d,&s2); + if (strcmp(buf,s2)) { + fprintf(stderr, + "The retrieved value is not the same than the injected one (%s!=%s)\n", + buf,s2); + abort(); + } + free(s2); + } + gras_dynar_free(d); + + + + fprintf(stderr,"==== Push 5000 strings, insert 1000 strings in the middle, shift everything\n"); + TRYFAIL(gras_dynar_new(&d,sizeof(char*),&free_string)); + for (cpt=0; cpt< 5000; cpt++) { + sprintf(buf,"%d",cpt); + s1=strdup(buf); + TRYFAIL(gras_dynar_push(d,&s1)); + } + for (cpt=0; cpt< 1000; cpt++) { + sprintf(buf,"%d",cpt); + s1=strdup(buf); + TRYFAIL(gras_dynar_insert_at(d,2500,&s1)); + } + + for (cpt=0; cpt< 2500; cpt++) { + sprintf(buf,"%d",cpt); + gras_dynar_shift(d,&s2); + if (strcmp(buf,s2)) { + fprintf(stderr, + "The retrieved value is not the same than the injected one at the begining (%s!=%s)\n", + buf,s2); + abort(); + } + free(s2); + } + for (cpt=999; cpt>=0; cpt--) { + sprintf(buf,"%d",cpt); + gras_dynar_shift(d,&s2); + if (strcmp(buf,s2)) { + fprintf(stderr, + "The retrieved value is not the same than the injected one in the middle (%s!=%s)\n", + buf,s2); + abort(); + } + free(s2); + } + for (cpt=2500; cpt< 5000; cpt++) { + sprintf(buf,"%d",cpt); + gras_dynar_shift(d,&s2); + if (strcmp(buf,s2)) { + fprintf(stderr, + "The retrieved value is not the same than the injected one at the end (%s!=%s)\n", + buf,s2); + abort(); + } + free(s2); + } + gras_dynar_free(d); + + + fprintf(stderr,"==== Push 5000 strings, remove 2000-4000. free the rest\n"); + TRYFAIL(gras_dynar_new(&d,sizeof(char*),&free_string)); + for (cpt=0; cpt< 5000; cpt++) { + sprintf(buf,"%d",cpt); + s1=strdup(buf); + TRYFAIL(gras_dynar_push(d,&s1)); + } + for (cpt=2000; cpt< 4000; cpt++) { + sprintf(buf,"%d",cpt); + gras_dynar_remove_at(d,2000,&s2); + if (strcmp(buf,s2)) { + fprintf(stderr, + "Remove a bad value. Got %s, expected %s\n", + s2,buf); + abort(); + } + free(s2); + } + gras_dynar_free(d); + + return 0; +} diff --git a/testsuite/xbt/multidict_crash.c b/testsuite/xbt/multidict_crash.c new file mode 100644 index 0000000000..0f7e5f0d11 --- /dev/null +++ b/testsuite/xbt/multidict_crash.c @@ -0,0 +1,97 @@ +/* $Id$ */ + +/* multidict_crash - A crash test for multi-level dictionnaries */ + +/* Authors: Martin Quinson */ +/* Copyright (C) 2003 the OURAGAN project. */ + +/* This program is free software; you can redistribute it and/or modify it + under the terms of the license (GNU LGPL) which comes with this package. */ + +#include +#include + +#include + +#define NB_ELM 10/*00*/ +#define MULTICACHE_DEPTH 5 +#define KEY_SIZE 12 /*512*/ +#define NB_TEST 20 +int verbose=0; + +static gras_error_t test1(); + +static gras_error_t test1() { + gras_error_t errcode; + gras_dict_t *head=NULL; + int i,j,k,l; + char **key = NULL; + char **val = NULL; + void *data; + + printf("\nGeneric multicache: CRASH test:\n"); + printf(" Fill the struct and frees it %d times, using %d elements, depth of multicache=%d\n",NB_TEST,NB_ELM,MULTICACHE_DEPTH); + printf(" with %d chars long randomized keys. (a point is a test)\n",KEY_SIZE); + + for (i=0;i