From: robertc <> Date: Mon, 10 Mar 2003 11:55:33 +0000 (+0000) Subject: Summary: Merge ESI to HEAD. X-Git-Tag: SQUID_3_0_PRE1~272 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=43ae1d95a7add005149cc7a82fae6609d40f3b44;p=thirdparty%2Fsquid.git Summary: Merge ESI to HEAD. Keywords: Patches applied: * robertc@squid-cache.org--squid/squid--esi--3.0--patch-30 Fixup merged for gcc2 * robertc@squid-cache.org--squid/squid--esi--3.0--patch-29 Merge recent HEAD changes. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-28 ESI Tweaks * robertc@squid-cache.org--squid/squid--esi--3.0--patch-27 Fixup from merge. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-26 Bootstrapped. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-25 Merge from HEAD. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-24 Merge from HEAD. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-23 Merged from head to avert conflicts. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-22 Fix broken merge. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-21 Merge from HEAD. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-20 Refactor ESI code to clarify reentrancy bugs. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-19 Fixup ESI (again!) * robertc@squid-cache.org--squid/squid--esi--3.0--patch-18 Merge parser fix from HEAD. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-17 bootstrapped. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-16 Merge from HEAD. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-15 Fix breakage after head merge. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-14 Merge from HEAD. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-13 Prevent bogus compile warnings on TrieNode.cci * robertc@squid-cache.org--squid/squid--esi--3.0--patch-12 Updated after head merge + bugfixes. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-11 Merge from HEAD. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-10 Merge from HEAD. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-9 merge from HEAD * robertc@squid-cache.org--squid/squid--esi--3.0--patch-8 Merge with HEAD * robertc@squid-cache.org--squid/squid--esi--3.0--patch-7 Merge from HEAD * robertc@squid-cache.org--squid/squid--esi--3.0--patch-6 ESI custom parser implementation * robertc@squid-cache.org--squid/squid--esi--3.0--patch-5 Fix problems from last merge and tweak parser. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-4 Bootstrap, plus update to deal with HEAD changes * robertc@squid-cache.org--squid/squid--esi--3.0--patch-3 Merge from HEAD * robertc@squid-cache.org--squid/squid--esi--3.0--patch-30 Fixup merged for gcc2 * robertc@squid-cache.org--squid/squid--esi--3.0--patch-2 Merge from HEAD (typename fix) * robertc@squid-cache.org--squid/squid--esi--3.0--patch-20 Refactor ESI code to clarify reentrancy bugs. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-21 Merge from HEAD. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-22 Fix broken merge. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-23 Merged from head to avert conflicts. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-24 Merge from HEAD. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-25 Merge from HEAD. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-26 Bootstrapped. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-27 Fixup from merge. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-28 ESI Tweaks * robertc@squid-cache.org--squid/squid--esi--3.0--patch-29 Merge recent HEAD changes. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-1 Import CVS esi tag * robertc@squid-cache.org--squid/squid--esi--3.0--patch-10 Merge from HEAD. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-11 Merge from HEAD. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-12 Updated after head merge + bugfixes. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-13 Prevent bogus compile warnings on TrieNode.cci * robertc@squid-cache.org--squid/squid--esi--3.0--patch-14 Merge from HEAD. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-15 Fix breakage after head merge. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-16 Merge from HEAD. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-17 bootstrapped. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-18 Merge parser fix from HEAD. * robertc@squid-cache.org--squid/squid--esi--3.0--patch-19 Fixup ESI (again!) * robertc@squid-cache.org--squid/squid--esi--3.0--base-0 tag of robertc@squid-cache.org--squid/squid--HEAD--3.0--patch-18 --- diff --git a/bootstrap.sh b/bootstrap.sh index bbffbbb443..0063602f6a 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -69,3 +69,6 @@ bootstrap automake$amver --foreign --add-missing bootstrap autoconf$acver echo "Autotool bootstrapping complete." +echo "bootstrapping sub projects." +cd lib/libTrie && $SHELL ./bootstrap.sh + diff --git a/configure.in b/configure.in index 8e363baf38..6c97bee8b1 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ dnl Configuration input file for Squid dnl dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9) dnl -dnl $Id: configure.in,v 1.327 2003/03/04 01:39:45 robertc Exp $ +dnl $Id: configure.in,v 1.328 2003/03/10 04:55:33 robertc Exp $ dnl dnl dnl @@ -13,7 +13,7 @@ AC_CONFIG_SRCDIR([src/main.cc]) AC_CONFIG_AUX_DIR(cfgaux) AM_INIT_AUTOMAKE(squid, 3.0-DEVEL) AM_CONFIG_HEADER(include/autoconf.h) -AC_REVISION($Revision: 1.327 $)dnl +AC_REVISION($Revision: 1.328 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AM_MAINTAINER_MODE @@ -515,6 +515,17 @@ AC_ARG_ENABLE(delay-pools, fi ]) +AM_CONDITIONAL(USE_ESI, false) +AC_ARG_ENABLE(esi, + AC_HELP_STRING([--enable-esi],[Enable ESI for accelerators. Requires libexpat. Enabling ESI will cause squid to follow the Edge Acceleration Specification (www.esi.org). This causes squid to IGNORE client Cache-Control headers. DO NOT use this in a squid configured as a web proxy, ONLY use it in a squid configured for webserver acceleration.]), + ac_cv_use_esi=$enableval, ac_cv_use_esi=no) +AC_CACHE_CHECK(whether to enable ESI,ac_cv_use_esi, ac_cv_use_esi=no) +if test "$ac_cv_use_esi" = "yes" ; then + AC_DEFINE(ESI,1,[Compile the ESI processor and Surrogate header support]) + AM_CONDITIONAL(USE_ESI, true) + XTRA_LIBS="$XTRA_LIBS -lexpat" +fi + dnl This is a developer only option. Developers know how to set defines dnl dnl AC_ARG_ENABLE(mem-gen-trace, @@ -2477,4 +2488,7 @@ AC_CONFIG_FILES([\ helpers/external_acl/wbinfo_group/Makefile \ helpers/external_acl/winbind_group/Makefile ]) + +AC_CONFIG_SUBDIRS(lib/libTrie) + AC_OUTPUT diff --git a/doc/Programming-Guide/prog-guide.sgml b/doc/Programming-Guide/prog-guide.sgml index 28e3b5fe95..79121c3e5c 100644 --- a/doc/Programming-Guide/prog-guide.sgml +++ b/doc/Programming-Guide/prog-guide.sgml @@ -2,7 +2,7 @@
Squid Programmers Guide Squid Developers -$Id: prog-guide.sgml,v 1.55 2003/02/05 10:35:30 robertc Exp $ +$Id: prog-guide.sgml,v 1.56 2003/03/10 04:55:35 robertc Exp $ Squid is a WWW Cache application developed by the National Laboratory @@ -384,6 +384,14 @@ Squid consists of the following major components (the ``standard'' mode), or only specific request headers will be allowed (the ``paranoid'' mode). +Delay Pools + +

+ Delay pools provide bandwidth regulation by restricting the rate + at which squid reads from a server before sending to a client. They + do not prevent cache hits from being sent at maximal capacity. Delay + pools can aggregate the bandwidth from multiple machines and users + to provide more or less general restrictions. Internet Cache Protocol @@ -459,14 +467,12 @@ Squid consists of the following major components see . -Delay Pools - +ESI

- Delay pools provide bandwidth regulation by restricting the rate - at which squid reads from a server before sending to a client. They - do not prevent cache hits from being sent at maximal capacity. Delay - pools can aggregate the bandwidth from multiple machines and users - to provide more or less general restrictions. + ESI is an implementation of Edge Side Includes (.) + ESI is implemented as a client side stream and a small + modification to client_side_reply.c to check whether + ESI should be inserted into the reply stream or not. External Programs diff --git a/doc/debug-sections.txt b/doc/debug-sections.txt index 3e4f0fe4ec..197f72cdcb 100644 --- a/doc/debug-sections.txt +++ b/doc/debug-sections.txt @@ -89,7 +89,9 @@ section 82 External ACL section 83 SSL accelerator support section 84 Helper process maintenance section 85 Client side request management - after parsing, before caching +section 86 ESI processing section 87 client side stream management section 88 Client side reply management - from store to stream section 89 NAT / IP Interception section 90 Store Client +section 91 Http Surrogate-Control Header diff --git a/errors/Bulgarian/ERR_ESI b/errors/Bulgarian/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Bulgarian/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Catalan/ERR_ESI b/errors/Catalan/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Catalan/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Czech/ERR_ESI b/errors/Czech/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Czech/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Danish/ERR_ESI b/errors/Danish/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Danish/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Dutch/ERR_ESI b/errors/Dutch/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Dutch/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/English/ERR_ESI b/errors/English/ERR_ESI new file mode 100644 index 0000000000..c3da99021e --- /dev/null +++ b/errors/English/ERR_ESI @@ -0,0 +1,28 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w. diff --git a/errors/Estonian/ERR_ESI b/errors/Estonian/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Estonian/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Finnish/ERR_ESI b/errors/Finnish/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Finnish/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/French/ERR_ESI b/errors/French/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/French/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/German/ERR_ESI b/errors/German/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/German/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Hebrew/ERR_ESI b/errors/Hebrew/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Hebrew/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Hungarian/ERR_ESI b/errors/Hungarian/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Hungarian/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Italian/ERR_ESI b/errors/Italian/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Italian/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Japanese/ERR_ESI b/errors/Japanese/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Japanese/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Korean/ERR_ESI b/errors/Korean/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Korean/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Polish/ERR_ESI b/errors/Polish/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Polish/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Portuguese/ERR_ESI b/errors/Portuguese/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Portuguese/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Romanian/ERR_ESI b/errors/Romanian/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Romanian/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Russian-1251/ERR_ESI b/errors/Russian-1251/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Russian-1251/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Russian-koi8-r/ERR_ESI b/errors/Russian-koi8-r/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Russian-koi8-r/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Serbian/ERR_ESI b/errors/Serbian/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Serbian/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Simplify_Chinese/ERR_ESI b/errors/Simplify_Chinese/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Simplify_Chinese/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Slovak/ERR_ESI b/errors/Slovak/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Slovak/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Spanish/ERR_ESI b/errors/Spanish/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Spanish/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Swedish/ERR_ESI b/errors/Swedish/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Swedish/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Traditional_Chinese/ERR_ESI b/errors/Traditional_Chinese/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Traditional_Chinese/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/errors/Turkish/ERR_ESI b/errors/Turkish/ERR_ESI new file mode 100644 index 0000000000..b78db43c91 --- /dev/null +++ b/errors/Turkish/ERR_ESI @@ -0,0 +1,29 @@ + + +ERROR: The requested URL could not be retrieved + + +

The requested URL could not be retrieved

+
+

+While trying to retrieve the URL: +%U +

+The following error was encountered: +

+ESI Processing failed. +
+ +

+The ESI processor returned: +

+%Z +
+ +

+This means that: +

+ The surrogate was not able to process the ESI template. Please report this error to the webmaster. 
+
+

Your webmaster is %w.

+

This page is in english because a translation has not been made. If you are able to, please create a translation and contact the squid project to get it included.

diff --git a/include/RefCount.h b/include/RefCount.h index 5f02d6a99b..9aa9efbbe4 100644 --- a/include/RefCount.h +++ b/include/RefCount.h @@ -1,6 +1,6 @@ /* - * $Id: RefCount.h,v 1.3 2003/01/23 00:36:47 robertc Exp $ + * $Id: RefCount.h,v 1.4 2003/03/10 04:56:20 robertc Exp $ * * DEBUG: section xx Refcount allocator * AUTHOR: Robert Collins @@ -37,58 +37,98 @@ #define _SQUID_REFCOUNT_H_ template -class RefCount { + +class RefCount +{ + public: - RefCount () : p_ (NULL) {} - RefCount (C const *p) : p_(p) { if (p_) p_->RefCountReference(); } - ~RefCount() + RefCount () : p_ (NULL) {} + + RefCount (C const *p) : p_(p) { reference (*this); } + + ~RefCount() { - dereference(); + dereference(); } - RefCount (const RefCount &p) : p_(p.p_) + + RefCount (const RefCount &p) : p_(p.p_) { - reference (p); + reference (p); } - RefCount& operator = (const RefCount& p) + + RefCount& operator = (const RefCount& p) { - // DO NOT CHANGE THE ORDER HERE!!! - // This preserves semantics on self assignment - reference(p); - dereference(); - p_ = p.p_; - return *this; + // DO NOT CHANGE THE ORDER HERE!!! + // This preserves semantics on self assignment + C const *newP_ = p.p_; + reference(p); + dereference(); + p_ = newP_; + return *this; } - C const * operator-> () const {return p_; } - C * operator-> () {return const_cast(p_); } - C const & operator * () const {return *p_; } - C & operator * () {return *const_cast(p_); } - C const * getRaw() const{return p_; } - C * getRaw() {return const_cast(p_); } - bool operator == (const RefCount& p) const + + C const * operator-> () const {return p_; } + + C * operator-> () {return const_cast(p_); } + + C const & operator * () const {return *p_; } + + C & operator * () {return *const_cast(p_); } + + C const * getRaw() const{return p_; } + + C * getRaw() {return const_cast(p_); } + + bool operator == (const RefCount& p) const { - return p.p_ == p_; + return p.p_ == p_; } + private: - void dereference() + void dereference() { - if (p_ && p_->RefCountDereference() == 0) p_->deleteSelf(); + if (p_ && p_->RefCountDereference() == 0) + p_->deleteSelf(); + + p_ = NULL; } - void reference (const RefCount& p) + + void reference (const RefCount& p) { - if (p.p_) p.p_->RefCountReference(); + if (p.p_) + p.p_->RefCountReference(); } - C const *p_; + + C const *p_; }; struct RefCountable_ { RefCountable_():count_(0){} + virtual ~RefCountable_(){} + virtual void deleteSelf() const = 0; /* Not private, to allow class hierarchies */ - void RefCountReference() const { ++count_; } - unsigned RefCountDereference() const { return --count_; } + void RefCountReference() const + { +#if REFCOUNT_DEBUG + debug (0,1)("Incrementing this %p from count %u\n",this,count_); +#endif + + ++count_; + } + + unsigned RefCountDereference() const + { +#if REFCOUNT_DEBUG + debug (0,1)("Decrementing this %p from count %u\n",this,count_); +#endif + + return --count_; + } + private: mutable unsigned count_; }; diff --git a/include/autoconf.h.in b/include/autoconf.h.in index 2ecf87c8b9..08da4c14ab 100644 --- a/include/autoconf.h.in +++ b/include/autoconf.h.in @@ -45,6 +45,9 @@ /* Define if you have problems with memPools and want to disable Pools */ #undef DISABLE_POOLS +/* Compile the ESI processor and Surrogate header support */ +#undef ESI + /* Enable Forw/Via database */ #undef FORW_VIA_DB diff --git a/include/profiling.h b/include/profiling.h index d078bd5fc8..27188fb735 100644 --- a/include/profiling.h +++ b/include/profiling.h @@ -17,7 +17,8 @@ static inline hrtime_t get_tick(void) { hrtime_t regs; - asm volatile ("rdtsc":"=A" (regs)); + +asm volatile ("rdtsc":"=A" (regs)); return regs; /* We need return value, we rely on CC to optimise out needless subf calls */ /* Note that "rdtsc" is relatively slow OP and stalls the CPU pipes, so use it wisely */ @@ -28,22 +29,25 @@ static inline hrtime_t get_tick(void) { hrtime_t regs; - asm volatile ("rpcc $0":"=A" (regs)); /* I'm not sure of syntax */ + +asm volatile ("rpcc $0":"=A" (regs)); /* I'm not sure of syntax */ return regs; } + #elif defined(_M_IX86) && defined(_MSC_VER) /* x86 platform on Microsoft C Compiler ONLY */ -static __inline hrtime_t +static __inline hrtime_t get_tick(void) { hrtime_t regs; __asm { - cpuid - rdtsc - mov eax,DWORD PTR regs[0] - mov edx,DWORD PTR regs[4] + cpuid + rdtsc + mov eax,DWORD PTR regs[0] + mov edx,DWORD PTR regs[4] } return regs; } + #else #warning Unsupported CPU. Define function get_tick(). Disabling USE_XPROF_STATS... #undef USE_XPROF_STATS @@ -96,15 +100,22 @@ typedef enum { XPROF_file_read, XPROF_file_write, XPROF_file_close, +#ifdef ESI + XPROF_esiExpressionEval, + XPROF_esiProcessing, + XPROF_esiParsing, +#endif XPROF_LAST } xprof_type; #define XP_NOBEST (hrtime_t)-1 typedef struct _xprof_stats_node xprof_stats_node; + typedef struct _xprof_stats_data xprof_stats_data; -struct _xprof_stats_data { +struct _xprof_stats_data +{ hrtime_t start; hrtime_t stop; hrtime_t delta; @@ -114,7 +125,8 @@ struct _xprof_stats_data { int64_t summ; }; -struct _xprof_stats_node { +struct _xprof_stats_node +{ const char *name; xprof_stats_data accu; xprof_stats_data hist; diff --git a/lib/Makefile.am b/lib/Makefile.am index 23efb8519c..d3558d6958 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,8 +1,10 @@ ## Process this file with automake to produce Makefile.in # -# $Id: Makefile.am,v 1.9 2003/02/05 10:36:39 robertc Exp $ +# $Id: Makefile.am,v 1.10 2003/03/10 04:56:21 robertc Exp $ # +SUBDIRS = libTrie + if ENABLE_XPROF_STATS XPROF_STATS_SOURCE = Profiler.c else @@ -55,6 +57,8 @@ libmiscutil_a_SOURCES = \ uudecode.c \ $(XPROF_STATS_SOURCE) libmiscutil_a_LIBADD = \ + libTrie/src/Trie.o \ + libTrie/src/TrieNode.o \ @LIBOBJS@ # $(top_srcdir)/include/version.h should be a dependency libregex_a_SOURCES = \ diff --git a/lib/libTrie/AUTHORS b/lib/libTrie/AUTHORS new file mode 100644 index 0000000000..ccdd37d305 --- /dev/null +++ b/lib/libTrie/AUTHORS @@ -0,0 +1 @@ +Robert Collins diff --git a/lib/libTrie/COPYING b/lib/libTrie/COPYING new file mode 100644 index 0000000000..d60c31a97a --- /dev/null +++ b/lib/libTrie/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/lib/libTrie/ChangeLog b/lib/libTrie/ChangeLog new file mode 100644 index 0000000000..123cc74da4 --- /dev/null +++ b/lib/libTrie/ChangeLog @@ -0,0 +1 @@ +TODO: Fill this out diff --git a/lib/libTrie/INSTALL b/lib/libTrie/INSTALL new file mode 100644 index 0000000000..a4b34144dc --- /dev/null +++ b/lib/libTrie/INSTALL @@ -0,0 +1,229 @@ +Copyright 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/lib/libTrie/Makefile.am b/lib/libTrie/Makefile.am new file mode 100644 index 0000000000..e3ad274358 --- /dev/null +++ b/lib/libTrie/Makefile.am @@ -0,0 +1,8 @@ +## Process this file with automake to produce Makefile.in +# +# $Id: Makefile.am,v 1.1 2003/03/10 04:56:24 robertc Exp $ +# + +AUTOMAKE_OPTIONS = dist-bzip2 subdir-objects 1.5 +DIST_SUBDIRS = include src test +SUBDIRS = src test diff --git a/lib/libTrie/Makefile.in b/lib/libTrie/Makefile.in new file mode 100644 index 0000000000..e17cce14c7 --- /dev/null +++ b/lib/libTrie/Makefile.in @@ -0,0 +1,430 @@ +# Makefile.in generated by automake 1.6.3 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# +# $Id: Makefile.in,v 1.1 2003/03/10 04:56:24 robertc Exp $ +# +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +DEPDIR = @DEPDIR@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +MAINT = @MAINT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +install_sh = @install_sh@ + +AUTOMAKE_OPTIONS = dist-bzip2 subdir-objects 1.5 +DIST_SUBDIRS = include src test +SUBDIRS = src test +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = + +RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ + uninstall-info-recursive all-recursive install-data-recursive \ + install-exec-recursive installdirs-recursive install-recursive \ + uninstall-recursive check-recursive installcheck-recursive +DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ + Makefile.in NEWS aclocal.m4 config.guess config.h.in config.sub \ + configure configure.in depcomp install-sh ltmain.sh missing \ + mkinstalldirs +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: + +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) + +$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h + +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOHEADER) + touch $(srcdir)/config.h.in + +distclean-hdr: + -rm -f config.h stamp-h1 +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +ETAGS = etags +ETAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = . +distdir = $(PACKAGE)-$(VERSION) + +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } + +GZIP_ENV = --best +distcleancheck_listfiles = find . -type f -print + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist dist-all: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + $(am__remove_distdir) + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \ + && cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && (test `find $$dc_install_base -type f -print | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + find $$dc_install_base -type f -print ; \ + exit 1; } >&2 ) \ + && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ + && rm -f $(distdir).tar.gz \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @echo "$(distdir).tar.gz is ready for distribution" | \ + sed 'h;s/./=/g;p;x;p;x' +distcleancheck: distclean + if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: + +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) +distclean-am: clean-am distclean-generic distclean-hdr distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf autom4te.cache +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ + clean-generic clean-recursive dist dist-all dist-bzip2 \ + dist-gzip distcheck distclean distclean-generic distclean-hdr \ + distclean-recursive distclean-tags distcleancheck distdir dvi \ + dvi-am dvi-recursive info info-am info-recursive install \ + install-am install-data install-data-am install-data-recursive \ + install-exec install-exec-am install-exec-recursive \ + install-info install-info-am install-info-recursive install-man \ + install-recursive install-strip installcheck installcheck-am \ + installdirs installdirs-am installdirs-recursive \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-recursive tags tags-recursive uninstall \ + uninstall-am uninstall-info-am uninstall-info-recursive \ + uninstall-recursive + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/libTrie/NEWS b/lib/libTrie/NEWS new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/libTrie/README b/lib/libTrie/README new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lib/libTrie/aclocal.m4 b/lib/libTrie/aclocal.m4 new file mode 100644 index 0000000000..2a95e6cef2 --- /dev/null +++ b/lib/libTrie/aclocal.m4 @@ -0,0 +1,873 @@ +# aclocal.m4 generated automatically by aclocal 1.6.3 -*- Autoconf -*- + +# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*- + +# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +AC_PREREQ([2.52]) + +# serial 6 + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. We must strip everything past the first ":", +# and everything past the last "/". + +# _AM_DIRNAME(PATH) +# ----------------- +# Like AS_DIRNAME, only do it during macro expansion +AC_DEFUN([_AM_DIRNAME], + [m4_if(regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1, + m4_if(regexp([$1], [^//\([^/]\|$\)]), -1, + m4_if(regexp([$1], [^/.*]), -1, + [.], + patsubst([$1], [^\(/\).*], [\1])), + patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])), + patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl +])# _AM_DIRNAME + + +# The stamp files are numbered to have different names. +# We could number them on a directory basis, but that's additional +# complications, let's have a unique counter. +m4_define([_AM_STAMP_Count], [0]) + + +# _AM_STAMP(HEADER) +# ----------------- +# The name of the stamp file for HEADER. +AC_DEFUN([_AM_STAMP], +[m4_define([_AM_STAMP_Count], m4_incr(_AM_STAMP_Count))dnl +AS_ESCAPE(_AM_DIRNAME(patsubst([$1], + [:.*])))/stamp-h[]_AM_STAMP_Count]) + + +# _AM_CONFIG_HEADER(HEADER[:SOURCES], COMMANDS, INIT-COMMANDS) +# ------------------------------------------------------------ +# We used to try to get a real timestamp in stamp-h. But the fear is that +# that will cause unnecessary cvs conflicts. +AC_DEFUN([_AM_CONFIG_HEADER], +[# Add the stamp file to the list of files AC keeps track of, +# along with our hook. +AC_CONFIG_HEADERS([$1], + [# update the timestamp +echo 'timestamp for $1' >"_AM_STAMP([$1])" +$2], + [$3]) +])# _AM_CONFIG_HEADER + + +# AM_CONFIG_HEADER(HEADER[:SOURCES]..., COMMANDS, INIT-COMMANDS) +# -------------------------------------------------------------- +AC_DEFUN([AM_CONFIG_HEADER], +[AC_FOREACH([_AM_File], [$1], [_AM_CONFIG_HEADER(_AM_File, [$2], [$3])]) +])# AM_CONFIG_HEADER + +# Do all the work for Automake. -*- Autoconf -*- + +# This macro actually does too much some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 8 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +AC_PREREQ([2.52]) + +# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow +# the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl + AC_REQUIRE([AC_PROG_INSTALL])dnl +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl + AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME])dnl + AC_SUBST([VERSION], [AC_PACKAGE_VERSION])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_MISSING_PROG(AMTAR, tar) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl + +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_][CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_][CC], + defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_][CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_][CXX], + defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl +]) +]) + +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.6"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.6.3])]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 2 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# +# Check to make sure that the build environment is sane. +# + +# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# -*- Autoconf -*- + + +# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# AM_AUX_DIR_EXPAND + +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +# Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50]) + +AC_DEFUN([AM_AUX_DIR_EXPAND], [ +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. + +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# AM_PROG_INSTALL_STRIP + +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# serial 4 -*- Autoconf -*- + +# Copyright 1999, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[rm -f .deps 2>/dev/null +mkdir .deps 2>/dev/null +if test -d .deps; then + DEPDIR=.deps +else + # MS-DOS does not allow filenames that begin with a dot. + DEPDIR=_deps +fi +rmdir .deps 2>/dev/null +AC_SUBST([DEPDIR]) +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +#serial 2 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n -e '/^U = / s///p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n -e ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Copyright 2001 Free Software Foundation, Inc. -*- Autoconf -*- + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 2 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +doit: + @echo done +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST(am__include) +AC_SUBST(am__quote) +AC_MSG_RESULT($_am_result) +rm -f confinc confmf +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright 1997, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 5 + +AC_PREREQ(2.52) + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([conditional \"$1\" was never defined. +Usually this means the macro was only invoked conditionally.]) +fi])]) + +# Add --enable-maintainer-mode option to configure. +# From Jim Meyering + +# Copyright 1996, 1998, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 1 + +AC_DEFUN([AM_MAINTAINER_MODE], +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + diff --git a/lib/libTrie/bootstrap.sh b/lib/libTrie/bootstrap.sh new file mode 100755 index 0000000000..c7d904c53d --- /dev/null +++ b/lib/libTrie/bootstrap.sh @@ -0,0 +1,30 @@ +#! /bin/sh +# Used to setup the configure.in, autoheader and Makefile.in's if configure +# has not been generated. This script is only needed for developers when +# configure has not been run, or if a Makefile.am in a non-configured directory +# has been updated + + +bootstrap() { + if "$@"; then + true # Everything OK + else + echo "$1 failed" + echo "Autotool bootstrapping failed. You will need to investigate and correct" ; + echo "before you can develop on this source tree" + exit 1 + fi +} + +# Make sure cfgaux exists +mkdir -p cfgaux + +echo "Bootstrapping libTrie." +# Bootstrap the autotool subsystems +bootstrap aclocal +bootstrap autoheader +#bootstrap libtoolize --automake +bootstrap automake --add-missing +bootstrap autoconf + +echo "Autotool bootstrapping complete." diff --git a/lib/libTrie/config.guess b/lib/libTrie/config.guess new file mode 100755 index 0000000000..fb9a2bade5 --- /dev/null +++ b/lib/libTrie/config.guess @@ -0,0 +1,1325 @@ +#! /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-05-29' + +# 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 + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + 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:*:*: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 $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|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + 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/lib/libTrie/config.h.in b/lib/libTrie/config.h.in new file mode 100644 index 0000000000..c835c39fa9 --- /dev/null +++ b/lib/libTrie/config.h.in @@ -0,0 +1,64 @@ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Keyword used by squid for inlining methods */ +#undef _SQUID_INLINE_ + +/* Include inline methods into header file */ +#undef _USE_INLINE_ + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `unsigned' if does not define. */ +#undef size_t diff --git a/lib/libTrie/config.sub b/lib/libTrie/config.sub new file mode 100755 index 0000000000..cbb2626eef --- /dev/null +++ b/lib/libTrie/config.sub @@ -0,0 +1,1460 @@ +#! /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-06-21' + +# 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 | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c54x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* \ + | m32r-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipstx39 | mipstx39el \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* | tic30-* | 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 | sh[1234]le | sh3ele) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + 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* | -windiss* | -powermax*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/lib/libTrie/configure b/lib/libTrie/configure new file mode 100755 index 0000000000..75849aa05a --- /dev/null +++ b/lib/libTrie/configure @@ -0,0 +1,5156 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.57 for libTrie 0.1. +# +# Report bugs to . +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME='libTrie' +PACKAGE_TARNAME='libtrie' +PACKAGE_VERSION='0.1' +PACKAGE_STRING='libTrie 0.1' +PACKAGE_BUGREPORT='rbtcollins@squid-cache.org' + +ac_unique_file="src/Trie.cc" +# 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 CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC SET_MAKE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE CXXDEPMODE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT RANLIB ac_ct_RANLIB CPP EGREP LIBOBJS 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_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_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_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_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures libTrie 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 +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of libTrie 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] + --disable-inline Don't compile trivial methods as inline. Squid + is coded with much of the code able to be inlined.< Inlining is good for production builds, but not + good for development. During development, use + --disable-inline to reduce compilation times and + allow incremental builds to be quick. For + production builds, or load tests, use + --enable-inline to have squid make all trivial + methods inlinable by the compiler. + --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + +Some influential environment variables: + CXX C++ compiler command + CXXFLAGS 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 + CC C compiler command + CFLAGS C compiler flags + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF +libTrie configure 0.1 +generated by GNU Autoconf 2.57 + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by libTrie $as_me 0.1, which was +generated by GNU Autoconf 2.57. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core core.* *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# Add the stamp file to the list of files AC keeps track of, +# along with our hook. + ac_config_headers="$ac_config_headers config.h" + + + + +SquidInline="yes" +# Check whether --enable-inline or --disable-inline was given. +if test "${enable_inline+set}" = set; then + enableval="$enable_inline" + if test "$enableval" = "no" ; then + SquidInline="no" + fi + +fi; + +if test "$SquidInline" = "yes" ; then + +cat >>confdefs.h <<\_ACEOF +#define _SQUID_INLINE_ inline +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define _USE_INLINE_ +_ACEOF + +else + +cat >>confdefs.h <<\_ACEOF +#define _SQUID_INLINE_ +_ACEOF + +fi + +# Checks for programs. +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); } + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C++ compiler default output" >&5 +echo $ECHO_N "checking for C++ compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C++ compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C++ compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C++ compiler works" >&5 +echo $ECHO_N "checking whether the C++ compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C++ compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C++ compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 +if test "${ac_cv_cxx_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_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 +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_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.$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 \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + 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 +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#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; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +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 + +am__api_version="1.6" +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +test "$program_prefix" != NONE && + program_transform_name="s,^,$program_prefix,;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +rm -f .deps 2>/dev/null +mkdir .deps 2>/dev/null +if test -d .deps; then + DEPDIR=.deps +else + # MS-DOS does not allow filenames that begin with a dot. + DEPDIR=_deps +fi +rmdir .deps 2>/dev/null + + + ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +doit: + @echo done +END +# If we don't find an include directive, just comment out the code. +echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | fgrep -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 + + + + # 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 + +# Define the identity of the package. + PACKAGE=libtrie + 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. + + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + +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 + + 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 + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_CXX_dependencies_compiler_type=$depmode + break + 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 + + + +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 -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 + + +# Checks for libraries. + +# Checks for header files. + +# 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 +#line $LINENO "configure" +/* 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>&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.$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 + +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 +#line $LINENO "configure" +/* 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 + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer 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 +#line $LINENO "configure" +/* 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 + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#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>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +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 +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_size_t=no +fi +rm -f 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. + + ac_config_files="$ac_config_files Makefile include/Makefile src/Makefile test/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 "${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 + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by libTrie $as_me 0.1, which was +generated by GNU Autoconf 2.57. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --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="\\ +libTrie config.status 0.1 +configured by $0, generated by GNU Autoconf 2.57, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "include/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; + "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "test/Makefile" ) CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS 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,@CXX@,$CXX,;t t +s,@CXXFLAGS@,$CXXFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CXX@,$ac_ct_CXX,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;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,@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,@CXXDEPMODE@,$CXXDEPMODE,;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,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@LIBOBJS@,$LIBOBJS,;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 +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# 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; }; } + 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 + # Run the commands associated with the file. + case $ac_file in + config.h ) # update the timestamp +echo 'timestamp for config.h' >"./stamp-h1" + ;; + esac +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`(dirname "$mf") 2>/dev/null || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + else + continue + fi + grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n -e '/^U = / s///p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n -e ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`(dirname "$file") 2>/dev/null || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p $dirpart/$fdir + else + as_dir=$dirpart/$fdir + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 +echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; }; } + + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + esac +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/lib/libTrie/configure.in b/lib/libTrie/configure.in new file mode 100644 index 0000000000..7c2e4c313d --- /dev/null +++ b/lib/libTrie/configure.in @@ -0,0 +1,50 @@ +# Process this file with autoconf to produce a configure script. +AC_INIT(libTrie, 0.1, rbtcollins@squid-cache.org) +AC_CONFIG_SRCDIR([src/Trie.cc]) +AM_CONFIG_HEADER([config.h]) + +SquidInline="yes" +AC_ARG_ENABLE(inline, +[ --disable-inline Don't compile trivial methods as inline. Squid + is coded with much of the code able to be inlined.< Inlining is good for production builds, but not + good for development. During development, use + --disable-inline to reduce compilation times and + allow incremental builds to be quick. For + production builds, or load tests, use + --enable-inline to have squid make all trivial + methods inlinable by the compiler.], +[ if test "$enableval" = "no" ; then + SquidInline="no" + fi +]) + +if test "$SquidInline" = "yes" ; then + AC_DEFINE(_SQUID_INLINE_, inline, [Keyword used by squid for inlining methods]) + AC_DEFINE(_USE_INLINE_,, [Include inline methods into header file]) +else + AC_DEFINE(_SQUID_INLINE_,, [Keyword used by squid for inlining methods]) +fi + +# Checks for programs. +AC_PROG_CXX +AC_PROG_CC +AC_PROG_MAKE_SET +AM_INIT_AUTOMAKE +AM_MAINTAINER_MODE +AC_PROG_RANLIB + +# Checks for libraries. + +# Checks for header files. + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_SIZE_T + +# Checks for library functions. + +AC_CONFIG_FILES([Makefile + include/Makefile + src/Makefile + test/Makefile]) +AC_OUTPUT diff --git a/lib/libTrie/depcomp b/lib/libTrie/depcomp new file mode 100755 index 0000000000..807b991f4a --- /dev/null +++ b/lib/libTrie/depcomp @@ -0,0 +1,423 @@ +#! /bin/sh + +# depcomp - compile a program generating dependencies as side-effects +# Copyright 1999, 2000 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi +# `libtool' can also be set to `yes' or `no'. + +if test -z "$depfile"; then + base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` + dir=`echo "$object" | sed 's,/.*$,/,'` + if test "$dir" = "$object"; then + dir= + fi + # FIXME: should be _deps on DOS. + depfile="$dir.deps/$base" +fi + +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. This file always lives in the current directory. + # Also, the AIX compiler puts `$object:' at the start of each line; + # $object doesn't have directory information. + stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + outname="$stripped.o" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + tmpdepfile1="$dir.libs/$base.lo.d" + tmpdepfile2="$dir.libs/$base.d" + "$@" -Wc,-MD + else + tmpdepfile1="$dir$base.o.d" + tmpdepfile2="$dir$base.d" + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + else + tmpdepfile="$tmpdepfile2" + fi + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a space and a tab in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. We will use -o /dev/null later, + # however we can't do the remplacement now because + # `-o $object' might simply not be used + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + "$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + -*) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 diff --git a/lib/libTrie/include/Makefile.am b/lib/libTrie/include/Makefile.am new file mode 100644 index 0000000000..a52bae3667 --- /dev/null +++ b/lib/libTrie/include/Makefile.am @@ -0,0 +1 @@ +noinst_HEADERS = Trie.h TrieNode.h diff --git a/lib/libTrie/include/Makefile.in b/lib/libTrie/include/Makefile.in new file mode 100644 index 0000000000..b5f80db022 --- /dev/null +++ b/lib/libTrie/include/Makefile.in @@ -0,0 +1,237 @@ +# Makefile.in generated by automake 1.6.3 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +DEPDIR = @DEPDIR@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +MAINT = @MAINT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +install_sh = @install_sh@ +noinst_HEADERS = Trie.h TrieNode.h +subdir = include +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu include/Makefile +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) + +installdirs: + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +uninstall-am: uninstall-info-am + +.PHONY: GTAGS all all-am check check-am clean clean-generic distclean \ + distclean-generic distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic tags uninstall uninstall-am \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/libTrie/include/Trie.cci b/lib/libTrie/include/Trie.cci new file mode 100644 index 0000000000..fe3e461e1d --- /dev/null +++ b/lib/libTrie/include/Trie.cci @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002 Robert Collins + * + * 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, USA. + * + */ + +#ifdef __cplusplus +#include "Trie.h" +#include "TrieNode.h" + +void * +Trie::find (char const *aString, size_t theLength) +{ + if (head) + return head->find (aString, theLength); + return NULL; +} + +void * +Trie::findPrefix (char const *aString, size_t theLength) +{ + if (head) + return head->find (aString, theLength, true); + return NULL; +} +#endif diff --git a/lib/libTrie/include/Trie.h b/lib/libTrie/include/Trie.h new file mode 100644 index 0000000000..838bfb7b19 --- /dev/null +++ b/lib/libTrie/include/Trie.h @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2002 Robert Collins + * + * 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, USA. + * + */ + +#ifndef LIBTRIE_SQUID_H +#define LIBTRIE_SQUID_H + +/* This is the header for libTrie. + * libTrie provides both C and C++ + * bindings. libtrie itself is written in C++. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#if HAVE_SYS_TYPES_H +#include +#endif + +/* C bindings */ +#ifndef __cplusplus + +void *TrieCreate (); +void TrieDestroy (void *); +void *TrieFind (void *, char const *, size_t); +int TrieAdd (void *, char const *, size_t, void *); + +/* C++ bindings */ +#else + +class TrieNode; + +/* TODO: parameterize this to be more generic - +* i.e. M-ary internal node sizes etc +*/ + +class Trie +{ + +public: + Trie(); + ~Trie(); + Trie (Trie const &); + Trie &operator= (Trie const &); + + /* Find an exact match in the trie. + * If found, return the private data. + * If not found, return NULL. + */ + _SQUID_INLINE_ void *find (char const *, size_t); + /* find any element of the trie in the buffer from the + * beginning thereof + */ + _SQUID_INLINE_ void *findPrefix (char const *, size_t); + + /* Add a string. + * returns false if the string is already + * present or cannot be added. + */ + + bool add + (char const *, size_t, void *); + +private: + TrieNode *head; +}; + +#endif /* __cplusplus */ + +#ifdef _USE_INLINE_ +#include "Trie.cci" +#endif + +#endif /* LIBTRIE_SQUID_H */ diff --git a/lib/libTrie/include/TrieNode.cci b/lib/libTrie/include/TrieNode.cci new file mode 100644 index 0000000000..b51b7790e0 --- /dev/null +++ b/lib/libTrie/include/TrieNode.cci @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2002 Robert Collins + * + * 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, USA. + * + */ + +#ifdef __cplusplus +#include "TrieNode.h" +#ifdef HAVE_UNISTD_H +#include +#endif +#include + +/* recursive. TODO? make iterative */ +void * +TrieNode::find (char const *aString, size_t theLength, bool prefix) const +{ + if (theLength) { + int index = -1; + if (internal[*aString]) + index = *aString; + else if (internal[tolower(*aString)]) + index = tolower(*aString); + if (index > -1) { + void *result; + result = internal[index]->find(aString + 1, theLength - 1, prefix); + if (result) + return result; + } + if (prefix) + return _privateData; + return NULL; + } else { + /* terminal node */ + return _privateData; + } +} +#endif diff --git a/lib/libTrie/include/TrieNode.h b/lib/libTrie/include/TrieNode.h new file mode 100644 index 0000000000..950f8ce3f0 --- /dev/null +++ b/lib/libTrie/include/TrieNode.h @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2002 Robert Collins + * + * 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, USA. + * + */ + +#ifndef LIBTRIE_TRIENODE_H +#define LIBTRIE_TRIENODE_H + +/* This is an internal header for libTrie. + * libTrie provides both C and C++ + * bindings. + * libTrie itself is written in C++. + * For C bindings see Trei.h + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +/* C bindings */ +#ifndef __cplusplus + +/* C++ bindings */ +#else +#include +#include + +/* TODO: parameterize this to be more generic - +* i.e. M-ary internal node sizes etc +*/ + +class TrieNode +{ + +public: + TrieNode(); + ~TrieNode(); + TrieNode(TrieNode const &); + TrieNode &operator= (TrieNode const &); + + /* Find a string. + * If found, return the private data. + * If not found, return NULL. + */ + _SQUID_INLINE_ void *find (char const *, size_t, bool prefix = false) const; + + /* Add a string. + * returns false if the string is already + * present or can't be added. + */ + + bool add + (char const *, size_t, void *); + +private: + /* 256-way Trie */ + /* The char index into internal is an + * 8-bit prefix to a string in the trie. + * internal[0] is the terminal node for + * a string and may not be used + */ + TrieNode * internal[256]; + + /* If a string ends here, non NULL */ + void *_privateData; +}; + +#endif /* __cplusplus */ + +#ifdef _USE_INLINE_ +#include "TrieNode.cci" +#endif + +#endif /* LIBTRIE_TRIENODE_H */ diff --git a/lib/libTrie/install-sh b/lib/libTrie/install-sh new file mode 100755 index 0000000000..11870f1b01 --- /dev/null +++ b/lib/libTrie/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + : +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 "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + 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 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 :;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 rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/lib/libTrie/ltmain.sh b/lib/libTrie/ltmain.sh new file mode 100644 index 0000000000..c492ba35cb --- /dev/null +++ b/lib/libTrie/ltmain.sh @@ -0,0 +1,5055 @@ +# 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 +# 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/" + +# 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" + ;; + *) + 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" + exit 0 + ;; + + --config) + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 + exit 0 + ;; + + --debug) + echo "$progname: enabling shell trace mode" + set -x + ;; + + --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=: + ;; + + -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 + case $nonopt in + *cc | *++ | gcc* | *-gcc*) + 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= + prev= + lastarg= + srcfile="$nonopt" + suppress_output= + + user_target=no + for arg + do + case $prev in + "") ;; + xcompiler) + # Aesthetically quote the previous argument. + prev= + lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + + case $arg in + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + arg="\"$arg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; + esac + + # Accept any command-line options. + case $arg in + -o) + if test "$user_target" != "no"; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + user_target=next + ;; + + -static) + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -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. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + continue + ;; + esac + + case $user_target in + next) + # The next one is the -o target name + user_target=yes + continue + ;; + yes) + # We got the output file + user_target=set + libobj="$arg" + continue + ;; + esac + + # Accept the current argument as the source file. + lastarg="$srcfile" + srcfile="$arg" + + # Aesthetically quote the previous argument. + + # Backslashify any backslashes, double quotes, and dollar signs. + # These are the only characters that are still specially + # interpreted inside of double-quoted scrings. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + case $lastarg in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + lastarg="\"$lastarg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + done + + case $user_target in + set) + ;; + no) + # Get the name of the library object. + libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + *) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSfmso]' + case $libobj in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + 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 + + 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 $libobj" + else + removelist="$libobj" + 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 + 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 + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + else + # Don't build PIC code + command="$base_compile $srcfile" + fi + if test "$build_old_libs" = yes; then + lo_libobj="$libobj" + dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$libobj"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + + if test -d "$dir"; then + $show "$rm $libobj" + $run $rm $libobj + else + $show "$mkdir $dir" + $run $mkdir $dir + status=$? + if test $status -ne 0 && test ! -d $dir; then + exit $status + fi + fi + fi + if test "$compiler_o_lo" = yes; then + output_obj="$libobj" + command="$command -o $output_obj" + elif test "$compiler_c_o" = yes; then + output_obj="$obj" + command="$command -o $output_obj" + fi + + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + test -n "$output_obj" && $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/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 x"$output_obj" != x"$libobj"; then + $show "$mv $output_obj $libobj" + if $run $mv $output_obj $libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # If we have no pic_flag, then copy the object into place and finish. + if (test -z "$pic_flag" || test "$pic_mode" != default) && + test "$build_old_libs" = yes; then + # Rename the .lo from within objdir to obj + if test -f $obj; then + $show $rm $obj + $run $rm $obj + fi + + $show "$mv $libobj $obj" + if $run $mv $libobj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` + libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + # Now arrange that obj and lo_libobj become the same file + $show "(cd $xdir && $LN_S $baseobj $libobj)" + if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi + exit 0 + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Allow error messages only from the first compilation. + suppress_output=' >/dev/null 2>&1' + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $srcfile" + else + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + fi + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + output_obj="$obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/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 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 + + # Create an invalid libtool object if no PIC, so that we do not + # accidentally link it into a program. + if test "$build_libtool_libs" != yes; then + $show "echo timestamp > $libobj" + $run eval "echo timestamp > \$libobj" || exit $? + else + # Move the .lo from within objdir + $show "$mv $libobj $lo_libobj" + if $run $mv $libobj $lo_libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + fi + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi + + exit 0 + ;; + + # libtool link mode + link | relink) + modename="$modename: link" + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invokation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args="$nonopt" + compile_command="$nonopt" + finalize_command="$nonopt" + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + + avoid_version=no + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + + # 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" + 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 + ;; + release) + release="-$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 + ;; + *) + 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 + ;; + + # 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* | no/*-*-nonstopux*) + 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 + ;; + 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 + ;; + + -module) + module=yes + 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 + ;; + + -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 + ;; + + -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 + ;; + + # 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 + ;; + + *.lo | *.$objext) + # A library or standard object. + if test "$prev" = dlfiles; then + # This file was specified with -dlopen. + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + dlfiles="$dlfiles $arg" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` + prev= + else + case $arg in + *.lo) libobjs="$libobjs $arg" ;; + *) objs="$objs $arg" ;; + esac + 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 + + # 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 + + 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 + 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 = prog; then + # Determine which files to process + case $pass in + dlopen) + libs="$dlfiles" + save_deplibs="$deplibs" # Collect dlpreopened libraries + deplibs= + ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + for deplib in $libs; do + lib= + found=no + case $deplib in + -l*) + if test $linkmode = oldlib && test $linkmode = obj; then + $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 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 + # Search the libtool library + lib="$searchdir/lib${name}.la" + if test -f "$lib"; then + found=yes + break + fi + 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 + 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: $deplib" 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 = 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 + 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 | egrep "^# 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 variable installed. + installed=yes + + # Read the .la file + case $lib in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test $linkmode = oldlib && test $linkmode = obj; }; then + # Add dl[pre]opened files of deplib + 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. + dlprefiles="$dlprefiles $lib" + 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" + 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... + + 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 + # Link against this shared library + + if test "$linkmode,$pass" = "prog,link" || + { 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 + if test $linkmode = prog; 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 + fi + 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 + + if test "$installed" = no; then + notinst_deplibs="$notinst_deplibs $lib" + need_relink=yes + 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*) + 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" + 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" + 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" + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + 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 + 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 + + # Try to link the static library + # 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="-L$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="-L$absdir" + fi + ;; + *) continue ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$deplibs $path" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $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 + test $pass != scan && dependency_libs="$newdependency_libs" + 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 + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + *) + 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 + if test "$pass" = "conv" && + { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then + libs="$deplibs" # reset libs + deplibs= + fi + done # for pass + if test $linkmode = prog; then + dlfiles="$newdlfiles" + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + 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' 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 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 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. + libext=al + 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' 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 + + current="$2" + revision="$3" + age="$4" + + # 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 != 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 != 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= + verstring="0.0" + 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. + $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" + $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + 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. + ;; + *) + # 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 behaviour. + 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 + 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 + 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 below 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 + 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="" + if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g' -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" + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + 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 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 + test -z "$dlname" && dlname=$soname + + lib="$output_objdir/$realname" + for link + do + linknames="$linknames $link" + done + + # Ensure that we have .o objects for linkers which dislike .lo + # (e.g. aix) in case we are running --disable-static + for obj in $libobjs; do + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + if test ! -f $xdir/$oldobj; then + $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" + $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? + fi + 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" + $show "$cmd" + $run eval "$cmd" || exit $? + 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 + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + 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 + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + libobjs="$libobjs "`find $xdir -name \*.o -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 -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else + save_deplibs="$deplibs" + for conv in $convenience; do + tmp_deplibs= + for test_deplib in $deplibs; do + if test "$test_deplib" != "$conv"; then + tmp_deplibs="$tmp_deplibs $test_deplib" + fi + done + deplibs="$tmp_deplibs" + done + eval cmds=\"$archive_cmds\" + deplibs="$save_deplibs" + 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 + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + reload_conv_objs="$reload_objs "`find $xdir -name \*.o -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" + else + # Just create a symlink. + $show $rm $libobj + $run $rm $libobj + xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$libobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + $show "(cd $xdir && $LN_S $oldobj $baseobj)" + $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? + 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 + + 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 -DPIC -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $CC -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 ;; + *) exeext= ;; + 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 + # win32 systems need to use the prog path for dll + # lookup to work + *-*-cygwin* | *-*-pw32*) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \$progdir\\\\\$program \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + # Export the path to the program. + PATH=\"\$progdir:\$PATH\" + export PATH + + exec \$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="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + 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 + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + 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 + # Ensure that we have .o objects in place in case we decided + # not to build a shared library, and have fallen back to building + # static libs even though --disable-static was passed! + for oldobj in $oldobjs; do + if test ! -f $oldobj; then + xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$oldobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` + obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + $show "(cd $xdir && ${LN_S} $obj $baseobj)" + $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? + fi + done + + eval cmds=\"$old_archive_cmds\" + 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 --mode=relink $libtool_args)" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + + # 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" + fi + $rm $output + # place dlname in correct position for cygwin + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*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 + +# 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 | egrep "^# 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 + $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 + continue + 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 + + # 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 | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then + notinst_deplibs= + relink_command= + + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $wrapper ;; + *) . ./$wrapper ;; + 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= + # If there is no directory component, then add one. + case $file in + */* | *\\*) . $wrapper ;; + *) . ./$wrapper ;; + 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" | $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" | $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 --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 | egrep "^# 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 | egrep "^# 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 enviroment 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= + + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$file"; then + dir=. + objdir="$objdir" + else + objdir="$dir/$objdir" + 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 | egrep "^# 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 $? != 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 $? != 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) + if test "$build_old_libs" = yes; then + oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` + rmfiles="$rmfiles $dir/$oldobj" + fi + ;; + + *) + # Do a test to see if this is a libtool program. + if test $mode = clean && + (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + relink_command= + . $dir/$file + + rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + rmfiles="$rmfiles $objdir/lt-$name" + fi + fi + ;; + esac + $show "$rm $rmfiles" + $run $rm $rmfiles || exit_status=1 + done + + # 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 + --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." + 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 + -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 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/lib/libTrie/missing b/lib/libTrie/missing new file mode 100755 index 0000000000..6a37006e8f --- /dev/null +++ b/lib/libTrie/missing @@ -0,0 +1,336 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing 0.4 - GNU automake" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. + You can get \`$1Help2man' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + tar) + shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/lib/libTrie/mkinstalldirs b/lib/libTrie/mkinstalldirs new file mode 100755 index 0000000000..8ab885ec92 --- /dev/null +++ b/lib/libTrie/mkinstalldirs @@ -0,0 +1,99 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +errstatus=0 +dirmode="" + +usage="\ +Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." + +# process command line arguments +while test $# -gt 0 ; do + case "${1}" in + -h | --help | --h* ) # -h for help + echo "${usage}" 1>&2; exit 0 ;; + -m ) # -m PERM arg + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + dirmode="${1}" + shift ;; + -- ) shift; break ;; # stop option processing + -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option + * ) break ;; # first non-opt arg + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in +0) exit 0 ;; +esac + +case $dirmode in +'') + if mkdir -p -- . 2>/dev/null; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + fi ;; +*) + if mkdir -m "$dirmode" -p -- . 2>/dev/null; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + fi ;; +esac + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# Local Variables: +# mode: shell-script +# sh-indentation: 3 +# End: +# mkinstalldirs ends here diff --git a/lib/libTrie/src/Makefile.am b/lib/libTrie/src/Makefile.am new file mode 100644 index 0000000000..95d3fa5455 --- /dev/null +++ b/lib/libTrie/src/Makefile.am @@ -0,0 +1,10 @@ + +INCLUDES = -I$(top_srcdir)/include + +noinst_LIBRARIES = libTrie.a + +libTrie_a_SOURCES = Trie.cc \ + TrieNode.cc + +noinst_HEADERS = ../include/Trie.cci \ + ../include/TrieNode.cci diff --git a/lib/libTrie/src/Makefile.in b/lib/libTrie/src/Makefile.in new file mode 100644 index 0000000000..5bbef9f3ff --- /dev/null +++ b/lib/libTrie/src/Makefile.in @@ -0,0 +1,310 @@ +# Makefile.in generated by automake 1.6.3 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +DEPDIR = @DEPDIR@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +MAINT = @MAINT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +install_sh = @install_sh@ + +INCLUDES = -I$(top_srcdir)/include + +noinst_LIBRARIES = libTrie.a + +libTrie_a_SOURCES = Trie.cc \ + TrieNode.cc + + +noinst_HEADERS = ../include/Trie.cci \ + ../include/TrieNode.cci + +subdir = src +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) + +libTrie_a_AR = $(AR) cru +libTrie_a_LIBADD = +am_libTrie_a_OBJECTS = Trie.$(OBJEXT) TrieNode.$(OBJEXT) +libTrie_a_OBJECTS = $(am_libTrie_a_OBJECTS) + +DEFS = @DEFS@ +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/Trie.Po ./$(DEPDIR)/TrieNode.Po +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +CXXFLAGS = @CXXFLAGS@ +DIST_SOURCES = $(libTrie_a_SOURCES) +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in +SOURCES = $(libTrie_a_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +AR = ar + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libTrie.a: $(libTrie_a_OBJECTS) $(libTrie_a_DEPENDENCIES) + -rm -f libTrie.a + $(libTrie_a_AR) libTrie.a $(libTrie_a_OBJECTS) $(libTrie_a_LIBADD) + $(RANLIB) libTrie.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Trie.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TrieNode.Po@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cc.o: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cc.obj: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `cygpath -w $<` +CXXDEPMODE = @CXXDEPMODE@ +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + $(mkinstalldirs) $(distdir)/../include + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(HEADERS) + +installdirs: + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +uninstall-am: uninstall-info-am + +.PHONY: GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES distclean distclean-compile \ + distclean-depend distclean-generic distclean-tags distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic tags uninstall uninstall-am \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/libTrie/src/Trie.cc b/lib/libTrie/src/Trie.cc new file mode 100644 index 0000000000..5964f778a7 --- /dev/null +++ b/lib/libTrie/src/Trie.cc @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2002 Robert Collins + * + * 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, USA. + * + */ + +#include "Trie.h" +#ifdef HAVE_UNISTD_H +#include +#endif +#include "TrieNode.h" + +Trie::Trie () : head (0) +{} + +extern "C" void *TrieCreate () +{ + return new Trie; +} + +Trie::~Trie () +{ + delete head; +} + +extern "C" void TrieDestroy (void *aTrie) +{ + delete (Trie *)aTrie; +} + +extern "C" void *TrieFind (void *aTrie, char const *aString, size_t theLength) +{ + return ((Trie *)aTrie)->find (aString, theLength); +} + +bool + +Trie::add + (char const *aString, size_t theLength, void *privatedata) +{ + if (!privatedata) + return false; + + if (head) { + if (find (aString, theLength)) + return false; + + return head->add + (aString, theLength, privatedata); + } + + head = new TrieNode; + + return head->add + (aString, theLength, privatedata); +} + +extern "C" int TrieAdd (void *aTrie, char const *aString, size_t theLength, void *privatedata) +{ + + return ((Trie *)aTrie)->add + (aString, theLength, privatedata); +} diff --git a/lib/libTrie/src/TrieNode.cc b/lib/libTrie/src/TrieNode.cc new file mode 100644 index 0000000000..8a677c54fd --- /dev/null +++ b/lib/libTrie/src/TrieNode.cc @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2002 Robert Collins + * + * 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, USA. + * + */ + +#include "TrieNode.h" +#ifdef HAVE_UNISTD_H +#include +#endif +#include + +TrieNode::TrieNode () +{ + for (int i = 0; i < 256; ++i) + internal[i] = NULL; +} + +TrieNode::~TrieNode () +{ + for (int i = 0; i < 256; ++i) + delete internal[i]; +} + +/* as for find */ +bool + +TrieNode::add + (char const *aString, size_t theLength, void *privatedata) +{ + /* We trust that privatedata and existant keys have already been checked */ + + if (theLength) { + int index; + + if (internal[*aString]) + index = *aString; + else if (internal[tolower(*aString)]) + index = tolower (*aString); + else { + index = *aString; + internal[index] = new TrieNode; + } + + internal[index]->add + (aString + 1, theLength - 1, privatedata); + } else { + /* terminal node */ + + if (_privateData) + return false; + + _privateData = privatedata; + + return true; + } +} + diff --git a/lib/libTrie/test/Makefile.am b/lib/libTrie/test/Makefile.am new file mode 100644 index 0000000000..dabb1ab44f --- /dev/null +++ b/lib/libTrie/test/Makefile.am @@ -0,0 +1,12 @@ +INCLUDES = -I$(top_srcdir)/include + +TESTS = trie trie-c + +check_PROGRAMS = trie trie-c + +trie_SOURCES = trie.cc +trie_LDADD = $(top_builddir)/src/libTrie.a + +trie_c_SOURCES = trie-c.c +trie_c_LDADD = $(top_builddir)/src/libTrie.a -lstdc++ + diff --git a/lib/libTrie/test/Makefile.in b/lib/libTrie/test/Makefile.in new file mode 100644 index 0000000000..f089d09bdd --- /dev/null +++ b/lib/libTrie/test/Makefile.in @@ -0,0 +1,384 @@ +# Makefile.in generated by automake 1.6.3 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +AMTAR = @AMTAR@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +DEPDIR = @DEPDIR@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +MAINT = @MAINT@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +STRIP = @STRIP@ +VERSION = @VERSION@ +am__include = @am__include@ +am__quote = @am__quote@ +install_sh = @install_sh@ +INCLUDES = -I$(top_srcdir)/include + +TESTS = trie trie-c + +check_PROGRAMS = trie trie-c + +trie_SOURCES = trie.cc +trie_LDADD = $(top_builddir)/src/libTrie.a + +trie_c_SOURCES = trie-c.c +trie_c_LDADD = $(top_builddir)/src/libTrie.a -lstdc++ +subdir = test +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +check_PROGRAMS = trie$(EXEEXT) trie-c$(EXEEXT) +am_trie_OBJECTS = trie.$(OBJEXT) +trie_OBJECTS = $(am_trie_OBJECTS) +trie_DEPENDENCIES = $(top_builddir)/src/libTrie.a +trie_LDFLAGS = +am_trie_c_OBJECTS = trie-c.$(OBJEXT) +trie_c_OBJECTS = $(am_trie_c_OBJECTS) +trie_c_DEPENDENCIES = $(top_builddir)/src/libTrie.a +trie_c_LDFLAGS = + +DEFS = @DEFS@ +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/trie-c.Po ./$(DEPDIR)/trie.Po +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CFLAGS = @CFLAGS@ +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +CXXFLAGS = @CXXFLAGS@ +DIST_SOURCES = $(trie_SOURCES) $(trie_c_SOURCES) +DIST_COMMON = Makefile.am Makefile.in +SOURCES = $(trie_SOURCES) $(trie_c_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .cc .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu test/Makefile +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) + +clean-checkPROGRAMS: + -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) +trie$(EXEEXT): $(trie_OBJECTS) $(trie_DEPENDENCIES) + @rm -f trie$(EXEEXT) + $(CXXLINK) $(trie_LDFLAGS) $(trie_OBJECTS) $(trie_LDADD) $(LIBS) +trie-c$(EXEEXT): $(trie_c_OBJECTS) $(trie_c_DEPENDENCIES) + @rm -f trie-c$(EXEEXT) + $(LINK) $(trie_c_LDFLAGS) $(trie_c_OBJECTS) $(trie_c_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trie-c.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trie.Po@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.c.o: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< + +.c.obj: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `cygpath -w $<` +CCDEPMODE = @CCDEPMODE@ + +.cc.o: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cc.obj: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `cygpath -w $<` +CXXDEPMODE = @CXXDEPMODE@ +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; \ + srcdir=$(srcdir); export srcdir; \ + list='$(TESTS)'; \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + echo "XPASS: $$tst"; \ + ;; \ + *) \ + echo "PASS: $$tst"; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *" $$tst "*) \ + xfail=`expr $$xfail + 1`; \ + echo "XFAIL: $$tst"; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + ;; \ + esac; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all tests failed"; \ + else \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ + fi; \ + fi; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0; \ + else :; fi +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile + +installdirs: + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +uninstall-am: uninstall-info-am + +.PHONY: GTAGS all all-am check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic distclean distclean-compile \ + distclean-depend distclean-generic distclean-tags distdir dvi \ + dvi-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic tags uninstall uninstall-am \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/libTrie/test/trie-c.c b/lib/libTrie/test/trie-c.c new file mode 100644 index 0000000000..8869874d08 --- /dev/null +++ b/lib/libTrie/test/trie-c.c @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2002 Robert Collins + * + * 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, USA. + * + */ + +#include "Trie.h" +#include + +int +main (int argc, char **argv) +{ + void *aTrie = TrieCreate(); + if (!TrieAdd (aTrie, "User-Agent", 10, (void *)1)) { + fprintf(stderr,"Could not add User-Agent\n"); + return 1; + } + if (TrieAdd (aTrie, "User-Agent", 10, (void *)2)) { + fprintf(stderr, "Could add duplicate User-Agent\n"); + return 1; + } + if (TrieFind (aTrie, "User-Agent", 10) != (void *)1) { + fprintf(stderr, "Could not find User-Agent\n"); + return 1; + } + TrieDestroy (aTrie); + return 0; +} diff --git a/lib/libTrie/test/trie.cc b/lib/libTrie/test/trie.cc new file mode 100644 index 0000000000..b05d3c695c --- /dev/null +++ b/lib/libTrie/test/trie.cc @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2002 Robert Collins + * + * 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, USA. + * + */ + +#include "Trie.h" +#include + +int main (int argc, char **argv) +{ + Trie aTrie; + + if (!aTrie.add ("User-Agent", 10, (void *)1)) { + std::cerr << "Could not add User-Agent" << std::endl; + return 1; + } + + if (aTrie.add ("User-Agent", 10, (void *)2)) { + std::cerr << "Could add duplicate User-Agent" << std::endl; + return 1; + } + + if (!aTrie.add ("Alphabet", 8, (void *)3)) { + std::cerr << "Could not add Alphabet" << std::endl; + return 1; + } + + if (aTrie.find ("User-Agent", 10) != (void *)1) { + std::cerr << "Could not find User-Agent" << std::endl; + return 1; + } + + return 0; +} diff --git a/src/ESI.cc b/src/ESI.cc new file mode 100644 index 0000000000..da9160beb9 --- /dev/null +++ b/src/ESI.cc @@ -0,0 +1,3986 @@ + +/* + * $Id: ESI.cc,v 1.1 2003/03/10 04:56:30 robertc Exp $ + * + * DEBUG: section 86 ESI processing + * AUTHOR: Robert Collins + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + * Copyright (c) 2003, Robert Collins + */ + +#include "squid.h" +#include "ESI.h" +#include "clientStream.h" +#include "client_side_request.h" +#include "ESISegment.h" +#include "ESIElement.h" +#include "ESIContext.h" +#include "HttpReply.h" +#include "ESIAttempt.h" +#include "ESIExcept.h" +#include "client_side.h" + +/* quick reference on behaviour here. + * The ESI specification 1.0 requires the ESI processor to be able to + * return an error code at any point in the processing. To that end + * we buffer the incoming esi body until we know we will be able to + * satisfy the request. At that point we start streaming the queued + * data downstream. + * + */ + +typedef struct _esiStreamContext esiStreamContext; + +/* TODO: split this out into separate files ? */ +/* Parsing: quick and dirty. ESI files are not valid XML, so a generic + * XML parser is not much use. Also we need a push parser not a pull + * parser, so LibXML is out. + * + * Interpreter methods: + * Render: May only ever be called after Process returns PROCESS_COMPLETE. + * Renders the resulting content into a ESISegment chain. + * Process: returns the status of the node. + * COMPLETE - processing is complete, rendering may staret + * PENDING_WONTFAIL - process is incomplete, but the element *will* + * be able to be rendered given time. + * PENDING_MAYFAIL - processing is incomplete, and the element *may* + * fail to be able to rendered. + * FAILED - processing failed, return an error to the client. + */ + +/* + * NOT TODO: esi:inline - out of scope. + */ + +/* make comparisons with refcount pointers easy */ +bool operator == (ESIElement const *lhs, ESIElement::Pointer const &rhs) +{ + return lhs == rhs.getRaw(); +} + + +/* esi variable replacement logic */ + +typedef enum { + ESI_BROWSER_MSIE, + ESI_BROWSER_MOZILLA, + ESI_BROWSER_OTHER +} esiBrowser_t; + +static char const * esiBrowsers[]= + {"MSIE", + "MOZILLA", + "OTHER" + }; + +/* Recursive uses are not supported by design */ + +struct _query_elem{char *var, *val;}; + +struct esiVarState +{ + ESISegment::Pointer extractList(); + char *extractChar(); + void feedData (const char *buf, size_t len); + void buildVary (HttpReply *rep); + + void *operator new (size_t byteCount); + void operator delete (void *address); + void deleteSelf() const; + void freeResources(); + esiVarState (HttpHeader const *hdr, char const *uri); + +private: + char *getProductVersion (char const *s); + ESISegment::Pointer input; + ESISegment::Pointer output; + HttpHeader hdr; + + struct _query_elem *query; + size_t query_sz; + size_t query_elements; + char *query_string; + + struct + { + +int language: + 1; + +int cookie: + 1; + +int host: + 1; + +int referer: + 1; + +int useragent: + 1; + } + + flags; + esiBrowser_t browser; + char *browserversion; + enum esiVar_t { + ESI_VAR_LANGUAGE, + ESI_VAR_COOKIE, + ESI_VAR_HOST, + ESI_VAR_REFERER, + ESI_VAR_USERAGENT, + ESI_QUERY_STRING, + ESI_VAR_OTHER + }; + void doIt (); + void eval (esiVar_t type, char const *, char const *); + enum esiUserOs_t{ + ESI_OS_WIN, + ESI_OS_MAC, + ESI_OS_UNIX, + ESI_OS_OTHER + } UserOs; + static char const * esiUserOs[]; + static esiVar_t GetVar(char *s, int len); + bool validChar (char c); +}; + +CBDATA_TYPE (esiVarState); +FREE esiVarStateFree; + +char const *esiVarState::esiUserOs[]= + { + "WIN", + "MAC", + "UNIX", + "OTHER" + }; + + +extern int esiExpressionEval (char const *); + +typedef ESIContext::esiKick_t esiKick_t; + + +/* some core operators */ + +/* esiComment */ + +struct esiComment : public ESIElement +{ + void *operator new (size_t byteCount); + void operator delete (void *address); + void deleteSelf()const; + ~esiComment(); + esiComment(); + Pointer makeCacheable() const; + Pointer makeUsable(esiTreeParentPtr, esiVarState &) const; + + void render(ESISegment::Pointer); + void finish(); + +private: + static MemPool *pool; +}; + +MemPool * esiComment::pool = NULL; + +#include "ESILiteral.h" +MemPool *esiLiteral::pool = NULL; + +#include "ESISequence.h" + +/* esiInclude */ + +struct esiInclude : public ESIElement +{ + void *operator new (size_t byteCount); + void operator delete (void *address); + void deleteSelf() const; + + esiInclude(esiTreeParentPtr, int attributes, const char **attr, ESIContext *); + ~esiInclude(); + void render(ESISegment::Pointer); + esiProcessResult_t process (int dovars); + Pointer makeCacheable() const; + Pointer makeUsable(esiTreeParentPtr, esiVarState &) const; + void subRequestDone (esiStreamContext *, bool); + + struct + { + +int onerrorcontinue: + 1; /* on error return zero data */ + +int failed: + 1; /* Failed to process completely */ + +int finished: + 1; /* Finished getting subrequest data */ + } + + flags; + esiStreamContext *src; + esiStreamContext *alt; + ESISegment::Pointer srccontent; + ESISegment::Pointer altcontent; + esiVarState *varState; + char *srcurl, *alturl; + void fail(esiStreamContext *); + void finish(); + +private: + static MemPool *Pool; + static void Start (esiStreamContext *, char const *, esiVarState *); + esiTreeParentPtr parent; + void start(); + bool started; + bool sent; + esiInclude(esiInclude const &); + bool dataNeeded() const; +}; + +MemPool *esiInclude::Pool = NULL; + +/* esiRemove */ + +class esiRemove : public ESIElement +{ + +public: + void *operator new (size_t byteCount); + void operator delete (void *address); + void deleteSelf() const; + + esiRemove(); + void render(ESISegment::Pointer); + bool addElement (ESIElement::Pointer); + Pointer makeCacheable() const; + Pointer makeUsable(esiTreeParentPtr, esiVarState &) const; + void finish(); +}; + +CBDATA_TYPE (esiRemove); +static FREE esiRemoveFree; +static ESIElement * esiRemoveNew(void); + + +/* esiTry */ + +struct esiTry : public ESIElement +{ + void *operator new (size_t byteCount); + void operator delete (void *address); + void deleteSelf() const; + + esiTry(esiTreeParentPtr aParent); + ~esiTry(); + + void render(ESISegment::Pointer); + bool addElement (ESIElement::Pointer); + void fail(ESIElement *); + esiProcessResult_t process (int dovars); + void provideData (ESISegment::Pointer data, ESIElement * source); + Pointer makeCacheable() const; + Pointer makeUsable(esiTreeParentPtr, esiVarState &) const; + + ESIElement::Pointer attempt; + ESIElement::Pointer except; + + struct + { + +int attemptok: + 1; /* the attempt branch process correctly */ + +int exceptok: + 1; /* likewise */ + +int attemptfailed: + 1; /* The attempt branch failed */ + +int exceptfailed: + 1; /* the except branch failed */ + } + + flags; + void finish(); + +private: + static MemPool *Pool; + void notifyParent(); + esiTreeParentPtr parent; + ESISegment::Pointer exceptbuffer; + esiTry (esiTry const &); + esiProcessResult_t bestAttemptRV() const; +}; + +MemPool *esiTry::Pool = NULL; + +/* esiVar */ + +struct esiVar:public esiSequence +{ + // void *operator new (size_t byteCount); + // void operator delete (void *address); + void deleteSelf() const; + esiVar(esiTreeParentPtr aParent) : esiSequence (aParent) + { + flags.dovars = 1; + } +}; + +/* esiChoose */ + +struct esiChoose : public ESIElement +{ + void *operator new (size_t byteCount); + void operator delete (void *address); + void deleteSelf() const; + + esiChoose(esiTreeParentPtr); + ~esiChoose(); + + void render(ESISegment::Pointer); + bool addElement (ESIElement::Pointer); + void fail(ESIElement *); + esiProcessResult_t process (int dovars); + + void provideData (ESISegment::Pointer data, ESIElement *source); + void makeCachableElements(esiChoose const &old); + void makeUsableElements(esiChoose const &old, esiVarState &); + Pointer makeCacheable() const; + Pointer makeUsable(esiTreeParentPtr, esiVarState &) const; + void NULLUnChosen(); + + ElementList elements; + int chosenelement; + ESIElement::Pointer otherwise; + void finish(); + +private: + static MemPool *Pool; + esiChoose(esiChoose const &); + esiTreeParentPtr parent; + void checkValidSource (ESIElement::Pointer source) const; + void selectElement(); +}; + +MemPool *esiChoose::Pool = NULL; + +/* esiWhen */ + +struct esiWhen : public esiSequence +{ + void *operator new (size_t byteCount); + void operator delete (void *address); + void deleteSelf() const; + esiWhen(esiTreeParentPtr aParent, int attributes, const char **attr, esiVarState *); + ~esiWhen(); + Pointer makeCacheable() const; + Pointer makeUsable(esiTreeParentPtr, esiVarState &) const; + + bool testsTrue() const { return testValue;} + + void setTestResult(bool aBool) {testValue = aBool;} + +private: + static MemPool *Pool; + esiWhen (esiWhen const &); + bool testValue; + char const *unevaluatedExpression; + esiVarState *varState; + void evaluate(); +}; + +MemPool *esiWhen::Pool = NULL; + +/* esiOtherwise */ + +struct esiOtherwise : public esiSequence +{ + // void *operator new (size_t byteCount); + // void operator delete (void *address); + void deleteSelf() const; + esiOtherwise(esiTreeParentPtr aParent) : esiSequence (aParent) {}} + +; + +CBDATA_CLASS_INIT(ESIContext); + +void ESIContext::startRead() +{ + assert (!reading_); + reading_ = true; +} + +void ESIContext::finishRead() +{ + assert (reading_); + reading_ = false; +} + +bool ESIContext::reading() const +{ + return reading_; +} + +typedef RefCount esiIncludePtr; + +struct _esiStreamContext +{ + +public: + void *operator new(size_t); + _esiStreamContext(); + int finished; + esiIncludePtr include; + ESISegment::Pointer localbuffer; + ESISegment::Pointer buffer; +}; + +CBDATA_TYPE (esiStreamContext); + +_esiStreamContext::_esiStreamContext() : finished(false), include (NULL), localbuffer (new ESISegment), buffer (NULL) +{} + +/* Local functions */ +/* ESIContext */ +static ESIContext *ESIContextNew(HttpReply *, clientStreamNode *, clientHttpRequest *); +/* esiStreamContext */ +static FREE esiStreamContextFree; +static esiStreamContext *esiStreamContextNew (esiIncludePtr); + +/* other */ +static CSCB esiBufferRecipient; +static CSD esiBufferDetach; + +/* ESI TO CONSIDER: + * 1. retry failed upstream requests + */ + +void * +ESIContext::operator new(size_t byteCount) +{ + assert (byteCount == sizeof (ESIContext)); + CBDATA_INIT_TYPE(ESIContext); + ESIContext *result = cbdataAlloc(ESIContext); + /* Mark result as being owned - we want the refcounter to do the + * delete call + */ + cbdataReference(result); + return result; +} + +void +ESIContext::operator delete (void *address) +{ + ESIContext *t = static_cast(address); + cbdataFree(t); + /* And allow the memory to be freed */ + cbdataReferenceDone (address); +} + +void +ESIContext::deleteSelf() const +{ + delete this; +} + +void +ESIContext::setError() +{ + errorpage = ERR_ESI; + errorstatus = HTTP_INTERNAL_SERVER_ERROR; + flags.error = 1; +} + +void +ESIContext::appendOutboundData(ESISegment::Pointer theData) +{ + if (!outbound.getRaw()) { + outbound = theData; + outboundtail = outbound; + } else { + assert (outboundtail->next.getRaw() == NULL); + outboundtail->next = theData; + } + + fixupOutboundTail(); + debug (86,9)("ESIContext::appendOutboundData: outbound %p\n", outbound.getRaw()); +} + +void +ESIContext::provideData (ESISegment::Pointer theData, ESIElement * source) +{ + debug (86,5)("ESIContext::provideData: %p %p %p\n",this, theData.getRaw(), source); + /* No callbacks permitted after finish() called on the tree */ + assert (tree.getRaw()); + assert (source == tree); + appendOutboundData(theData); + trimBlanks(); + + if (!processing) + send(); +} + +void +ESIContext::fail (ESIElement * source) +{ + setError(); + fail (); + send (); +} + +void +ESIContext::fixupOutboundTail() +{ + /* TODO: fixup thisNode outboundtail dross a little */ + + if (outboundtail.getRaw()) + outboundtail = outboundtail->tail(); +} + +esiKick_t +ESIContext::kick () +{ + assert (this); + + if (flags.kicked) { + debug (86,5)("esiKick: Re-entered whilst in progress\n"); + // return ESI_KICK_INPROGRESS; + } else + ++flags.kicked; + + if (flags.detached) + /* we've been detached from - we can't do anything more */ + return ESI_KICK_FAILED; + + /* Something has occured. Process any remaining nodes */ + if (!flags.finished) + /* Process some of our data */ + switch (process ()) { + + case ESI_PROCESS_COMPLETE: + debug (86,5)("esiKick: esiProcess OK\n"); + break; + + case ESI_PROCESS_PENDING_WONTFAIL: + debug (86,5)("esiKick: esiProcess PENDING OK\n"); + break; + + case ESI_PROCESS_PENDING_MAYFAIL: + debug (86,5)("esiKick: esiProcess PENDING UNKNOWN\n"); + break; + + case ESI_PROCESS_FAILED: + debug (86,0)("esiKick: esiProcess %p FAILED\n", this); + /* this can not happen - processing can't fail until we have data, + * and when we come here we have sent data to the client + */ + + if (pos == 0) + fail (); + + --flags.kicked; + + return ESI_KICK_FAILED; + } + + /* Render if we can to get maximal sent data */ + assert (tree.getRaw() || flags.error); + + if (!flags.finished && !outbound.getRaw()) { + outboundtail = new ESISegment; + outbound = outboundtail; + } + + if (!flags.error && !flags.finished) + tree->render(outboundtail); + + if (!flags.finished) + fixupOutboundTail(); + + /* Is there data to send? */ + if (send ()) { + /* some data was sent. we're finished until the next read */ + --flags.kicked; + return ESI_KICK_SENT; + } + + --flags.kicked; + /* nothing to send */ + return flags.error ? ESI_KICK_FAILED : ESI_KICK_PENDING; +} + +/* request from downstream for more data + */ +void +esiStreamRead (clientStreamNode *thisNode, clientHttpRequest *http) +{ + clientStreamNode *next; + ESIContext *context; + /* Test preconditions */ + assert (thisNode != NULL); + assert (cbdataReferenceValid (thisNode)); + /* we are not in the chain until ESI is detected on a data callback */ + assert (thisNode->data != NULL); + assert (thisNode->node.prev != NULL); + assert (thisNode->node.next != NULL); + + context = (ESIContext *)cbdataReference (thisNode->data); + + if (context->flags.passthrough) { + /* passthru mode - read into supplied buffers */ + next = thisNode->next(); + clientStreamRead (thisNode, http, next->readBuffer); + cbdataReferenceDone (context); + return; + } + + context->flags.clientwantsdata = 1; + debug (86,5)("esiStreamRead: Client now wants data\n"); + + /* Ok, not passing through */ + + switch (context->kick ()) { + + case ESIContext::ESI_KICK_FAILED: + /* this can not happen - processing can't fail until we have data, + * and when we come here we have sent data to the client + */ + + case ESIContext::ESI_KICK_SENT: + + case ESIContext::ESI_KICK_INPROGRESS: + cbdataReferenceDone (context); + return; + + case ESIContext::ESI_KICK_PENDING: + break; + } + + /* Nothing to send */ + + if (context->flags.oktosend && (context->flags.finishedtemplate + || context->cachedASTInUse) && + ! context->flags.finished) { + /* we've started sending, finished reading, but not finished + * processing. stop here, a callback will resume the stream + * flow + */ + debug (86,5) ("esiStreamRead: Waiting for async resume of esi processing\n"); + cbdataReferenceDone (context); + return; + } + + if (context->flags.oktosend && context->flags.finished && context->outbound.getRaw()) { + debug (86,5)("all processing complete, but outbound data still buffered\n"); + assert (!context->flags.clientwantsdata); + /* client MUST be processing the last reply */ + cbdataReferenceDone (context); + return; + } + + + if (context->flags.oktosend && context->flags.finished) { + StoreIOBuffer tempBuffer; + assert (!context->outbound.getRaw()); + /* We've finished processing, and there is no more data buffered */ + debug (86,5)("Telling recipient EOF on READ\n"); + clientStreamCallback (thisNode, http, NULL, tempBuffer); + cbdataReferenceDone (context); + return; + } + + if (context->reading()) { + cbdataReferenceDone (context); + return; + } + + /* no data that is ready to send, and still reading? well, lets get some */ + /* secure a buffer */ + if (!context->incoming.getRaw()) { + /* create a new buffer segment */ + context->buffered = new ESISegment; + context->incoming = context->buffered; + } + + assert (context->incoming.getRaw() && context->incoming->len != HTTP_REQBUF_SZ); + { + StoreIOBuffer tempBuffer; + tempBuffer.offset = context->readpos; + tempBuffer.length = context->incoming->len - HTTP_REQBUF_SZ; + tempBuffer.data = &context->incoming->buf[context->incoming->len]; + context->startRead(); + clientStreamRead (thisNode, http, tempBuffer); + } + + cbdataReferenceDone (context); +} + +clientStream_status_t +esiStreamStatus (clientStreamNode *thisNode, clientHttpRequest *http) +{ + /* Test preconditions */ + assert (thisNode != NULL); + assert (cbdataReferenceValid (thisNode)); + /* we are not in the chain until ESI is detected on a data callback */ + assert (thisNode->data != NULL); + assert (thisNode->node.prev != NULL); + assert (thisNode->node.next != NULL); + + ESIContext *context = (ESIContext *)cbdataReference (thisNode->data); + + if (context->flags.passthrough) { + cbdataReferenceDone (context); + return clientStreamStatus (thisNode, http); + } + + if (context->flags.oktosend && context->flags.finished && + !(context->outbound.getRaw() && context->outbound_offset < context->outbound->len)) { + cbdataReferenceDone (context); + debug (86,5) ("Telling recipient EOF on STATUS\n"); + return STREAM_UNPLANNED_COMPLETE; /* we don't know lengths in advance */ + } + + /* ?? RC: we can't be aborted / fail ? */ + cbdataReferenceDone (context); + + return STREAM_NONE; +} + +static int +esiAlwaysPassthrough(http_status sline) +{ + switch (sline) { + + case HTTP_CONTINUE: /* Should never reach us... but squid needs to alter to accomodate this */ + + case HTTP_SWITCHING_PROTOCOLS: /* Ditto */ + + case HTTP_PROCESSING: /* Unknown - some extension */ + + case HTTP_NO_CONTENT: /* no body, no esi */ + + case HTTP_NOT_MODIFIED: /* ESI does not affect assembled page headers, so 304s are valid */ + return 1; + /* unreached */ + break; + + default: + return 0; + } +} + +void +ESIContext::trimBlanks() +{ + /* trim leading empty buffers ? */ + + while (outbound.getRaw() && outbound->next.getRaw() && !outbound->len) { + debug(86,5)("ESIContext::trimBlanks: %p skipping segment %p\n", this, outbound.getRaw()); + outbound = outbound->next; + } + + if (outboundtail.getRaw()) + assert (outbound.getRaw()); +} + +/* Send data downstream + * Returns 0 if nothing was sent. Non-zero if data was sent. + */ +size_t +ESIContext::send () +{ + debug (86,5)("ESIContext::send: this=%p\n",this); + /* send any processed data */ + + trimBlanks(); + + if (!flags.clientwantsdata) { + debug (86,5)("ESIContext::send: Client does not want data - not sending anything\n"); + return 0; + } + + if (tree.getRaw() && tree->mayFail()) { + debug (86, 5)("ESIContext::send: Tree may fail. Not sending.\n"); + return 0; + } else + flags.oktosend = 1; + +#if 0 + + if (!flags.oktosend) { + + fatal("ESIContext::send: Not OK to send.\n"); + return 0; + } + +#endif + + if (!(rep || (outbound.getRaw() && + outbound->len && (outbound_offset <= outbound->len)))) { + debug (86,5)("ESIContext::send: Nothing to send.\n"); + return 0; + } + + debug (86,5)("ESIContext::send: Sending something...\n"); + /* Yes! Send it without asking for more upstream */ + /* memcopying because the client provided the buffer */ + /* TODO: skip data until pos == next->readoff; */ + assert (thisNode->data == this); + clientStreamNode *next = thisNode->next(); + cbdataReference (this); + size_t len = 0; + + if (outbound.getRaw()) + len = min (next->readBuffer.length, outbound->len - outbound_offset); + + /* prevent corruption on range requests, even though we don't support them yet */ + assert (pos == next->readBuffer.offset); + + /* We must send data or a reply */ + assert (len != 0 || rep != NULL); + + if (len) { + xmemcpy (next->readBuffer.data, &outbound->buf[outbound_offset], len); + + if (len + outbound_offset == outbound->len) { + ESISegment::Pointer temp = outbound->next; + /* remove the used buffer */ + outbound_offset = 0; + outbound = temp; + } + + pos += len; + + if (!outbound.getRaw()) + outboundtail = NULL; + + trimBlanks(); + } + + flags.clientwantsdata = 0; + debug (86,5)("ESIContext::send: this=%p Client no longer wants data \n",this); + /* Deal with re-entrancy */ + HttpReply *temprep = rep; + rep = NULL; /* freed downstream */ + + if (temprep && varState) + varState->buildVary (temprep); + + { + StoreIOBuffer tempBuffer; + tempBuffer.length = len; + tempBuffer.offset = pos - len; + tempBuffer.data = next->readBuffer.data; + clientStreamCallback (thisNode, http, temprep, tempBuffer); + } + + if (len == 0) + len = 1; /* tell the caller we sent something (because we sent headers */ + + ESIContext *temp = this; + + cbdataReferenceDone (temp); + + debug (86,5)("ESIContext::send: this=%p sent %d\n",this,len); + + return len; +} + +void +ESIContext::finishChildren() +{ + if (tree.getRaw()) + tree->finish(); + + tree = NULL; +} + +/* Detach event from a client Stream */ +void +esiStreamDetach (clientStreamNode *thisNode, clientHttpRequest *http) +{ + /* if we have pending callbacks, tell them we're done. */ + ESIContext *context; + /* test preconditions */ + assert (thisNode != NULL); + assert (cbdataReferenceValid (thisNode)); + context = ( ESIContext *)cbdataReference(thisNode->data); + /* detach from the stream */ + clientStreamDetach (thisNode,http); + /* if we have pending callbacks (from subincludes), tell them we're done. */ + context->thisNode = NULL; + context->flags.detached = 1; + context->finishChildren(); + /* HACK for parser stack not being emptied */ + context->parserState.stack[0] = NULL; + /* allow refcount logic to trigger */ + context->cbdataLocker = NULL; + cbdataReferenceDone (context); +} + +/* Process incoming data for ESI tags */ +/* ESI TODO: Long term: we should have a framework to parse html/xml and + * callback to a set of processors like thisNode, to prevent multiple parsing + * overhead. More thoughts on thisNode: We have to parse multiple times, because + * the output of one processor may create a very different tree. What we could + * do is something like DOM and pass that down to a final renderer. This is + * getting into web server territory though... + * + * Preconditions: + * This is not the last node in the stream. + * ESI processing has been enabled. + * There is context data or a reply structure + */ +void +esiProcessStream (clientStreamNode *thisNode, clientHttpRequest *http, HttpReply *rep, StoreIOBuffer recievedData) +{ + ESIContext *context; + /* test preconditions */ + assert (thisNode != NULL); + /* ESI TODO: handle thisNode rather than asserting - it should only ever + * happen if we cause an abort and the callback chain + * loops back to here, so we can simply return. However, that itself + * shouldn't happen, so it stays as an assert for now. */ + assert (cbdataReferenceValid (thisNode)); + /* + * if data is NULL thisNode is the first entrance. If rep is also NULL, + * something is wrong. + * */ + assert (thisNode->data != NULL || rep); + assert (thisNode->node.next != NULL); + + if (!thisNode->data) + /* setup ESI context from reply headers */ + thisNode->data = ESIContextNew(rep, thisNode, http); + + context = (ESIContext *)cbdataReference(thisNode->data); + + context->finishRead(); + + /* Skipping all ESI processing. All remaining data gets untouched. + * Mainly used when an error or other non-ESI processable entity + * has been detected to prevent ESI processing the error body + */ + if (context->flags.passthrough) { + cbdataReferenceDone(context); + clientStreamCallback (thisNode, http, rep, recievedData); + return; + } + + debug (86, 3)("esiProcessStream: Processing thisNode %p context %p offset %d length %u\n",thisNode, context, (int) recievedData.offset, (unsigned int)recievedData.length); + + /* once we finish the template, we *cannot* return here */ + assert (!context->flags.finishedtemplate); + assert (!context->cachedASTInUse); + + /* Can we generate any data ?*/ + + if (recievedData.data) { + /* Increase our buffer area with incoming data */ + assert (recievedData.length <= HTTP_REQBUF_SZ); + assert (thisNode->readBuffer.offset == recievedData.offset); + debug (86,5)("esiProcessStream found %u bytes of body data at offset %ld\n", recievedData.length, recievedData.offset); + /* secure the data for later use */ + + if (!context->incoming.getRaw()) { + /* create a new buffer segment */ + debug (86,5) ("esiProcessStream: Setting up incoming buffer\n"); + context->buffered = new ESISegment; + context->incoming = context->buffered; + } + + if (recievedData.data != &context->incoming->buf[context->incoming->len]) { + /* We have to copy the data out because we didn't supply thisNode buffer */ + size_t space = HTTP_REQBUF_SZ - context->incoming->len; + size_t len = min (space, recievedData.length); + debug (86,5)("Copying data from %p to %p because our buffer was not used\n", recievedData.data, + &context->incoming->buf[context->incoming->len]); + xmemcpy (&context->incoming->buf[context->incoming->len], recievedData.data, len); + context->incoming->len += len; + + if (context->incoming->len == HTTP_REQBUF_SZ) { + /* append another buffer */ + context->incoming->next = new ESISegment; + context->incoming = context->incoming->next; + } + + if (len != recievedData.length) { + /* capture the remnants */ + xmemcpy (context->incoming->buf, &recievedData.data[len], recievedData.length - len); + context->incoming->len = recievedData.length - len; + } + + /* and note where we are up to */ + context->readpos += recievedData.length; + } else { + /* update our position counters, and if needed assign a new buffer */ + context->incoming->len += recievedData.length; + assert (context->incoming->len <= HTTP_REQBUF_SZ); + + if (context->incoming->len > HTTP_REQBUF_SZ * 3 / 4) { + /* allocate a new buffer - to stop us asking for ridiculously small amounts */ + context->incoming->next = new ESISegment; + context->incoming = context->incoming->next; + } + + context->readpos += recievedData.length; + } + } + + /* EOF / Read error / aborted entry */ + if (rep == NULL && recievedData.data == NULL && recievedData.length == 0 && !context->flags.finishedtemplate) { + /* TODO: get stream status to test the entry for aborts */ + /* else flush the esi processor */ + debug (86,5)("esiProcess: %p Finished reading upstream data\n", context); + /* This is correct */ + context->flags.finishedtemplate = 1; + } + + switch (context->kick()) { + + case ESIContext::ESI_KICK_FAILED: + /* thisNode can not happen - processing can't fail until we have data, + * and when we come here we have sent data to the client + */ + cbdataReferenceDone (context); + return; + + case ESIContext::ESI_KICK_SENT: + + case ESIContext::ESI_KICK_INPROGRESS: + cbdataReferenceDone (context); + return; + + case ESIContext::ESI_KICK_PENDING: + break; + } + + /* ok.. no data sent, try to pull more data in from upstream. + * FIXME: Don't try thisNode if we have finished reading the template + */ + if (!context->flags.finishedtemplate && !context->reading() + && !context->cachedASTInUse) { + StoreIOBuffer tempBuffer; + assert (context->incoming.getRaw() && context->incoming->len < HTTP_REQBUF_SZ); + tempBuffer.offset = context->readpos; + tempBuffer.length = HTTP_REQBUF_SZ - context->incoming->len; + tempBuffer.data = &context->incoming->buf[context->incoming->len]; + context->startRead(); + clientStreamRead (thisNode, http, tempBuffer); + cbdataReferenceDone (context); + return; + } + + debug (86,3)("esiProcessStream: no data to send, no data to read, awaiting a callback\n"); + cbdataReferenceDone(context); +} + +ESIContext::~ESIContext() +{ + freeResources (); + /* Not freed by freeresources because esi::fail needs it */ + safe_free (errormessage); + debug (86,3)("ESIContext::~ESIContext: Freed %p\n", this); +} + +ESIContext * +ESIContextNew (HttpReply *rep, clientStreamNode *thisNode, clientHttpRequest *http) +{ + assert (rep); + ESIContext *rv = new ESIContext; + rv->rep = rep; + rv->cbdataLocker = rv; + + if (esiAlwaysPassthrough(rep->sline.status)) { + rv->flags.passthrough = 1; + } else { + /* remove specific headers for ESI to prevent + * downstream cache confusion */ + HttpHeader *hdr = &rep->header; + httpHeaderDelById(hdr, HDR_ACCEPT_RANGES); + httpHeaderDelById(hdr, HDR_ETAG); + httpHeaderDelById(hdr, HDR_CONTENT_LENGTH); + httpHeaderDelById(hdr, HDR_CONTENT_MD5); + rv->tree = new esiSequence (rv, true); + rv->thisNode = thisNode; + rv->http = http; + rv->flags.clientwantsdata = 1; + rv->varState = new esiVarState (&http->request->header, http->uri); + debug (86,5)("ESIContextNew: Client wants data (always created during reply cycle\n"); + } + + debug (86,5)("ESIContextNew: Create context %p\n",rv); + return rv; +} + +ESIElement::ESIElementType_t +ESIElement::IdentifyElement (const char *el) +{ + int offset = 0; + assert (el); + + if (strlen (el) < 5) + return ESI_ELEMENT_NONE; + + if (!strncmp (el, "esi:", 4)) + offset = 4; + else if (!strncmp (el, "http://www.edge-delivery.org/esi/1.0|", 37)) + offset = 37; + else + return ESI_ELEMENT_NONE; + + if (!strncmp (el + offset, "otherwise", 9)) + return ESI_ELEMENT_OTHERWISE; + + if (!strncmp (el + offset, "comment", 7)) + return ESI_ELEMENT_COMMENT; + + if (!strncmp (el + offset, "include", 7)) + return ESI_ELEMENT_INCLUDE; + + if (!strncmp (el + offset, "attempt", 7)) + return ESI_ELEMENT_ATTEMPT; + + if (!strncmp (el + offset, "remove", 6)) + return ESI_ELEMENT_REMOVE; + + if (!strncmp (el + offset, "except", 6)) + return ESI_ELEMENT_EXCEPT; + + if (!strncmp (el + offset, "choose", 6)) + return ESI_ELEMENT_CHOOSE; + + if (!strncmp (el + offset, "vars", 4)) + return ESI_ELEMENT_VARS; + + if (!strncmp (el + offset, "when", 4)) + return ESI_ELEMENT_WHEN; + + if (!strncmp (el + offset, "try", 3)) + return ESI_ELEMENT_TRY; + + return ESI_ELEMENT_NONE; +} + +ESIElement::Pointer +ESIContext::ParserState::top() +{ + return stack[stackdepth-1]; +} + +ESIContext::ParserState::ParserState() : inited_ (false) +{} + +bool +ESIContext::ParserState::inited() const +{ + return inited_; +} + +void +ESIContext::addStackElement (ESIElement::Pointer element) +{ + /* Put on the stack to allow skipping of 'invalid' markup */ + assert (parserState.stackdepth <11); + assert (!failed()); + debug (86,5)("ESIContext::addStackElement: About to add ESI Node %p\n", element.getRaw()); + + if (!parserState.top()->addElement(element)) { + debug (86,1)("ESIContext::addStackElement: failed to add esi node, probable error in ESI template\n"); + flags.error = 1; + } else { + /* added ok, push onto the stack */ + parserState.stack[parserState.stackdepth++] = element; + } +} + +void +ESIContext::start(const char *el, const char **attr, size_t attrCount) +{ + int i; + unsigned int ellen = strlen (el); + char localbuf [HTTP_REQBUF_SZ]; + ESIElement::Pointer element; + int specifiedattcount = attrCount * 2; + char *pos; + assert (ellen < sizeof (localbuf)); /* prevent unexpected overruns. */ + + debug (86, 5)("ESIContext::Start: element '%s' with %d tags\n", el, specifiedattcount); + + if (failed()) + /* waiting for expat to finish the buffer we gave it */ + return; + + switch (ESIElement::IdentifyElement (el)) { + + case ESIElement::ESI_ELEMENT_NONE: + /* Spit out elements we aren't interested in */ + localbuf[0] = '<'; + localbuf[1] = '\0'; + assert (xstrncpy (&localbuf[1], el, sizeof(localbuf) - 2)); + pos = localbuf + strlen (localbuf); + + for (i = 0; i < specifiedattcount && attr[i]; i += 2) { + *pos++ = ' '; + /* TODO: handle thisNode gracefully */ + assert (xstrncpy (pos, attr[i], sizeof(localbuf) + (pos - localbuf))); + pos += strlen (pos); + *pos++ = '='; + *pos++ = '\''; + assert (xstrncpy (pos, attr[i + 1], sizeof(localbuf) + (pos - localbuf))); + pos += strlen (pos); + *pos++ = '\''; + } + + *pos++ = '>'; + *pos = '\0'; + + addLiteral (localbuf, pos - localbuf); + debug (86,5)("esi stack depth %d\n",parserState.stackdepth); + return; + break; + + case ESIElement::ESI_ELEMENT_COMMENT: + /* Put on the stack to allow skipping of 'invalid' markup */ + element = new esiComment (); + break; + + case ESIElement::ESI_ELEMENT_INCLUDE: + /* Put on the stack to allow skipping of 'invalid' markup */ + element = new esiInclude (parserState.top().getRaw(), specifiedattcount, attr, this); + break; + + case ESIElement::ESI_ELEMENT_REMOVE: + /* Put on the stack to allow skipping of 'invalid' markup */ + element = esiRemoveNew (); + break; + + case ESIElement::ESI_ELEMENT_TRY: + /* Put on the stack to allow skipping of 'invalid' markup */ + element = new esiTry (parserState.top().getRaw()); + break; + + case ESIElement::ESI_ELEMENT_ATTEMPT: + /* Put on the stack to allow skipping of 'invalid' markup */ + element = new esiAttempt (parserState.top().getRaw()); + break; + + case ESIElement::ESI_ELEMENT_EXCEPT: + /* Put on the stack to allow skipping of 'invalid' markup */ + element = new esiExcept (parserState.top().getRaw()); + break; + + case ESIElement::ESI_ELEMENT_VARS: + /* Put on the stack to allow skipping of 'invalid' markup */ + element = new esiVar (parserState.top().getRaw()); + break; + + case ESIElement::ESI_ELEMENT_CHOOSE: + /* Put on the stack to allow skipping of 'invalid' markup */ + element = new esiChoose (parserState.top().getRaw()); + break; + + case ESIElement::ESI_ELEMENT_WHEN: + /* Put on the stack to allow skipping of 'invalid' markup */ + element = new esiWhen (parserState.top().getRaw(), specifiedattcount, attr, varState); + break; + + case ESIElement::ESI_ELEMENT_OTHERWISE: + /* Put on the stack to allow skipping of 'invalid' markup */ + element = new esiOtherwise (parserState.top().getRaw()); + break; + } + + addStackElement(element); + + debug (86,5)("esi stack depth %d\n",parserState.stackdepth); + +} /* End of start handler */ + +void +ESIContext::end(const char *el) +{ + unsigned int ellen = strlen (el); + char localbuf [HTTP_REQBUF_SZ]; + char *pos; + + if (flags.error) + /* waiting for expat to finish the buffer we gave it */ + return; + + switch (ESIElement::IdentifyElement (el)) { + + case ESIElement::ESI_ELEMENT_NONE: + assert (ellen < sizeof (localbuf)); /* prevent unexpected overruns. */ + /* Add elements we aren't interested in */ + localbuf[0] = '<'; + localbuf[1] = '/'; + assert (xstrncpy (&localbuf[2], el, sizeof(localbuf) - 3)); + pos = localbuf + strlen (localbuf); + *pos++ = '>'; + *pos = '\0'; + addLiteral (localbuf, pos - localbuf); + break; + + case ESIElement::ESI_ELEMENT_COMMENT: + + case ESIElement::ESI_ELEMENT_INCLUDE: + + case ESIElement::ESI_ELEMENT_REMOVE: + + case ESIElement::ESI_ELEMENT_TRY: + + case ESIElement::ESI_ELEMENT_ATTEMPT: + + case ESIElement::ESI_ELEMENT_EXCEPT: + + case ESIElement::ESI_ELEMENT_VARS: + + case ESIElement::ESI_ELEMENT_CHOOSE: + + case ESIElement::ESI_ELEMENT_WHEN: + + case ESIElement::ESI_ELEMENT_OTHERWISE: + /* pop of the stack */ + parserState.stack[--parserState.stackdepth] = NULL; + break; + } +} /* End of end handler */ + +void +ESIContext::parserDefault (const char *s, int len) +{ + if (failed()) + return; + + /* handle any skipped data */ + addLiteral (s, len); +} + +void +ESIContext::parserComment (const char *s) +{ + if (failed()) + return; + + if (!strncmp(s, "esi",3)) { + debug (86,5)("ESIContext::parserComment: ESI ", 4); + addLiteral (localbuf,len + 7); + } +} + +void +ESIContext::addLiteral (const char *s, int len) +{ + /* handle any skipped data */ + assert (len); + debug (86,5)("literal length is %d\n", len); + /* give a literal to the current element */ + assert (parserState.stackdepth <11); + ESIElement::Pointer element (new esiLiteral (this, s, len)); + + if (!parserState.top()->addElement(element)) { + debug (86,1)("ESIContext::addLiteral: failed to add esi node, probable error in ESI template\n"); + flags.error = 1; + } +} + +void +ESIContext::ParserState::init(ESIParserClient *userData) +{ + theParser = ESIParser::NewParser (userData); + inited_ = true; +} + +void +ESIContext::parseOneBuffer() +{ + assert (buffered.getRaw()); + + debug (86,9)("ESIContext::parseOneBuffer: %d bytes\n",buffered->len); + bool lastBlock = buffered->next.getRaw() == NULL && flags.finishedtemplate ? true : false; + + if (! parserState.theParser->parse(buffered->buf, buffered->len, lastBlock)) { + setError(); + char tempstr[1024]; + snprintf (tempstr, 1023, "esiProcess: Parse error at line %d:\n%s\n", + parserState.theParser->lineNumber(), + parserState.theParser->errorString()); + debug (86,0)("%s", tempstr); + + if (!errormessage) + errormessage = xstrdup (tempstr); + + assert (flags.error); + + return; + } + + if (flags.error) { + setError(); + return; + } + + ESISegment::Pointer temp = buffered; + buffered = temp->next; +} + +void +ESIContext::parse() +{ + if (!parserState.stackdepth) { + debug (86,5)("empty parser stack, inserting the top level node\n"); + assert (tree.getRaw()); + parserState.stack[parserState.stackdepth++] = tree; + } + + if (rep && !parserState.inited()) + parserState.init(this); + + /* we have data */ + if (buffered.getRaw()) { + parserState.parsing = 1; + /* we don't keep any data around */ + + PROF_start(esiParsing); + + while (buffered.getRaw() && !flags.error) + parseOneBuffer(); + + PROF_stop(esiParsing); + + /* Tel the read code to allocate a new buffer */ + incoming = NULL; + + parserState.parsing = 0; + } +} + +esiProcessResult_t +ESIContext::process () +{ + /* parsing: + * read through buffered, skipping plain text, and skipping any + * <...> entry that is not an process(0); + processing = false; + + switch (status) + { + + case ESI_PROCESS_COMPLETE: + debug (86,5)("esiProcess: tree Processed OK\n"); + break; + + case ESI_PROCESS_PENDING_WONTFAIL: + debug (86,5)("esiProcess: tree Processed PENDING OK\n"); + break; + + case ESI_PROCESS_PENDING_MAYFAIL: + debug (86,5)("esiProcess: tree Processed PENDING UNKNOWN\n"); + break; + + case ESI_PROCESS_FAILED: + debug (86,0)("esiProcess: tree Processed FAILED\n"); + setError(); + + if (!errormessage) + errormessage = xstrdup("esiProcess: ESI template Processing failed."); + + PROF_stop(esiProcessing); + + return ESI_PROCESS_FAILED; + + break; + } + + if (status != ESI_PROCESS_PENDING_MAYFAIL && (flags.finishedtemplate || cachedASTInUse)) + { + /* We've read the entire template, and no nodes will + * return failure + */ + debug (86,5)("esiProcess, request will succeed\n"); + flags.oktosend = 1; + } + + if (status == ESI_PROCESS_COMPLETE + && (flags.finishedtemplate || cachedASTInUse)) + { + /* we've finished all processing. Render and send. */ + debug (86,5)("esiProcess, processing complete\n"); + flags.finished = 1; + } + + PROF_stop(esiProcessing); + return status; /* because we have no callbacks */ + } +} + +void +ESIContext::ParserState::freeResources() +{ + theParser = NULL; + inited_ = false; +} + +void +ESIContext::ParserState::popAll() +{ + while (stackdepth) + stack[--stackdepth] = NULL; +} + +void +ESIContext::freeResources () +{ + debug (86,5)("ESIContext::freeResources: Freeing for this=%p\n",this); + + if (rep) { + httpReplyDestroy(rep); + rep = NULL; + } + + finishChildren (); + + if (parserState.inited()) { + parserState.freeResources(); + } + + parserState.popAll(); + ESISegmentFreeList (buffered); + ESISegmentFreeList (outbound); + ESISegmentFreeList (outboundtail); + cbdataFree (varState); + /* don't touch incoming, it's a pointer into buffered anyway */ +} + +extern ErrorState *clientBuildError (err_type, http_status, char const *, struct in_addr *, request_t *); + + +/* This can ONLY be used before we have sent *any* data to the client */ +void +ESIContext::fail () +{ + debug (86,5)("ESIContext::fail: this=%p\n",this); + /* check preconditions */ + assert (pos == 0); + /* cleanup current state */ + freeResources (); + /* Stop altering thisNode request */ + flags.oktosend = 1; + flags.finished = 1; + /* don't honour range requests - for errors we send it all */ + flags.error = 1; + /* create an error object */ + ErrorState * err = clientBuildError(errorpage, errorstatus, NULL, + http->conn ? &http->conn->peer.sin_addr : &no_addr, http->request); + err->err_msg = errormessage; + errormessage = NULL; + rep = errorBuildReply (err); + assert (rep->body.mb.size >= 0); + size_t errorprogress = rep->body.mb.size; + /* Tell esiSend where to start sending from */ + outbound_offset = 0; + /* copy the membuf from the reply to outbound */ + + while (errorprogress < (size_t)rep->body.mb.size) { + appendOutboundData(new ESISegment); + errorprogress += outboundtail->append(rep->body.mb.buf + errorprogress, rep->body.mb.size - errorprogress); + } + + /* the esiCode now thinks that the error is the outbound, + * and all processing has finished. */ + /* Send as much as we can */ + send (); + + /* don't cancel anything. The stream nodes will clean up after + * themselves when the reply is freed - and we don't know what to + * clean anyway. + */ +} + +/* Detach from a buffering stream + */ +void +esiBufferDetach (clientStreamNode *node, clientHttpRequest *http) +{ + /* Detach ourselves */ + clientStreamDetach (node, http); +} + +/* + * Write a chunk of data to a client 'socket'. + * If the reply is present, send the reply headers down the wire too, + * and clean them up when finished. + * Pre-condition: + * The request is an internal ESI subrequest. + * data context is not NULL + * There are no more entries in the stream chain. + */ +void +esiBufferRecipient (clientStreamNode *node, clientHttpRequest *http, HttpReply *rep, StoreIOBuffer recievedData) +{ + esiStreamContext *esiStream; + /* Test preconditions */ + assert (node != NULL); + /* ESI TODO: handle thisNode rather than asserting + * - it should only ever happen if we cause an + * abort and the callback chain loops back to + * here, so we can simply return. However, that + * itself shouldn't happen, so it stays as an + * assert for now. */ + assert (cbdataReferenceValid (node)); + assert (node->data != NULL); + assert (node->node.next == NULL); + assert (http->conn == NULL); + + esiStream = (esiStreamContext *)cbdataReference (node->data); + /* If segments become more flexible, ignore thisNode */ + assert (recievedData.length <= sizeof(esiStream->localbuffer->buf)); + assert (!esiStream->finished); + + debug (86,5) ("esiBufferRecipient rep %p body %p len %d\n", rep, recievedData.data, recievedData.length); + assert (node->readBuffer.offset == recievedData.offset || recievedData.length == 0); + + /* trivial case */ + + if (http->out.offset != 0) { + assert(rep == NULL); + } else { + if (rep) { + if (rep->sline.status != HTTP_OK) { + httpReplyDestroy(rep); + rep = NULL; + esiStream->include->fail (esiStream); + esiStream->finished = 1; + cbdataReferenceDone (esiStream); + httpRequestFree (http); + return; + } + +#if HEADERS_LOG + /* should be done in the store rather than every recipient? */ + headersLog(0, 0, http->request->method, rep); + +#endif + + httpReplyDestroy(rep); + + rep = NULL; + } + } + + if (recievedData.data && recievedData.length) { + http->out.offset += recievedData.length; + + if (recievedData.data >= esiStream->localbuffer->buf && + recievedData.data < &esiStream->localbuffer->buf[sizeof(esiStream->localbuffer->buf)]) { + /* original static buffer */ + + if (recievedData.data != esiStream->localbuffer->buf) { + /* But not the start of it */ + xmemmove (esiStream->localbuffer->buf, recievedData.data, recievedData.length); + } + + esiStream->localbuffer->len = recievedData.length; + } else { + assert (esiStream->buffer.getRaw() != NULL); + esiStream->buffer->len = recievedData.length; + } + } + + /* EOF / Read error / aborted entry */ + if (rep == NULL && recievedData.data == NULL && recievedData.length == 0) { + /* TODO: get stream status to test the entry for aborts */ + debug (86,5)("Finished reading upstream data in subrequest\n"); + esiStream->include->subRequestDone (esiStream, true); + esiStream->finished = 1; + cbdataReferenceDone (esiStream); + httpRequestFree (http); + return; + } + + + /* after the write to the user occurs, (ie here, or in a callback) + * we call */ + if (clientHttpRequestStatus(-1, http)) { + /* TODO: Does thisNode if block leak htto ? */ + esiStreamContext *temp = esiStream; + esiStream->include->fail (esiStream); + esiStream->finished = 1; + cbdataReferenceDone (esiStream); + cbdataFree (temp); /* free the request */ + return; + }; + + switch (clientStreamStatus (node, http)) { + + case STREAM_UNPLANNED_COMPLETE: /* fallthru ok */ + + case STREAM_COMPLETE: /* ok */ + debug (86,3)("ESI subrequest finished OK\n"); + esiStream->include->subRequestDone (esiStream, true); + esiStream->finished = 1; + cbdataReferenceDone (esiStream); + httpRequestFree (http); + return; + + case STREAM_FAILED: + debug (86,1)("ESI subrequest failed transfer\n"); + esiStream->include->fail (esiStream); + esiStream->finished = 1; + cbdataReferenceDone (esiStream); + httpRequestFree (http); + return; + + case STREAM_NONE: { + StoreIOBuffer tempBuffer; + + if (!esiStream->buffer.getRaw()) { + esiStream->buffer = esiStream->localbuffer; + } + + esiStream->buffer = esiStream->buffer->tail(); + + if (esiStream->buffer->len) { + esiStream->buffer->next = new ESISegment; + esiStream->buffer = esiStream->buffer->next; + } + + tempBuffer.offset = http->out.offset; + tempBuffer.length = sizeof (esiStream->buffer->buf); + tempBuffer.data = esiStream->buffer->buf; + /* now just read into 'buffer' */ + clientStreamRead (node, + http, tempBuffer); + debug (86,5)("esiBufferRecipient: Requested more data for ESI subrequest\n"); + } + + break; + + default: + fatal ("Hit unreachable code in esiBufferRecipient\n"); + } + + cbdataReferenceDone (esiStream); +} + +/* esiStream functions */ +void +esiStreamContextFree (void *data) +{ + esiStreamContext *esiStream = (esiStreamContext *)data; + assert (esiStream); + esiStream->buffer = NULL; + esiStream->localbuffer = NULL; + esiStream->include = NULL; + debug (86,5)("Freeing stream context\n"); +} + +void * +_esiStreamContext::operator new (size_t count) +{ + CBDATA_INIT_TYPE_FREECB(esiStreamContext, esiStreamContextFree); + return cbdataAlloc(esiStreamContext); +} + +esiStreamContext * +esiStreamContextNew (esiIncludePtr include) +{ + esiStreamContext *rv = new _esiStreamContext; + rv->include = include; + return rv; +} + +/* Implementation of ESIElements */ + +/* esiComment */ +esiComment::~esiComment() +{ + debug (86,5)("esiComment::~esiComment %p\n", this); +} + +void * +esiComment::operator new(size_t byteCount) +{ + assert (byteCount == sizeof (esiComment)); + + if (!pool) + pool = memPoolCreate ("esiComment", sizeof (esiComment)); + + return memPoolAlloc(pool); +} + +void +esiComment::operator delete (void *address) +{ + memPoolFree (pool, address); +} + +void +esiComment::deleteSelf() const +{ + delete this; +} + +esiComment::esiComment() +{} + +void +esiComment::finish() +{} + +void +esiComment::render(ESISegment::Pointer output) +{ + /* Comments do nothing dude */ + debug (86, 5)("esiCommentRender: Rendering comment %p into %p\n", this, output.getRaw()); +} + +ESIElement::Pointer +esiComment::makeCacheable() const +{ + debug (86, 5) ("esiComment::makeCacheable: returning NULL\n"); + return NULL; +} + +ESIElement::Pointer +esiComment::makeUsable(esiTreeParentPtr, esiVarState &) const +{ + fatal ("esiComment::Usable: unreachable code!\n"); + return NULL; +} + +/* esiLiteral */ +void * +esiLiteral::operator new(size_t byteCount) +{ + assert (byteCount == sizeof (esiLiteral)); + + if (!pool) + pool = memPoolCreate ("esiLiteral", sizeof (esiLiteral)); + + return memPoolAlloc (pool); +} + +void +esiLiteral::operator delete (void *address) +{ + memPoolFree (pool, address); +} + +void +esiLiteral::deleteSelf() const +{ + delete this; +} + +esiLiteral::~esiLiteral() +{ + debug (86, 5) ("esiLiteral::~esiLiteral: %p\n", this); + ESISegmentFreeList (buffer); + cbdataReferenceDone (varState); +} + +esiLiteral::esiLiteral(ESISegment::Pointer aSegment) +{ + buffer = aSegment; + /* we've been handed a complete, processed string */ + varState = NULL; + /* Nothing to do */ + flags.donevars = 1; +} + +void +esiLiteral::finish() +{} + +/* precondition: the buffer chain has at least start + length bytes of data + */ +esiLiteral::esiLiteral(ESIContext *context, const char *s, int numberOfCharacters) +{ + assert (s); + buffer = new ESISegment; + ESISegment::Pointer local = buffer; + off_t start = 0; + int remainingCharacters = numberOfCharacters; + + while (remainingCharacters > 0) { + if (local->len == sizeof (local->buf)) { + local->next = new ESISegment; + local=local->next; + } + + size_t len = local->append (&s[start], remainingCharacters); + start += len; + remainingCharacters -= len; + } + + varState = cbdataReference (context->varState); +} + +void +esiLiteral::render (ESISegment::Pointer output) +{ + debug (86,9)("esiLiteral::render: Rendering %p\n",this); + /* append the entire chain */ + assert (output->next.getRaw() == NULL); + output->next = buffer; + buffer = NULL; +} + +esiProcessResult_t +esiLiteral::process (int dovars) +{ + if (flags.donevars) + return ESI_PROCESS_COMPLETE; + + if (dovars) { + ESISegment::Pointer temp = buffer; + /* Ensure variable state is clean */ + + while (temp.getRaw()) { + varState->feedData(temp->buf,temp->len); + temp = temp->next; + } + + /* free the pre-processed content */ + ESISegmentFreeList (buffer); + + buffer = varState->extractList (); + } + + flags.donevars = 1; + return ESI_PROCESS_COMPLETE; +} + +esiLiteral::esiLiteral(esiLiteral const &old) : buffer (old.buffer->cloneList()), + varState (NULL) +{ + flags.donevars = 0; +} + +ESIElement::Pointer +esiLiteral::makeCacheable() const +{ + return new esiLiteral (*this); +} + +ESIElement::Pointer +esiLiteral::makeUsable(esiTreeParentPtr , esiVarState &newVarState) const +{ + debug (86,5)("esiLiteral::makeUsable: Creating usable literal\n"); + esiLiteral * result = new esiLiteral (*this); + result->varState = cbdataReference (&newVarState); + return result; +} + +/* esiInclude */ +esiInclude::~esiInclude() +{ + debug (86,5)("esiInclude::Free %p\n", this); + ESISegmentFreeList (srccontent); + ESISegmentFreeList (altcontent); + cbdataReferenceDone (varState); + safe_free (srcurl); + safe_free (alturl); +} + +void +esiInclude::finish() +{ + parent = NULL; +} + +void * +esiInclude::operator new(size_t byteCount) +{ + assert (byteCount == sizeof (esiInclude)); + + if (!Pool) + Pool = memPoolCreate ("esiInclude", sizeof (esiInclude)); + + return memPoolAlloc(Pool); +} + +void +esiInclude::operator delete (void *address) +{ + memPoolFree (Pool, address); +} + +void +esiInclude::deleteSelf() const +{ + delete this; +} + +ESIElement::Pointer +esiInclude::makeCacheable() const +{ + return new esiInclude (*this); +} + +ESIElement::Pointer +esiInclude::makeUsable(esiTreeParentPtr newParent, esiVarState &newVarState) const +{ + esiInclude *resultI = new esiInclude (*this); + ESIElement::Pointer result = resultI; + resultI->parent = newParent; + resultI->varState = cbdataReference (&newVarState); + + if (resultI->srcurl) + resultI->src = esiStreamContextNew (resultI); + + if (resultI->alturl) + resultI->alt = esiStreamContextNew (resultI); + + return result; +} + +esiInclude::esiInclude(esiInclude const &old) : parent (NULL), started (false), sent (false) +{ + varState = NULL; + flags.onerrorcontinue = old.flags.onerrorcontinue; + + if (old.srcurl) + srcurl = xstrdup (old.srcurl); + + if (old.alturl) + alturl = xstrdup (old.alturl); +} + +void +esiInclude::Start (esiStreamContext *stream, char const *url, esiVarState *vars) +{ + HttpHeader tempheaders; + + if (!stream) + return; + + httpHeaderInit (&tempheaders, hoRequest); + + /* Ensure variable state is clean */ + vars->feedData(url, strlen (url)); + + /* tempUrl is eaten by the request */ + char const *tempUrl = vars->extractChar (); + + debug (86,5)("esiIncludeStart: Starting subrequest with url '%s'\n", tempUrl); + + if (clientBeginRequest(METHOD_GET, tempUrl, esiBufferRecipient, esiBufferDetach, stream, &tempheaders, stream->localbuffer->buf, HTTP_REQBUF_SZ)) { + debug (86,0) ("starting new ESI subrequest failed\n"); + } + + httpHeaderClean (&tempheaders); +} + +esiInclude::esiInclude (esiTreeParentPtr aParent, int attrcount, char const **attr, ESIContext *aContext) : parent (aParent), started (false), sent (false) +{ + int i; + assert (aContext); + + for (i = 0; i < attrcount && attr[i]; i += 2) { + if (!strcmp(attr[i],"src")) { + /* Start a request for thisNode url */ + debug (86,5)("esiIncludeNew: Requesting source '%s'\n",attr[i+1]); + /* TODO: don't assert on thisNode, ignore the duplicate */ + assert (src == NULL); + src = esiStreamContextNew (this); + assert (src != NULL); + srcurl = xstrdup ( attr[i+1]); + } else if (!strcmp(attr[i],"alt")) { + /* Start a secondary request for thisNode url */ + /* TODO: make a config parameter to wait on requesting alt's + * for the src to fail + */ + debug (86,5)("esiIncludeNew: Requesting alternate '%s'\n",attr[i+1]); + assert (alt == NULL); /* TODO: FIXME */ + alt = esiStreamContextNew (this); + assert (alt != NULL); + alturl = xstrdup (attr[i+1]); + } else if (!strcmp(attr[i],"onerror")) { + if (!strcmp(attr[i+1], "continue")) { + flags.onerrorcontinue = 1; + } else { + /* ignore mistyped attributes */ + debug (86, 1)("invalid value for onerror='%s'\n", attr[i+1]); + } + } else { + /* ignore mistyped attributes. TODO:? error on these for user feedback - config parameter needed + */ + } + } + + varState = cbdataReference(aContext->varState); +} + +void +esiInclude::start() +{ + /* prevent freeing ourselves */ + esiIncludePtr foo(this); + + if (started) + return; + + started = true; + + if (src) { + Start (src, srcurl, varState); + Start (alt, alturl, varState); + } else { + if (alt) + cbdataFree (alt); + + debug (86,1)("esiIncludeNew: esi:include with no src attributes\n"); + + flags.failed = 1; + } +} + +void +esiInclude::render(ESISegment::Pointer output) +{ + if (sent) + return; + + ESISegment::Pointer myout; + + debug (86, 5)("esiIncludeRender: Rendering include %p\n", this); + + assert (flags.finished || (flags.failed && flags.onerrorcontinue)); + + if (flags.failed && flags.onerrorcontinue) { + return; + } + + /* Render the content */ + if (srccontent.getRaw()) { + myout = srccontent; + srccontent = NULL; + } else if (altcontent.getRaw()) { + myout = altcontent; + altcontent = NULL; + } else + fatal ("esiIncludeRender called with no content, and no failure!\n"); + + assert (output->next == NULL); + + output->next = myout; + + sent = true; +} + +esiProcessResult_t +esiInclude::process (int dovars) +{ + start(); + debug (86, 5)("esiIncludeRender: Processing include %p\n", this); + + if (flags.failed) { + if (flags.onerrorcontinue) + return ESI_PROCESS_COMPLETE; + else + return ESI_PROCESS_FAILED; + } + + if (!flags.finished) { + if (flags.onerrorcontinue) + return ESI_PROCESS_PENDING_WONTFAIL; + else + return ESI_PROCESS_PENDING_MAYFAIL; + } + + return ESI_PROCESS_COMPLETE; +} + +void +esiInclude::fail (esiStreamContext *stream) +{ + subRequestDone (stream, false); +} + +bool +esiInclude::dataNeeded() const +{ + return !(flags.finished || flags.failed); +} + +void +esiInclude::subRequestDone (esiStreamContext *stream, bool success) +{ + assert (this); + + if (!dataNeeded()) + return; + + if (stream == src) { + debug (86,3)("esiInclude::subRequestDone: %s\n", srcurl); + + if (success) { + /* copy the lead segment */ + debug (86,3)("esiIncludeSubRequestDone: Src OK - include PASSED.\n"); + assert (!srccontent.getRaw()); + ESISegment::ListTransfer (stream->localbuffer, srccontent); + /* we're done! */ + flags.finished = 1; + } else { + /* Fail if there is no alt being retrieved */ + debug (86,3)("esiIncludeSubRequestDone: Src FAILED\n"); + + if (!(alt || altcontent.getRaw())) { + debug (86,3)("esiIncludeSubRequestDone: Include FAILED - No ALT\n"); + flags.failed = 1; + } else if (altcontent.getRaw()) { + debug (86,3)("esiIncludeSubRequestDone: Include PASSED - ALT already Complete\n"); + /* ALT was already retrieved, we are done */ + flags.finished = 1; + } + } + + src = NULL; + } else if (stream == alt) { + debug (86,3)("esiInclude::subRequestDone: %s\n", alturl); + + if (success) { + debug (86,3)("esiIncludeSubRequestDone: ALT OK.\n"); + /* copy the lead segment */ + assert (!altcontent.getRaw()); + ESISegment::ListTransfer (stream->localbuffer, altcontent); + /* we're done! */ + + if (!(src || srccontent.getRaw())) { + /* src already failed, kick ESI processor */ + debug (86,3)("esiIncludeSubRequestDone: Include PASSED - SRC already failed.\n"); + flags.finished = 1; + } + } else { + if (!(src || srccontent.getRaw())) { + debug (86,3)("esiIncludeSubRequestDone: ALT FAILED, Include FAILED - SRC already failed\n"); + /* src already failed */ + flags.failed = 1; + } + } + + alt = NULL; + } else { + fatal ("esiIncludeSubRequestDone: non-owned stream found!\n"); + } + + if (flags.finished || flags.failed) { + /* Kick ESI Processor */ + debug (86,5)("esiInclude %p SubRequest %p completed, kicking processor , status %s\n", this, stream, flags.finished ? "OK" : "FAILED"); + assert (parent.getRaw()); + + if (!flags.failed) { + sent = true; + parent->provideData (srccontent.getRaw() ? srccontent:altcontent,this); + + if (srccontent.getRaw()) + srccontent = NULL; + else + altcontent = NULL; + } else if (flags.onerrorcontinue) { + /* render nothing but inform of completion */ + + if (!sent) { + sent = true; + parent->provideData (new ESISegment, this); + } else + assert (0); + } else + parent->fail(this); + } +} + +/* esiRemove */ +void +esiRemoveFree (void *data) +{ + esiRemove *thisNode = (esiRemove *)data; + debug (86,5)("esiRemoveFree %p\n", thisNode); +} + +void * +esiRemove::operator new(size_t byteCount) +{ + assert (byteCount == sizeof (esiRemove)); + void *rv; + CBDATA_INIT_TYPE_FREECB(esiRemove, esiRemoveFree); + rv = (void *)cbdataAlloc (esiRemove); + return rv; +} + +void +esiRemove::operator delete (void *address) +{ + cbdataFree ((esiRemove *)address); +} + +void +esiRemove::deleteSelf() const +{ + delete this; +} + +ESIElement * +esiRemoveNew () +{ + return new esiRemove; +} + +esiRemove::esiRemove() +{} + +void +esiRemove::finish() +{} + +void +esiRemove::render(ESISegment::Pointer output) +{ + /* Removes do nothing dude */ + debug (86, 5)("esiRemoveRender: Rendering remove %p\n", this); +} + +/* Accept non-ESI children */ +bool +esiRemove::addElement (ESIElement::Pointer element) +{ + if (!dynamic_cast(element.getRaw())) { + debug (86,5)("esiRemoveAdd: Failed for %p\n",this); + return false; + } + + return true; +} + +ESIElement::Pointer +esiRemove::makeCacheable() const +{ + debug (86,5)("esiRemove::makeCacheable: Returning NULL\n"); + return NULL; +} + +ESIElement::Pointer +esiRemove::makeUsable(esiTreeParentPtr, esiVarState &) const +{ + fatal ("esiRemove::Usable: unreachable code!\n"); + return NULL; +} + +/* esiTry */ +esiTry::~esiTry() +{ + debug (86,5)("esiTry::~esiTry %p\n", this); +} + +void * +esiTry::operator new(size_t byteCount) +{ + assert (byteCount == sizeof (esiTry)); + + if (!Pool) + Pool = memPoolCreate ("esiTry", sizeof(esiTry)); + + return memPoolAlloc (Pool); +} + +void +esiTry::operator delete (void *address) +{ + memPoolFree (Pool, address); +} + +void +esiTry::deleteSelf() const +{ + delete this; +} + +esiTry::esiTry(esiTreeParentPtr aParent) : parent (aParent) , exceptbuffer(NULL) +{} + +void +esiTry::render (ESISegment::Pointer output) +{ + /* Try renders from it's children */ + assert (this); + assert (attempt.getRaw()); + assert (except.getRaw()); + debug (86, 5)("esiTryRender: Rendering Try %p\n", this); + + if (flags.attemptok) { + attempt->render(output); + } else if (flags.exceptok) { + /* prerendered */ + + if (exceptbuffer.getRaw()) + ESISegment::ListTransfer(exceptbuffer, output); + else + except->render(output); + } else + debug (86,5)("esiTryRender: Neither except nor attempt succeeded?!?\n"); +} + +/* Accept attempt and except only */ +bool +esiTry::addElement(ESIElement::Pointer element) +{ + debug (86,5)("esiTryAdd: Try %p adding element %p\n",this, element.getRaw()); + + if (dynamic_cast(element.getRaw())) { + /* Swallow whitespace */ + debug (86,5)("esiTryAdd: Try %p skipping whitespace %p\n",this, element.getRaw()); + return true; + } + + if (dynamic_cast(element.getRaw())) { + if (attempt.getRaw()) { + debug (86,1)("esiTryAdd: Failed for %p - try allready has an attempt node (section 3.4)\n",this); + return false; + } + + attempt = element; + return true; + } + + if (dynamic_cast(element.getRaw())) { + if (except.getRaw()) { + debug (86,1)("esiTryAdd: Failed for %p - try already has an except node (section 3.4)\n",this); + return false; + } + + except = element; + return true; + } + + debug (86,1)("esiTryAdd: Failed to add element %p to try %p, incorrect element type (see section 3.4)\n", element.getRaw(), this); + return false; +} + +esiProcessResult_t +esiTry::bestAttemptRV() const +{ + if (flags.attemptfailed) + return ESI_PROCESS_COMPLETE; + else + return ESI_PROCESS_PENDING_MAYFAIL; +} + +esiProcessResult_t +esiTry::process (int dovars) +{ + esiProcessResult_t rv = ESI_PROCESS_PENDING_MAYFAIL; + assert (this); + + if (!attempt.getRaw()) { + debug (86,0)("esiTryProcess: Try has no attempt element - ESI template is invalid (section 3.4)\n"); + return ESI_PROCESS_FAILED; + } + + if (!except.getRaw()) { + debug (86,0)("esiTryProcess: Try has no except element - ESI template is invalid (section 3.4)\n"); + return ESI_PROCESS_FAILED; + } + + if (!flags.attemptfailed) + /* Try the attempt branch */ + switch ((rv = attempt->process(dovars))) { + + case ESI_PROCESS_COMPLETE: + debug (86,5)("esiTryProcess: attempt Processed OK\n"); + flags.attemptok = 1; + return ESI_PROCESS_COMPLETE; + + case ESI_PROCESS_PENDING_WONTFAIL: + debug (86,5)("esiTryProcess: attempt Processed PENDING OK\n"); + /* We're not done yet, but don't need to test except */ + return ESI_PROCESS_PENDING_WONTFAIL; + + case ESI_PROCESS_PENDING_MAYFAIL: + debug (86,5)("eseSequenceProcess: element Processed PENDING UNKNOWN\n"); + break; + + case ESI_PROCESS_FAILED: + debug (86,5)("esiSequenceProcess: element Processed FAILED\n"); + flags.attemptfailed = 1; + break; + } + + /* attempt is either MAYFAIL or FAILED */ + if (flags.exceptok) + return bestAttemptRV(); + + /* query except to see if it has a definite result */ + if (!flags.exceptfailed) + /* Try the except branch */ + switch (except->process(dovars)) { + + case ESI_PROCESS_COMPLETE: + debug (86,5)("esiTryProcess: except Processed OK\n"); + flags.exceptok = 1; + return bestAttemptRV(); + + case ESI_PROCESS_PENDING_WONTFAIL: + debug (86,5)("esiTryProcess: attempt Processed PENDING OK\n"); + /* We're not done yet, but can't fail */ + return ESI_PROCESS_PENDING_WONTFAIL; + + case ESI_PROCESS_PENDING_MAYFAIL: + debug (86,5)("eseSequenceProcess: element Processed PENDING UNKNOWN\n"); + /* The except branch fail fail */ + return ESI_PROCESS_PENDING_MAYFAIL; + + case ESI_PROCESS_FAILED: + debug (86,5)("esiSequenceProcess: element Processed FAILED\n"); + flags.exceptfailed = 1; + break; + } + + if (flags.exceptfailed && flags.attemptfailed) + return ESI_PROCESS_FAILED; + + /* one of attempt or except returned PENDING MAYFAIL */ + return ESI_PROCESS_PENDING_MAYFAIL; +} + +void +esiTry::notifyParent() +{ + if (flags.attemptfailed) { + if (flags.exceptok) { + parent->provideData (exceptbuffer, this); + exceptbuffer = NULL; + } else if (flags.exceptfailed || except.getRaw() == NULL) { + parent->fail (this); + } + } + + /* nothing to do when except fails and attempt hasn't */ +} + +void +esiTry::fail(ESIElement *source) +{ + assert (source); + assert (source == attempt || source == except); + debug (86,5) ("esiTry::fail: this=%p, source=%p\n", this, source); + + if (source == except) { + flags.exceptfailed = 1; + } else { + flags.attemptfailed = 1; + } + + notifyParent(); +} + +void +esiTry::provideData (ESISegment::Pointer data, ESIElement* source) +{ + if (source == attempt) { + flags.attemptok = 1; + parent->provideData (data, this); + } else if (source == except) { + flags.exceptok = 1; + assert (exceptbuffer == NULL); + ESISegment::ListTransfer (data, exceptbuffer); + notifyParent(); + } +} + +esiTry::esiTry(esiTry const &old) +{ + attempt = NULL; + except = NULL; + flags.attemptok = 0; + flags.exceptok = 0; + flags.attemptfailed = 0; + flags.exceptfailed = 0; + parent = NULL; + exceptbuffer = NULL; +} + +ESIElement::Pointer +esiTry::makeCacheable() const +{ + debug (86,5)("esiTry::makeCacheable: making cachable Try from %p\n",this); + esiTry *resultT = new esiTry (*this); + ESIElement::Pointer result = resultT; + + if (attempt.getRaw()) + resultT->attempt = attempt->makeCacheable(); + + if (except.getRaw()) + resultT->except = except->makeCacheable(); + + return result; +} + +ESIElement::Pointer +esiTry::makeUsable(esiTreeParentPtr newParent, esiVarState &newVarState) const +{ + debug (86,5)("esiTry::makeUsable: making usable Try from %p\n",this); + esiTry *resultT = new esiTry (*this); + ESIElement::Pointer result = resultT; + + resultT->parent = newParent; + + if (attempt.getRaw()) + resultT->attempt = attempt->makeUsable(resultT, newVarState); + + if (except.getRaw()) + resultT->except = except->makeUsable(resultT, newVarState); + + return result; +} + +void +esiTry::finish() +{ + parent = NULL; + + if (attempt.getRaw()) + attempt->finish(); + + attempt = NULL; + + if (except.getRaw()) + except->finish(); + + except = NULL; +} + +/* esiAttempt */ +#if 0 +void * +esiAttempt::operator new(size_t byteCount) +{ + assert (byteCount == sizeof (esiAttempt)); + +} + +void +esiAttempt::operator delete (void *address) +{ + cbdataFree ((esiAttempt *)address); +} + +#endif +void +esiAttempt::deleteSelf() const +{ + delete this; +} + +/* esiExcept */ +#if 0 +void * +esiExcept::operator new(size_t byteCount) +{ + assert (byteCount == sizeof (esiExcept)); + void *rv; + CBDATA_INIT_TYPE_FREECB(esiExcept, esiSequence::Free); + rv = (void *)cbdataAlloc (esiExcept); + return rv; +} + +void +esiExcept::operator delete (void *address) +{ + cbdataFree ((esiExcept *)address); +} + +#endif +void +esiExcept::deleteSelf() const +{ + delete this; +} + +/* esiVar */ +#if 0 +void * +esiVar::operator new(size_t byteCount) +{ + assert (byteCount == sizeof (esiVar)); + void *rv; + CBDATA_INIT_TYPE_FREECB(esiVar, esiSequence::Free); + rv = (void *)cbdataAlloc (esiVar); + return rv; +} + +void +esiVar::operator delete (void *address) +{ + cbdataFree ((esiVar *)address); +} + +#endif + +void +esiVar::deleteSelf() const +{ + delete this; +} + +/* esiVarState */ +void +esiVarStateFree (void *data) +{ + esiVarState *thisNode = (esiVarState*)data; + thisNode->freeResources(); +} + +void +esiVarState::freeResources() +{ + input = NULL; + ESISegmentFreeList (output); + httpHeaderClean (&hdr); + + if (query) { + unsigned int i; + + for (i = 0; i < query_elements; ++i) { + safe_free(query[i].var); + safe_free(query[i].val); + } + + memFreeBuf (query_sz, query); + } + + safe_free (query_string); + safe_free (browserversion); +} + +void * +esiVarState::operator new(size_t byteCount) +{ + assert (byteCount == sizeof (esiVarState)); + void *rv; + CBDATA_INIT_TYPE_FREECB(esiVarState, esiVarStateFree); + rv = (void *)cbdataAlloc (esiVarState); + return rv; +} + +void +esiVarState::operator delete (void *address) +{ + cbdataFree ((esiVarState *)address); +} + +void +esiVarState::deleteSelf() const +{ + delete this; +} + +char * +esiVarState::getProductVersion (char const *s) +{ + char const *t; + int len; + t = index (s,'/'); + + if (!t || !*(++t)) + return xstrdup (""); + + len = strcspn (t, " \r\n()<>@,;:\\\"/[]?={}"); + + return xstrndup (t, len); +} + +esiVarState::esiVarState (HttpHeader const *aHeader, char const *uri) + : output (NULL) +{ + /* Fill out variable values */ + /* Count off the query elements */ + char const *query_start = strchr (uri, '?'); + + if (query_start && query_start[1] != '\0' ) { + unsigned int n; + query_string = xstrdup (query_start + 1); + query_elements = 1; + char const *query_pos = query_start + 1; + + while ((query_pos = strchr (query_pos, '&'))) { + ++query_elements; + ++query_pos; + } + + query = (_query_elem *)memReallocBuf(query, query_elements * sizeof (struct _query_elem), + &query_sz); + query_pos = query_start + 1; + n = 0; + + while (query_pos) { + char *next = strchr (query_pos, '&'); + char *div = strchr (query_pos, '='); + + if (next) + ++next; + + assert (n < query_elements); + + if (!div) + div = next; + + if (!(div - query_pos + 1)) + /* zero length between & and = or & and & */ + continue; + + query[n].var = xstrndup (query_pos, div - query_pos + 1) ; + + if (div == next) { + query[n].val = xstrdup (""); + } else { + query[n].val = xstrndup (div + 1, next - div - 1); + } + + query_pos = next; + ++n; + } + } else { + query_string = xstrdup (""); + } + + if (query) { + unsigned int n = 0; + debug (86,6)("esiVarStateNew: Parsed Query string: '%s'\n",uri); + + while (n < query_elements) { + debug (86,6)("esiVarStateNew: Parsed Query element %d '%s'='%s'\n",n + 1, query[n].var, query[n].val); + ++n; + } + } + + /* Now setup the UserAgent values */ + /* An example: + * User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705) */ + /* Grr thisNode is painful - RFC 2616 specifies that 'by convention' the tokens are in order of importance + * in identifying the product. According to the RFC the above should be interpreted as: + * Product - Mozilla version 4.0 + * in comments - compatible; .... 3705 + * + * Useing the RFC a more appropriate header would be + * User-Agent: MSIE/6.0 Mozilla/4.0 Windows-NT/5.1 .NET-CLR/1.0.3705 + * or something similar. + * + * Because we can't parse under those rules and get real-world useful answers, we follow the following + * algorithm: + * if the string Windows appears in the header, the OS is WIN. + * If the string Mac appears in the header, the OS is MAC. + * If the string nix, or BSD appears in the header, the OS is UNIX. + * If the string MSIE appears in the header, the BROWSER is MSIE, and the version is the string from + * MSIE to the first ;, or end of string. + * If the String MSIE does not appear in the header, and MOZILLA does, we use the version from the + * /version field. + * if MOZILLA doesn't appear, the browser is set to OTHER. + * In future, thisNode may be better implemented as a regexp. + */ + /* TODO: only grab the needed headers */ + httpHeaderInit (&hdr, hoReply); + + httpHeaderAppend (&hdr, aHeader); + + if (httpHeaderHas(&hdr, HDR_USER_AGENT)) { + char const *s = httpHeaderGetStr (&hdr, HDR_USER_AGENT); + char const *t, *t1; + + if (strstr (s, "Windows")) + UserOs = ESI_OS_WIN; + else if (strstr (s, "Mac")) + UserOs = ESI_OS_MAC; + else if (strstr (s, "nix") || strstr (s, "BSD")) + UserOs = ESI_OS_UNIX; + else + UserOs = ESI_OS_OTHER; + + /* Now the browser and version */ + if ((t = strstr (s, "MSIE"))) { + browser = ESI_BROWSER_MSIE; + t = index (t, ' '); + + if (!t) + browserversion = xstrdup (""); + else { + t1 = index (t, ';'); + + if (!t1) + browserversion = xstrdup (t + 1); + else + browserversion = xstrndup (t + 1, t1-t); + } + } else if (strstr (s, "Mozilla")) { + browser = ESI_BROWSER_MOZILLA; + browserversion = getProductVersion(s); + } else { + browser = ESI_BROWSER_OTHER; + browserversion = getProductVersion(s); + } + } else { + UserOs = ESI_OS_OTHER; + browser = ESI_BROWSER_OTHER; + browserversion = xstrdup (""); + } +} + +void +esiVarState::feedData (const char *buf, size_t len) +{ + /* TODO: if needed - tune to skip segment iteration */ + debug (86,6)("esiVarState::feedData: accepting %d bytes\n", len); + ESISegment::ListAppend (input, buf, len); +} + +ESISegment::Pointer +esiVarState::extractList() +{ + doIt(); + ESISegment::Pointer rv = output; + output = NULL; + debug (86,6)("esiVarStateExtractList: Extracted list\n"); + return rv; +} + +char * +esiVarState::extractChar () +{ + if (!input.getRaw()) + fatal ("Attempt to extract variable state with no data fed in \n"); + + doIt(); + + char *rv = output->listToChar(); + + ESISegmentFreeList (output); + + debug (86,6)("esiVarStateExtractList: Extracted char\n"); + + return rv; +} + +int +httpHeaderHasListMember(const HttpHeader * hdr, http_hdr_type id, const char *member, const char separator); + +int +httpHeaderHasListMember(const HttpHeader * hdr, http_hdr_type id, const char *member, const char separator) +{ + int result = 0; + const char *pos = NULL; + const char *item; + int ilen; + int mlen = strlen(member); + + assert(hdr); + assert(id >= 0); + + String header (httpHeaderGetStrOrList(hdr, id)); + + while (strListGetItem(&header, separator, &item, &ilen, &pos)) { + if (strncmp(item, member, mlen) == 0 + && (item[mlen] == '=' || item[mlen] == separator || item[mlen] == ';' || item[mlen] == '\0')) { + result = 1; + break; + } + } + + return result; +} + +void +esiVarState::eval (esiVar_t type, char const *subref, char const *found_default ) +{ + const char *s = NULL; + + if (!found_default) + found_default = ""; + + switch (type) { + + case ESI_VAR_HOST: + flags.host = 1; + + if (!subref && httpHeaderHas(&hdr,HDR_HOST)) { + s = httpHeaderGetStr (&hdr, HDR_HOST); + } else + s = found_default; + + ESISegment::ListAppend (output, s, strlen (s)); + + break; + + case ESI_VAR_COOKIE: + flags.cookie = 1; + + if (httpHeaderHas(&hdr, HDR_COOKIE)) { + if (!subref) + s = httpHeaderGetStr (&hdr, HDR_COOKIE); + else { + String S = httpHeaderGetListMember (&hdr, HDR_COOKIE, subref, ';'); + + if (S.size()) + ESISegment::ListAppend (output, S.buf(), S.size()); + else if (found_default) + ESISegment::ListAppend (output, found_default, strlen (found_default)); + } + } else + s = found_default; + + if (s) + ESISegment::ListAppend (output, s, strlen (s)); + + break; + + case ESI_VAR_REFERER: + flags.referer = 1; + + if (!subref && httpHeaderHas(&hdr, HDR_REFERER)) + s = httpHeaderGetStr (&hdr, HDR_REFERER); + else + s = found_default; + + ESISegment::ListAppend (output, s, strlen (s)); + + break; + + case ESI_QUERY_STRING: + if (!subref) + s = query_string; + else { + unsigned int i = 0; + + while (i < query_elements && !s) { + if (!strcmp (subref, query[i].var)) + s = query[i].val; + + ++i; + } + + if (!s) + s = found_default; + } + + ESISegment::ListAppend (output, s, strlen (s)); + break; + + case ESI_VAR_USERAGENT: + flags.useragent = 1; + + if (httpHeaderHas(&hdr, HDR_USER_AGENT)) { + if (!subref) + s = httpHeaderGetStr (&hdr, HDR_USER_AGENT); + else { + if (!strcmp (subref, "os")) { + s = esiUserOs[UserOs]; + } else if (!strcmp (subref, "browser")) { + s = esiBrowsers[browser]; + } else if (!strcmp (subref, "version")) { + s = browserversion; + } else + s = ""; + } + } else + s = found_default; + + ESISegment::ListAppend (output, s, strlen (s)); + + break; + + case ESI_VAR_LANGUAGE: + flags.language = 1; + + if (httpHeaderHas(&hdr, HDR_ACCEPT_LANGUAGE)) { + if (!subref) { + String S (httpHeaderGetList (&hdr, HDR_ACCEPT_LANGUAGE)); + ESISegment::ListAppend (output, S.buf(), S.size()); + } else { + if (httpHeaderHasListMember (&hdr, HDR_ACCEPT_LANGUAGE, subref, ',')) { + s = "true"; + } else { + s = "false"; + } + + ESISegment::ListAppend (output, s, strlen (s)); + } + } else { + s = found_default; + ESISegment::ListAppend (output, s, strlen (s)); + } + + break; + + case ESI_VAR_OTHER: + /* No-op. We swallow it */ + + if (found_default) { + ESISegment::ListAppend (output, found_default, strlen (found_default)); + } + + break; + } +} + +bool +esiVarState::validChar (char c) +{ + if (('A' <= c && c <= 'Z') || + ('a' <= c && c <= 'z') || + '_' == c || '-' == c) + return true; + + return false; +} + +esiVarState::esiVar_t +esiVarState::GetVar(char *s, int len) +{ + assert (s); + + if (len == 9) { + if (!strncmp (s, "HTTP_HOST", 9)) + return ESI_VAR_HOST; + else + return ESI_VAR_OTHER; + } + + if (len == 11) { + if (!strncmp (s, "HTTP_COOKIE", 11)) + return ESI_VAR_COOKIE; + else + return ESI_VAR_OTHER; + } + + if (len == 12) { + if (!strncmp (s, "HTTP_REFERER", 12)) + return ESI_VAR_REFERER; + else if (!strncmp (s, "QUERY_STRING", 12)) + return ESI_QUERY_STRING; + else + return ESI_VAR_OTHER; + } + + if (len == 15) { + if (!strncmp (s, "HTTP_USER_AGENT", 15)) + return ESI_VAR_USERAGENT; + else + return ESI_VAR_OTHER; + } + + if (len == 20) { + if (!strncmp (s, "HTTP_ACCEPT_LANGUAGE", 20)) + return ESI_VAR_LANGUAGE; + else + return ESI_VAR_OTHER; + } + + return ESI_VAR_OTHER; +} + +/* because we are only used to process: + * - include URL's + * - non-esi elements + * - choose clauses + * buffering is ok - we won't delay the start of async activity, or + * of output data preparation + */ +void +esiVarState::doIt () +{ + assert (output == NULL); + int state = 0; + char *string = input->listToChar(); + size_t len = strlen (string); + size_t pos = 0; + size_t var_pos = 0; + size_t done_pos = 0; + char * found_subref = NULL; + char *found_default = NULL; + esiVar_t vartype = ESI_VAR_OTHER; + ESISegmentFreeList (input); + + while (pos < len) { + switch (state) { + + case 0: /* skipping pre-variables */ + + if (string[pos] != '$') { + ++pos; + } else { + if (pos - done_pos) + /* extract known good text */ + ESISegment::ListAppend (output, string + done_pos, pos - done_pos); + + done_pos = pos; + + state = 1; + + ++pos; + } + + break; + + case 1:/* looking for ( */ + + if (string[pos] != '(') { + state = 0; + } else { + state = 2; /* extract a variable name */ + var_pos = ++pos; + } + + break; + + case 2: /* looking for variable name */ + + if (!validChar(string[pos])) { + /* not a variable name char */ + + if (pos - var_pos) + vartype = GetVar (string + var_pos, pos - var_pos); + + state = 3; + } else { + ++pos; + } + + break; + + case 3: /* looking for variable subref, end bracket or default indicator */ + + if (string[pos] == ')') { + /* end of string */ + eval(vartype, found_subref, found_default); + done_pos = ++pos; + safe_free(found_subref); + safe_free(found_default); + state = 0; + } else if (!found_subref && !found_default && string[pos] == '{') { + debug (86,6)("esiVarStateDoIt: Subref of some sort\n"); + /* subreference of some sort */ + /* look for the entry name */ + var_pos = ++pos; + state = 4; + } else if (!found_default && string[pos] == '|') { + debug (86,6)("esiVarStateDoIt: Default present\n"); + /* extract default value */ + state = 5; + var_pos = ++pos; + } else { + /* unexpected char, not a variable after all */ + debug (86,6)("esiVarStateDoIt: unexpected char after varname\n"); + state = 0; + pos = done_pos + 2; + } + + break; + + case 4: /* looking for variable subref */ + + if (string[pos] == '}') { + /* end of subref */ + found_subref = xstrndup (&string[var_pos], pos - var_pos + 1); + debug (86,6)("esiVarStateDoIt: found end of variable subref '%s'\n", found_subref); + state = 3; + ++pos; + } else if (!validChar (string[pos])) { + debug (86,6)("esiVarStateDoIt: found invalid char in variable subref\n"); + /* not a valid subref */ + safe_free(found_subref); + state = 0; + pos = done_pos + 2; + } else { + ++pos; + } + + break; + + case 5: /* looking for a default value */ + + if (string[pos] == '\'') { + /* begins with a quote */ + debug (86,6)("esiVarStateDoIt: found quoted default\n"); + state = 6; + var_pos = ++pos; + } else { + /* doesn't */ + debug (86,6)("esiVarStateDoIt: found unquoted default\n"); + state = 7; + ++pos; + } + + break; + + case 6: /* looking for a quote terminate default value */ + + if (string[pos] == '\'') { + /* end of default */ + found_default = xstrndup (&string[var_pos], pos - var_pos + 1); + debug (86,6)("esiVarStateDoIt: found end of quoted default '%s'\n", found_default); + state = 3; + } + + ++pos; + break; + + case 7: /* looking for } terminate default value */ + + if (string[pos] == ')') { + /* end of default - end of variable*/ + found_default = xstrndup (&string[var_pos], pos - var_pos + 1); + debug (86,6)("esiVarStateDoIt: found end of variable (w/ unquoted default) '%s'\n",found_default); + eval(vartype,found_subref, found_default); + done_pos = ++pos; + safe_free(found_default); + safe_free(found_subref); + state = 0; + } + + ++pos; + break; + + default: + fatal("esiVarStateDoIt: unexpected state\n"); + } + } + + /* pos-done_pos chars are ready to copy */ + if (pos-done_pos) + ESISegment::ListAppend (output, string+done_pos, pos - done_pos); + + safe_free (found_default); + + safe_free (found_subref); +} + +/* XXX FIXME: this should be comma delimited, no? */ +void +esiVarState::buildVary (HttpReply *rep) +{ + char tempstr[1024]; + tempstr[0]='\0'; + + if (flags.language) + strcat (tempstr, "Accept-Language "); + + if (flags.cookie) + strcat (tempstr, "Cookie "); + + if (flags.host) + strcat (tempstr, "Host "); + + if (flags.referer) + strcat (tempstr, "Referer "); + + if (flags.useragent) + strcat (tempstr, "User-Agent "); + + if (!tempstr[0]) + return; + + String strVary (httpHeaderGetList (&rep->header, HDR_VARY)); + + if (!strVary.size() || strVary.buf()[0] != '*') { + httpHeaderPutStr (&rep->header, HDR_VARY, tempstr); + } +} + +/* esiChoose */ +esiChoose::~esiChoose() +{ + debug (86,5)("esiChoose::~esiChoose %p\n", this); +} + +void * +esiChoose::operator new(size_t byteCount) +{ + assert (byteCount == sizeof (esiChoose)); + + if (!Pool) + Pool = memPoolCreate ("esiChoose", sizeof(esiChoose)); + + return memPoolAlloc (Pool); +} + +void +esiChoose::operator delete (void *address) +{ + memPoolFree (Pool, address); +} + +void +esiChoose::deleteSelf() const +{ + delete this; +} + +esiChoose::esiChoose(esiTreeParentPtr aParent) : elements (), chosenelement (-1),parent (aParent) +{} + +void +esiChoose::render(ESISegment::Pointer output) +{ + /* append all processed elements, and trim processed and rendered elements */ + assert (output->next == NULL); + assert (elements.size() || otherwise.getRaw()); + debug (86,5)("esiChooseRender: rendering\n"); + + if (chosenelement >= 0) + elements[chosenelement]->render(output); + else if (otherwise.getRaw()) + otherwise->render(output); +} + +bool +esiChoose::addElement(ESIElement::Pointer element) +{ + /* add an element to the output list */ + + if (dynamic_cast(element.getRaw())) { + /* Swallow whitespace */ + debug (86,5)("esiChooseAdd: Choose %p skipping whitespace %p\n",this, element.getRaw()); + return true; + } + + /* Some elements require specific parents */ + if (!(dynamic_cast(element.getRaw()) || dynamic_cast(element.getRaw()))) { + debug (86,0)("esiChooseAdd: invalid child node for esi:choose (section 3.3)\n"); + return false; + } + + if (dynamic_cast(element.getRaw())) { + if (otherwise.getRaw()) { + debug (86,0)("esiChooseAdd: only one otherwise node allowed for esi:choose (section 3.3)\n"); + return false; + } + + otherwise = element; + } else { + elements.push_back (element); + + debug (86,3)("esiChooseAdd: Added a new element, elements = %d\n", elements.size()); + + if (chosenelement == -1) + if ((dynamic_cast(element.getRaw()))-> + testsTrue()) { + chosenelement = elements.size() - 1; + debug (86,3)("esiChooseAdd: Chose element %d\n", elements.size()); + } + } + + return true; +} + +void +esiChoose::selectElement() +{ + if (chosenelement > -1) + return; + + for (size_t counter = 0; counter < elements.size(); ++counter) { + if ((dynamic_cast(elements[counter].getRaw()))-> + testsTrue()) { + chosenelement = counter; + debug (86,3)("esiChooseAdd: Chose element %d\n", counter + 1); + return; + } + } +} + +void +esiChoose::finish() +{ + elements.setNULL(0, elements.size()); + + if (otherwise.getRaw()) + otherwise->finish(); + + otherwise = NULL; + + parent = NULL; +} + +void +ElementList::setNULL (int start, int end) +{ + assert (start >= 0 && start <= elementcount); + assert (end >= 0 && end <= elementcount); + + for (int loopPosition = start; loopPosition < end; ++loopPosition) { + if (elements[loopPosition].getRaw()) + elements[loopPosition]->finish(); + + debug (86,5)("esiSequence::NULLElements: Setting index %d, pointer %p to NULL\n", loopPosition, elements[loopPosition].getRaw()); + + elements[loopPosition] = NULL; + } +} + +void +esiChoose::NULLUnChosen() +{ + if (chosenelement >= 0) { + if (otherwise.getRaw()) + otherwise->finish(); + + otherwise = NULL; + + elements.setNULL (0, chosenelement); + + elements.setNULL (chosenelement + 1, elements.size()); + } else if (otherwise.getRaw()) { + elements.setNULL (0, elements.size()); + } +} + +esiProcessResult_t +esiChoose::process (int dovars) +{ + /* process as much of the list as we can, stopping only on + * faliures + */ + /* We MUST have a when clause */ + NULLUnChosen(); + + if (!elements.size()) { + parent->fail(this); + + if (otherwise.getRaw()) + otherwise->finish(); + + otherwise = NULL; + + parent = NULL; + + return ESI_PROCESS_FAILED; + } + + if (chosenelement >= 0) { + return elements[chosenelement]->process(dovars); + } else if (otherwise.getRaw()) + return otherwise->process(dovars); + else + return ESI_PROCESS_COMPLETE; +} + +void +esiChoose::checkValidSource (ESIElement::Pointer source) const +{ + if (!elements.size()) + fatal ("invalid callback = no when clause\n"); + + if (chosenelement >= 0) + assert (source == elements[chosenelement]); + else if (otherwise.getRaw()) + assert (source == otherwise); + else + fatal ("esiChoose::checkValidSource: invalid callback - no elements chosen\n"); +} + +void +esiChoose::fail(ESIElement * source) +{ + checkValidSource (source); + elements.setNULL (0, elements.size()); + + if (otherwise.getRaw()) + otherwise->finish(); + + otherwise = NULL; + + parent->fail(this); + + parent = NULL; +} + +void +esiChoose::provideData (ESISegment::Pointer data, ESIElement*source) +{ + checkValidSource (source); + parent->provideData (data, this); +} + + +esiChoose::esiChoose(esiChoose const &old) : chosenelement(-1), otherwise (NULL), parent (NULL) +{ + for (size_t counter = 0; counter < old.elements.size(); ++counter) { + ESIElement::Pointer newElement = old.elements[counter]->makeCacheable(); + + if (newElement.getRaw()) + assert (addElement(newElement)); + } +} + +void +esiChoose::makeCachableElements(esiChoose const &old) +{ + for (size_t counter = 0; counter < old.elements.size(); ++counter) { + ESIElement::Pointer newElement = old.elements[counter]->makeCacheable(); + + if (newElement.getRaw()) + assert (addElement(newElement)); + } +} + +void +esiChoose::makeUsableElements(esiChoose const &old, esiVarState &newVarState) +{ + for (size_t counter = 0; counter < old.elements.size(); ++counter) { + ESIElement::Pointer newElement = old.elements[counter]->makeUsable (this, newVarState); + + if (newElement.getRaw()) + assert (addElement(newElement)); + } +} + +ESIElement::Pointer +esiChoose::makeCacheable() const +{ + esiChoose *resultC = new esiChoose (*this); + ESIElement::Pointer result = resultC; + resultC->makeCachableElements(*this); + + if (otherwise.getRaw()) + resultC->otherwise = otherwise->makeCacheable(); + + return result; +} + +ESIElement::Pointer +esiChoose::makeUsable(esiTreeParentPtr newParent, esiVarState &newVarState) const +{ + esiChoose *resultC = new esiChoose (*this); + ESIElement::Pointer result = resultC; + resultC->parent = newParent; + resultC->makeUsableElements(*this, newVarState); + resultC->selectElement(); + + if (otherwise.getRaw()) + resultC->otherwise = otherwise->makeUsable(resultC, newVarState); + + return result; +} + +/* ElementList */ +ElementList::ElementList () : elements(NULL), allocedcount(0), allocedsize(0), elementcount (0) +{} + +ElementList::~ElementList() +{ + debug (86,5)("ElementList::~ElementList %p\n", this); + setNULL(0, elementcount); + + if (elements) + memFreeBuf (allocedsize, elements); +} + +ESIElement::Pointer & +ElementList::operator [] (int index) +{ + return elements[index]; +} + +ESIElement::Pointer const & +ElementList::operator [] (int index) const +{ + return elements[index]; +} + +void +ElementList::pop_front (size_t const count) +{ + if (!count) + return; + + xmemmove (elements, &elements[count], (elementcount - count) * sizeof (ESIElement::Pointer)); + + elementcount -= count; +} + +void +ElementList::push_back(ESIElement::Pointer &newElement) +{ + elements = (ESIElement::Pointer *)memReallocBuf (elements, ++elementcount * sizeof (ESIElement::Pointer), + &allocedsize); + assert (elements); + allocedcount = elementcount; + memset(&elements[elementcount - 1], '\0', sizeof (ESIElement::Pointer)); + elements[elementcount - 1] = newElement; +} + +size_t +ElementList::size() const +{ + return elementcount; +} + +/* esiWhen */ +void * +esiWhen::operator new(size_t byteCount) +{ + assert (byteCount == sizeof (esiWhen)); + + if (!Pool) + Pool = memPoolCreate("esiWhen", sizeof(esiWhen)); + + return memPoolAlloc(Pool); +} + +void +esiWhen::operator delete (void *address) +{ + memPoolFree(Pool, address); +} + +void +esiWhen::deleteSelf() const +{ + delete this; +} + +esiWhen::esiWhen (esiTreeParentPtr aParent, int attrcount, const char **attr,esiVarState *aVar) : esiSequence (aParent) +{ + varState = NULL; + char const *expression = NULL; + + for (int loopCounter = 0; loopCounter < attrcount && attr[loopCounter]; loopCounter += 2) { + if (!strcmp(attr[loopCounter],"test")) { + /* evaluate test */ + debug (86,5)("esiIncludeNew: Evaluating '%s'\n",attr[loopCounter+1]); + /* TODO: warn the user instead of asserting */ + assert (expression == NULL); + expression = attr[loopCounter+1]; + } else { + /* ignore mistyped attributes. + * TODO:? error on these for user feedback - config parameter needed + */ + debug (86,1)("Found misttyped attribute on ESI When clause\n"); + } + } + + /* No expression ? default is not matching */ + if (!expression) + return; + + unevaluatedExpression = xstrdup(expression); + + varState = cbdataReference (aVar); + + evaluate(); +} + +esiWhen::~esiWhen() +{ + safe_free (unevaluatedExpression); + + if (varState) + cbdataReferenceDone (varState); +} + +void +esiWhen::evaluate() +{ + if (!unevaluatedExpression) + return; + + assert (varState); + + varState->feedData(unevaluatedExpression, strlen (unevaluatedExpression)); + + char const *expression = varState->extractChar (); + + setTestResult(esiExpressionEval (expression)); + + safe_free (expression); +} + +esiWhen::esiWhen(esiWhen const &old) : esiSequence (old) +{ + unevaluatedExpression = NULL; + + if (old.unevaluatedExpression) + unevaluatedExpression = xstrdup(old.unevaluatedExpression); + + varState = NULL; +} + +ESIElement::Pointer +esiWhen::makeCacheable() const +{ + return new esiWhen(*this); +} + +ESIElement::Pointer +esiWhen::makeUsable(esiTreeParentPtr newParent, esiVarState &newVarState) const +{ + esiWhen *resultW = new esiWhen (*this); + ESIElement::Pointer result = resultW; + resultW->parent = newParent; + resultW->makeUsableElements(*this, newVarState); + resultW->varState = cbdataReference (&newVarState); + resultW->evaluate(); + return result; +} + +/* esiOtherwise */ +#if 0 +void * +esiOtherwise::operator new(size_t byteCount) +{ + assert (byteCount == sizeof (esiOtherwise)); + void *rv; + CBDATA_INIT_TYPE_FREECB(esiOtherwise, esiSequence::Free); + rv = (void *)cbdataAlloc (esiOtherwise); + return rv; +} + +void +esiOtherwise::operator delete (void *address) +{ + cbdataFree ((esiOtherwise *)address); +} + +#endif + +void +esiOtherwise::deleteSelf() const +{ + delete this; +} + +/* TODO: implement surrogate targeting and control processing */ +int +esiEnableProcessing (HttpReply *rep) +{ + int rv = 0; + + if (httpHeaderHas(&rep->header, HDR_SURROGATE_CONTROL)) { + HttpHdrScTarget *sctusable = httpHdrScGetMergedTarget (rep->surrogate_control, + Config.Accel.surrogate_id); + + if (!sctusable || sctusable->content.size() == 0) + /* Nothing generic or targeted at us, or no + * content processing requested + */ + return 0; + + if (strstr (sctusable->content.buf(), "ESI/1.0")) + rv = 1; + + httpHdrScTargetDestroy (sctusable); + } + + return rv; +} + + diff --git a/src/ESI.h b/src/ESI.h new file mode 100644 index 0000000000..4835c53e8b --- /dev/null +++ b/src/ESI.h @@ -0,0 +1,46 @@ + +/* + * $Id: ESI.h,v 1.1 2003/03/10 04:56:35 robertc Exp $ + * + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + */ + +#ifndef SQUID_ESI_H +#define SQUID_ESI_H + +#include "clientStream.h" + +/* ESI.c */ +extern CSR esiStreamRead; +extern CSCB esiProcessStream; +extern CSD esiStreamDetach; +extern CSS esiStreamStatus; +extern int esiEnableProcessing (HttpReply *); + +#endif /* SQUID_ESI_H */ diff --git a/src/ESIAttempt.h b/src/ESIAttempt.h new file mode 100644 index 0000000000..f919bcec1f --- /dev/null +++ b/src/ESIAttempt.h @@ -0,0 +1,55 @@ +/* + * $Id: ESIAttempt.h,v 1.1 2003/03/10 04:56:35 robertc Exp $ + * + * DEBUG: section 86 ESI processing + * AUTHOR: Robert Collins + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + * Copyright (c) 2003, Robert Collins + */ + +#ifndef SQUID_ESIATTEMPT_H +#define SQUID_ESIATTEMPT_H + +#include "squid.h" +#include "ESIElement.h" +#include "ESISequence.h" + +/* esiAttempt */ + +struct esiAttempt : public esiSequence +{ + // void *operator new (size_t byteCount); + // void operator delete (void *address); + void deleteSelf() const; + esiAttempt(esiTreeParentPtr aParent) : esiSequence (aParent) {}} + +; + + +#endif /* SQUID_ESIATTEMPT_H */ diff --git a/src/ESIContext.cc b/src/ESIContext.cc new file mode 100644 index 0000000000..46919f652c --- /dev/null +++ b/src/ESIContext.cc @@ -0,0 +1,93 @@ + +/* + * $Id: ESIContext.cc,v 1.1 2003/03/10 04:56:35 robertc Exp $ + * + * DEBUG: section 86 ESI processing + * AUTHOR: Robert Collins + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + */ + +#include "squid.h" +#include "ESIContext.h" +#include "Store.h" +#include "client_side_request.h" + +void +ESIContext::updateCachedAST() +{ + assert (http); + assert (http->entry); + + if (hasCachedAST()) { + debug (86,5)("ESIContext::updateCachedAST: not updating AST cache for entry %p from ESI Context %p as there is already a cached AST.\n", http->entry, this); + return; + } + + ESIElement::Pointer treeToCache = tree->makeCacheable(); + debug (86,5)("ESIContext::updateCachedAST: Updating AST cache for entry %p with current value %p to new value %p\n", http->entry, http->entry->cachedESITree.getRaw(), treeToCache.getRaw()); + + if (http->entry->cachedESITree.getRaw()) + http->entry->cachedESITree->finish(); + + http->entry->cachedESITree = treeToCache; + + treeToCache = NULL; +} + +bool +ESIContext::hasCachedAST() const +{ + assert (http); + assert (http->entry); + + if (http->entry->cachedESITree.getRaw()) { + debug (86,5)("ESIContext::hasCachedAST: %p - Cached AST present in store entry %p.\n", this, http->entry); + return true; + } else { + debug (86,5)("ESIContext::hasCachedAST: %p - Cached AST not present in store entry %p.\n", this, http->entry); + return false; + } +} + +void +ESIContext::getCachedAST() +{ + if (cachedASTInUse) + return; + + assert (hasCachedAST()); + + assert (varState); + + parserState.popAll(); + + tree = http->entry->cachedESITree->makeUsable (this, *varState); + + cachedASTInUse = true; +} diff --git a/src/ESIContext.h b/src/ESIContext.h new file mode 100644 index 0000000000..902159f5e8 --- /dev/null +++ b/src/ESIContext.h @@ -0,0 +1,192 @@ +/* + * $Id: ESIContext.h,v 1.1 2003/03/10 04:56:35 robertc Exp $ + * + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + * Copyright (c) 2003, Robert Collins + */ + +#ifndef SQUID_ESICONTEXT_H +#define SQUID_ESICONTEXT_H + +#include "ESIElement.h" + +class esiVarState; + +class clientStreamNode; + +class ClientHttpRequest; + +#include "ESIParser.h" + +/* ESIContext */ + +class ESIContext : public esiTreeParent, public ESIParserClient +{ + +public: + void *operator new (size_t byteCount); + void operator delete (void *address); + void deleteSelf() const; + ESIContext():reading_(true) {} + + ~ESIContext(); + + enum esiKick_t { + ESI_KICK_FAILED, + ESI_KICK_PENDING, + ESI_KICK_SENT, + ESI_KICK_INPROGRESS + }; + + /* when esi processing completes */ + void provideData(ESISegment::Pointer, ESIElement *source); + void fail (ESIElement *source); + void startRead(); + void finishRead(); + bool reading() const; + void setError(); + + void addStackElement (ESIElement::Pointer element); + void addLiteral (const char *s, int len); + + void finishChildren (); + + clientStreamNode *thisNode; /* our stream node */ + /* the request we are processing. HMM: cbdataReferencing this will result + * in a circular reference, so we don't. Note: we are automatically freed + * when it is, so thats ok. */ + ClientHttpRequest *http; + + struct + { + +int passthrough: + 1; + +int oktosend: + 1; + +int finished: + 1; + + /* an error has occured, send full body replies + * regardless. Note that we don't fail midstream + * because we buffer until we can not fail + */ + +int error: + 1; + +int finishedtemplate: + 1; /* we've read the entire template */ + +int clientwantsdata: + 1; /* we need to satisfy a read request */ + +int kicked: + 1; /* note on reentering the kick routine */ + +int detached: + 1; /* our downstream has detached */ + } + + flags; + err_type errorpage; /* if we error what page to use */ + http_status errorstatus; /* if we error, what code to return */ + char *errormessage; /* error to pass to error page */ + HttpReply *rep; /* buffered until we pass data downstream */ + ESISegment::Pointer buffered; /* unprocessed data - for whatever reason */ + ESISegment::Pointer incoming; + /* processed data we are waiting to send, or for + * potential errors to be resolved + */ + ESISegment::Pointer outbound; + ESISegment::Pointer outboundtail; /* our write segment */ + /* the offset to the next character to send - + * non zero if we haven't sent the entire segment + * for some reason + */ + size_t outbound_offset; + off_t readpos; /* the logical position we are reading from */ + off_t pos; /* the logical position of outbound_offset in the data stream */ + + class ParserState + { + + public: + ESIElement::Pointer stack[10]; /* a stack of esi elements that are open */ + int stackdepth; /* self explanatory */ + ESIParser::Pointer theParser; + ESIElement::Pointer top(); + void init (ESIParserClient *); + bool inited() const; + ParserState(); + void freeResources(); + void popAll(); + + int parsing: + 1; /* libexpat is not reentrant on the same context */ + + private: + bool inited_; + } + + parserState; /* todo factor this off somewhere else; */ + esiVarState *varState; + ESIElement::Pointer tree; + + esiKick_t kick (); + RefCount cbdataLocker; + bool failed() const {return flags.error != 0;} + + bool cachedASTInUse; + +private: + CBDATA_CLASS(ESIContext); + void fail (); + void freeResources(); + void fixupOutboundTail(); + void trimBlanks(); + size_t send (); + bool reading_; + void appendOutboundData(ESISegment::Pointer theData); + esiProcessResult_t process (); + void parse(); + void parseOneBuffer(); + void updateCachedAST(); + bool hasCachedAST() const; + void getCachedAST(); + virtual void start(const char *el, const char **attr, size_t attrCount); + virtual void end(const char *el); + virtual void parserDefault (const char *s, int len); + virtual void parserComment (const char *s); + bool processing; +}; + +#endif /* SQUID_ESICONTEXT_H */ diff --git a/src/ESICustomParser.cc b/src/ESICustomParser.cc new file mode 100644 index 0000000000..d0de92500d --- /dev/null +++ b/src/ESICustomParser.cc @@ -0,0 +1,306 @@ + +/* + * $Id: ESICustomParser.cc,v 1.1 2003/03/10 04:56:35 robertc Exp $ + * + * DEBUG: section 86 ESI processing + * AUTHOR: Robert Collins + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + */ + +#include "squid.h" +#include "ESICustomParser.h" +#include "Trie.h" +#include "Array.h" + +Trie *ESICustomParser::SearchTrie=NULL; +bool ESICustomParser::TrieInited; + +Trie * +ESICustomParser::GetTrie() +{ + if (SearchTrie) + return SearchTrie; + + SearchTrie = new Trie; + + assert (SearchTrie->add + ("add + ("add + (""); + + if (!commentEnd) { + error = "missing end of comment"; + return false; + } + + if (commentEnd - tag > (ssize_t)remainingCount) { + error = "comment ends beyond parse buffer"; + return false; + } + + *commentEnd = '\0'; + theClient->parserComment (tag + 4); + remainingCount -= commentEnd - currentPos + 3; + currentPos = commentEnd + 3; + } + + break; + break; + + default: + fatal ("unknown ESI tag type found"); + }; + + /* + * Find next esi tag (open or closing) or comment + * send tag, or full comment text + * rinse + */ + } + + if (remainingCount) + theClient->parserDefault (currentPos,remainingCount); + + debug (86,5)("ESICustomParser::parse: Finished parsing, will return %d\n", !openESITags); + + if (openESITags) + error = "ESI Tags still open"; + + return !openESITags; +} + +size_t +ESICustomParser::lineNumber() const +{ + /* We don't track lines in the body */ + return 0; +} + +char const * +ESICustomParser::errorString() const +{ + if (error.size()) + return error.buf(); + else + return "Parsing error strings not implemented"; +} diff --git a/src/ESICustomParser.h b/src/ESICustomParser.h new file mode 100644 index 0000000000..a1cba5885c --- /dev/null +++ b/src/ESICustomParser.h @@ -0,0 +1,71 @@ +/* + * $Id: ESICustomParser.h,v 1.1 2003/03/10 04:56:35 robertc Exp $ + * + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + */ + +#ifndef SQUID_ESICUSTOMPARSER_H +#define SQUID_ESICUSTOMPARSER_H + +#include "ESIParser.h" + +class Trie; + +class ESICustomParser : public ESIParser +{ + +public: + virtual void deleteSelf() const; + ESICustomParser(ESIParserClient *); + ~ESICustomParser(); + /* true on success */ + bool parse(char const *dataToParse, size_t const lengthOfData, bool const endOfStream); + size_t lineNumber() const; + char const * errorString() const; + +private: + static Trie *SearchTrie; + static bool TrieInited; + static Trie *GetTrie(); + enum ESITAG_t { + ESITAG=1, + ESIENDTAG=2, + ESICOMMENT=3, + }; + + char const *findTag(char const *a, size_t b); + ESIParserClient *theClient; + String error; + /* cheap n dirty - buffer it all */ + String content; + /* TODO: make a class of this type code */ + ESITAG_t lastTag; +}; + +#endif /* SQUID_ESICUSTOMPARSER_H */ diff --git a/src/ESIElement.h b/src/ESIElement.h new file mode 100644 index 0000000000..3878ca2d8d --- /dev/null +++ b/src/ESIElement.h @@ -0,0 +1,114 @@ +/* + * $Id: ESIElement.h,v 1.1 2003/03/10 04:56:35 robertc Exp $ + * + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + */ + +#ifndef SQUID_ESIELEMENT_H +#define SQUID_ESIELEMENT_H + +#include "RefCount.h" +#include "ESISegment.h" + +typedef enum { + ESI_PROCESS_COMPLETE = 0, + ESI_PROCESS_PENDING_WONTFAIL = 1, + ESI_PROCESS_PENDING_MAYFAIL = 2, + ESI_PROCESS_FAILED = 3 +} esiProcessResult_t; + +class ESIElement; + +struct esiTreeParent : public RefCountable +{ + virtual void provideData (ESISegment::Pointer data, ESIElement * source) + { + /* make abstract when all functionality complete */ + assert (0); + } + + virtual void fail(ESIElement * source) {} + + virtual ~esiTreeParent(){}} + +; + +typedef RefCount esiTreeParentPtr; + +class esiVarState; + +struct ESIElement : public esiTreeParent +{ + typedef RefCount Pointer; + + /* the types we have */ + enum ESIElementType_t { + ESI_ELEMENT_NONE, + ESI_ELEMENT_INCLUDE, + ESI_ELEMENT_COMMENT, + ESI_ELEMENT_REMOVE, + ESI_ELEMENT_TRY, + ESI_ELEMENT_ATTEMPT, + ESI_ELEMENT_EXCEPT, + ESI_ELEMENT_VARS, + ESI_ELEMENT_CHOOSE, + ESI_ELEMENT_WHEN, + ESI_ELEMENT_OTHERWISE + }; + static ESIElementType_t IdentifyElement (const char *); + virtual bool addElement(ESIElement::Pointer) + { + /* Don't accept children */ + debug (86,5)("ESIElement::addElement: Failed for %p\n",this); + return false; + } + + virtual void render (ESISegment::Pointer) = 0; + /* process this element */ + virtual esiProcessResult_t process (int dovars) + { + debug (86,5) ("esiProcessComplete: Processed %p\n",this); + return ESI_PROCESS_COMPLETE; + } + + virtual void deleteSelf() const = 0; + + virtual bool mayFail() const + { + return true; + } + + virtual Pointer makeCacheable() const = 0; + virtual Pointer makeUsable(esiTreeParentPtr, esiVarState &) const = 0; + + /* The top level no longer needs this element */ + virtual void finish() = 0; +}; + +#endif /* SQUID_ESIELEMENT_H */ diff --git a/src/ESIExcept.h b/src/ESIExcept.h new file mode 100644 index 0000000000..4fd7fdc157 --- /dev/null +++ b/src/ESIExcept.h @@ -0,0 +1,54 @@ +/* + * $Id: ESIExcept.h,v 1.1 2003/03/10 04:56:35 robertc Exp $ + * + * DEBUG: section 86 ESI processing + * AUTHOR: Robert Collins + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + * Copyright (c) 2003, Robert Collins + */ + +#ifndef SQUID_ESIEXCEPT_H +#define SQUID_ESIEXCEPT_H + +#include "squid.h" +#include "ESIElement.h" +#include "ESISequence.h" + +/* esiExcept */ + +struct esiExcept : public esiSequence +{ + // void *operator new (size_t byteCount); + // void operator delete (void *address); + void deleteSelf() const; + esiExcept(esiTreeParentPtr aParent) : esiSequence (aParent) {}} + +; + +#endif /* SQUID_ESIEXCEPT_H */ diff --git a/src/ESIExpatParser.cc b/src/ESIExpatParser.cc new file mode 100644 index 0000000000..7f4bec6e28 --- /dev/null +++ b/src/ESIExpatParser.cc @@ -0,0 +1,110 @@ + +/* + * $Id: ESIExpatParser.cc,v 1.1 2003/03/10 04:56:35 robertc Exp $ + * + * DEBUG: section 86 ESI processing + * AUTHOR: Robert Collins + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + */ + +#include "squid.h" +#include "ESIExpatParser.h" + +void +ESIExpatParser::deleteSelf() const +{ + delete this; +} + +ESIExpatParser::ESIExpatParser(ESIParserClient *aClient) : theClient (aClient) +{ + /* TODO: grab the document encoding from the headers */ + p = XML_ParserCreateNS(NULL,'|'); + XML_SetUserData (myParser(), static_cast(this)); + XML_SetElementHandler(myParser(), Start, End); + XML_SetDefaultHandler(myParser(), Default); + XML_SetCommentHandler(myParser(), Comment); + XML_UseParserAsHandlerArg(myParser()); +} + +ESIExpatParser::~ESIExpatParser() +{ + XML_ParserFree (myParser()); + p = NULL; +} + +void +ESIExpatParser::Start(void *data,const XML_Char *el, const char **attr) +{ + XML_Parser parser = static_cast(data); + ESIExpatParser *me = (ESIExpatParser *)XML_GetUserData(parser); + me->theClient->start (el, attr, XML_GetSpecifiedAttributeCount (parser)); +} + +void +ESIExpatParser::End(void *data,const XML_Char *el) +{ + XML_Parser parser = static_cast(data); + ESIExpatParser *me = (ESIExpatParser *)XML_GetUserData(parser); + me->theClient->end (el); +} + +void +ESIExpatParser::Default(void *data, const XML_Char *s, int len) +{ + XML_Parser parser = static_cast(data); + ESIExpatParser *me = (ESIExpatParser *)XML_GetUserData(parser); + me->theClient->parserDefault (s, len); +} + +void +ESIExpatParser::Comment(void *data, const XML_Char *s) +{ + XML_Parser parser = static_cast(data); + ESIExpatParser *me = (ESIExpatParser *)XML_GetUserData(parser); + me->theClient->parserComment (s); +} + +bool +ESIExpatParser::parse(char const *dataToParse, size_t const lengthOfData, bool const endOfStream) +{ + return XML_Parse(myParser(), dataToParse, lengthOfData, endOfStream); +} + +size_t +ESIExpatParser::lineNumber() const +{ + return XML_GetCurrentLineNumber(myParser()); +} + +char const * +ESIExpatParser::errorString() const +{ + return XML_ErrorString(XML_GetErrorCode(myParser())); +} diff --git a/src/ESIExpatParser.h b/src/ESIExpatParser.h new file mode 100644 index 0000000000..08545acaf3 --- /dev/null +++ b/src/ESIExpatParser.h @@ -0,0 +1,62 @@ +/* + * $Id: ESIExpatParser.h,v 1.1 2003/03/10 04:56:35 robertc Exp $ + * + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + */ + +#ifndef SQUID_ESIEXPATPARSER_H +#define SQUID_ESIEXPATPARSER_H + +#include "ESIParser.h" +#include "expat.h" + +class ESIExpatParser : public ESIParser +{ + +public: + virtual void deleteSelf() const; + ESIExpatParser(ESIParserClient *); + ~ESIExpatParser(); + /* true on success */ + bool parse(char const *dataToParse, size_t const lengthOfData, bool const endOfStream); + size_t lineNumber() const; + char const * errorString() const; + +private: + mutable XML_Parser p; /* our parser */ + static void Start(void *data, const char *el, const char **attr); + static void End(void *data, const char *el); + static void Default (void *data, const char *s, int len); + static void Comment (void *data, const char *s); + XML_Parser &myParser() const {return p;} + + ESIParserClient *theClient; +}; + +#endif /* SQUID_ESIEXPATPARSER_H */ diff --git a/src/ESIExpression.cc b/src/ESIExpression.cc new file mode 100644 index 0000000000..b5523e2a85 --- /dev/null +++ b/src/ESIExpression.cc @@ -0,0 +1,1097 @@ + +/* + * $Id: ESIExpression.cc,v 1.1 2003/03/10 04:56:35 robertc Exp $ + * + * DEBUG: section 86 ESI processing + * AUTHOR: Robert Collins + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + */ + +#include "squid.h" + +/* stack precedence rules: + * before pushing an operator onto the stack, the + * top 2 elements are checked. if either has a higher + * or equal precedence than the current operator, they + * are evaluated. + * Start of expression has 5 precedence, + * end of expression has 0 precedence + * literal has 1 as does expression results + * | has 2 + * & has 3 + * ! has 4 + * == != < > <= >= has 5 + * ( has 5 + * ) has 0 + */ + +typedef struct _stackmember stackmember; + +typedef int evaluate (stackmember * stack, int *depth, int whereAmI, + stackmember * candidate); + +typedef enum +{ + ESI_EXPR_INVALID, + ESI_EXPR_LITERAL, + ESI_EXPR_OR, + ESI_EXPR_AND, + ESI_EXPR_NOT, + ESI_EXPR_START, + ESI_EXPR_END, + ESI_EXPR_EQ, + ESI_EXPR_NOTEQ, + ESI_EXPR_LESS, + ESI_EXPR_LESSEQ, + ESI_EXPR_MORE, + ESI_EXPR_MOREEQ, + ESI_EXPR_EXPR /* the result of an expr PRI 1 */ +} +evaltype; + +typedef enum +{ + ESI_LITERAL_STRING, + ESI_LITERAL_FLOAT, + ESI_LITERAL_INT, + ESI_LITERAL_BOOL, + ESI_LITERAL_INVALID +} +literalhint; + +struct _stackmember +{ + evaluate *eval; + union + { + char *string; + double floating; + int integral; + } + value; + literalhint valuestored; + evaltype valuetype; + int precedence; +}; + +static void cleanmember (stackmember *); +static void stackpop (stackmember * s, int *depth); + +void +cleanmember (stackmember * s) +{ + if (s->valuetype == ESI_EXPR_LITERAL + && s->valuestored == ESI_LITERAL_STRING) { + safe_free (s->value.string); + s->value.string = NULL; + } + +} + +void +stackpop (stackmember * s, int *depth) +{ + if (!(*depth)--) + return; + + cleanmember (&s[*depth]); +} + +static evaluate evalnegate; +static evaluate evalliteral; +static evaluate evalor; +static evaluate evaland; +static evaluate evallesseq; +static evaluate evallessthan; +static evaluate evalmoreeq; +static evaluate evalmorethan; +static evaluate evalequals; +static evaluate evalnotequals; +static evaluate evalstartexpr; +static evaluate evalendexpr; +static evaluate evalexpr; +static void dumpstack (stackmember * stack, int depth); +static int addmember (stackmember * stack, int *stackdepth, + stackmember * candidate); +static int membercompare (stackmember a, stackmember b); +static char const *trim (char const *s); +static stackmember getsymbol (const char *s, char const **endptr); +static void printliteral (stackmember s); +static void printmember (stackmember s); + + + + +extern int + esiExpressionEval (char const *s); + + +/* -2 = failed to compate + * -1 = a less than b + * 0 = a equal b + * 2 - a more than b + */ +int +membercompare (stackmember a, stackmember b) +{ + /* we can compare: sub expressions to sub expressions , + * literals to literals + */ + + if (!((a.valuetype == ESI_EXPR_LITERAL && b.valuetype == ESI_EXPR_LITERAL && + a.valuestored != ESI_LITERAL_INVALID && b.valuestored != ESI_LITERAL_INVALID) || + (a.valuetype == ESI_EXPR_EXPR && b.valuetype == ESI_EXPR_EXPR))) + return -2; + + if (a.valuetype == ESI_EXPR_EXPR) { + if (a.value.integral == b.value.integral) + return 0; + else + return 1; + } else if (a.valuestored == ESI_LITERAL_STRING) { + if (b.valuestored == ESI_LITERAL_STRING) { + int i =strcmp (a.value.string, b.value.string); + + if (i < 0) + return -1; + + if (i > 0) + return 1; + + return 0; + } else { + /* TODO: numeric to string conversion ? */ + debug (86,1) ("strcmp with non-string\n"); + return -2; + } + } else if (a.valuestored == ESI_LITERAL_FLOAT) { + if (b.valuestored == ESI_LITERAL_INT) { + if (fabs(a.value.floating - b.value.integral) < 0.00001) + return 0; + else if (a.value.floating < b.value.integral) + return -1; + else + return 1; + } else if (b.valuestored == ESI_LITERAL_FLOAT) { + if (a.value.floating == b.value.floating) + return 0; + else if (a.value.floating < b.value.floating) + return -1; + else + return 1; + } else { + /* TODO: attempt numeric converson again? */ + debug (86,1) ("floatcomp with non float or int\n"); + return -2; + } + } else if (a.valuestored == ESI_LITERAL_INT) { + if (b.valuestored == ESI_LITERAL_INT) { + if (a.value.integral == b.value.integral) + return 0; + else if (a.value.integral < b.value.integral) + return -1; + else + return 1; + } else if (b.valuestored == ESI_LITERAL_FLOAT) { + if (fabs(a.value.integral - b.value.floating) < 0.00001) + return 0; + else if (a.value.integral < b.value.floating) + return -1; + else + return 1; + } else { + /* TODO: attempt numeric converson again? */ + debug (86,1) ("intcomp vs non float non int\n"); + return -2; + } + } + + return -2; +} + +/* return 0 on success, 1 on failure */ +int evalnegate +(stackmember * stack, int *depth, int whereAmI, stackmember * candidate) +{ + if (whereAmI != *depth - 2) + /* invalid stack */ + return 1; + + if (stack[whereAmI + 1].valuetype != ESI_EXPR_EXPR) + /* invalid operand */ + return 1; + + /* copy down */ + --(*depth); + + stack[whereAmI] = stack[(*depth)]; + + cleanmember (candidate); + + if (stack[whereAmI].value.integral == 1) + stack[whereAmI].value.integral = 0; + else + stack[whereAmI].value.integral = 1; + + return 0; +} + +int evalliteral +(stackmember * stack, int *depth, int whereAmI, stackmember * candidate) +{ + debug (86,1) ("attempt to evaluate a literal\n"); + /* literals can't be evaluated */ + return 1; +} + +int evalexpr +(stackmember * stack, int *depth, int whereAmI, stackmember * candidate) +{ + debug (86,1) ("attempt to evaluate a sub-expression result\n"); + /* sub-scpr's can't be evaluated */ + return 1; +} + + +int evalor +(stackmember * stack, int *depth, int whereAmI, stackmember * candidate) +{ + int rv; + stackmember srv; + + if (*depth < 3) + /* Not enough operands */ + return 1; + + if (whereAmI != *depth - 2) + /* invalid stack */ + return 1; + + if (stack[whereAmI + 1].valuetype != ESI_EXPR_EXPR || + stack[whereAmI - 1].valuetype != ESI_EXPR_EXPR) + /* invalid operand */ + return 1; + + rv = stack[whereAmI - 1].value.integral || stack[whereAmI + 1].value.integral; + + if (rv == -2) + /* invalid comparison */ + return 1; + + stackpop (stack, depth); /* arg rhs */ + + stackpop (stack, depth); /* me */ + + stackpop (stack, depth); /* arg lhs */ + + srv.valuetype = ESI_EXPR_EXPR; + + srv.eval = evalliteral; + + srv.valuestored = ESI_LITERAL_BOOL; + + srv.value.integral = rv ? 1 : 0; + + srv.precedence = 1; + + stack[(*depth)++] = srv; + + /* we're out of way, try adding now */ + if (!addmember (stack, depth, candidate)) + /* Something wrong upstream */ + return 1; + + return 0; +} + +int evaland +(stackmember * stack, int *depth, int whereAmI, stackmember * candidate) +{ + int rv; + stackmember srv; + + if (*depth < 3) + /* Not enough operands */ + return 1; + + if (whereAmI != *depth - 2) + /* invalid stack */ + return 1; + + if (stack[whereAmI + 1].valuetype != ESI_EXPR_EXPR || + stack[whereAmI - 1].valuetype != ESI_EXPR_EXPR) + /* invalid operand */ + return 1; + + rv = stack[whereAmI - 1].value.integral && stack[whereAmI + 1].value.integral; + + if (rv == -2) + /* invalid comparison */ + return 1; + + stackpop (stack, depth); /* arg rhs */ + + stackpop (stack, depth); /* me */ + + stackpop (stack, depth); /* arg lhs */ + + srv.valuetype = ESI_EXPR_EXPR; + + srv.eval = evalexpr; + + srv.valuestored = ESI_LITERAL_BOOL; + + srv.value.integral = rv ? 1 : 0; + + srv.precedence = 1; + + stack[(*depth)++] = srv; + + /* we're out of way, try adding now */ + if (!addmember (stack, depth, candidate)) + /* Something wrong upstream */ + return 1; + + return 0; +} + +int evallesseq +(stackmember * stack, int *depth, int whereAmI, stackmember * candidate) +{ + int rv; + stackmember srv; + + if (*depth < 3) + /* Not enough operands */ + return 1; + + if (whereAmI != *depth - 2) + /* invalid stack */ + return 1; + + rv = membercompare (stack[whereAmI - 1], stack[whereAmI + 1]); + + if (rv == -2) + /* invalid comparison */ + return 1; + + stackpop (stack, depth); /* arg rhs */ + + stackpop (stack, depth); /* me */ + + stackpop (stack, depth); /* arg lhs */ + + srv.valuetype = ESI_EXPR_EXPR; + + srv.eval = evalexpr; + + srv.valuestored = ESI_LITERAL_BOOL; + + srv.value.integral = rv <= 0 ? 1 : 0; + + srv.precedence = 1; + + stack[(*depth)++] = srv; + + /* we're out of way, try adding now */ + if (!addmember (stack, depth, candidate)) + /* Something wrong upstream */ + return 1; + + /* debug (86,1) ("?= %d \n", srv.value.integral); */ + return 0; + + +} + +int evallessthan +(stackmember * stack, int *depth, int whereAmI, stackmember * candidate) +{ + int rv; + stackmember srv; + + if (*depth < 3) + /* Not enough operands */ + return 1; + + if (whereAmI != *depth - 2) + /* invalid stack */ + return 1; + + rv = membercompare (stack[whereAmI - 1], stack[whereAmI + 1]); + + if (rv == -2) + /* invalid comparison */ + return 1; + + stackpop (stack, depth); /* arg rhs */ + + stackpop (stack, depth); /* me */ + + stackpop (stack, depth); /* arg lhs */ + + srv.valuetype = ESI_EXPR_EXPR; + + srv.eval = evalexpr; + + srv.valuestored = ESI_LITERAL_BOOL; + + srv.value.integral = rv < 0 ? 1 : 0; + + srv.precedence = 1; + + stack[(*depth)++] = srv; + + /* we're out of way, try adding now */ + if (!addmember (stack, depth, candidate)) + /* Something wrong upstream */ + return 1; + + /* debug (86,1) ("?= %d \n", srv.value.integral); */ + return 0; + + +} + +int evalmoreeq +(stackmember * stack, int *depth, int whereAmI, stackmember * candidate) +{ + int rv; + stackmember srv; + + if (*depth < 3) + /* Not enough operands */ + return 1; + + if (whereAmI != *depth - 2) + /* invalid stack */ + return 1; + + rv = membercompare (stack[whereAmI - 1], stack[whereAmI + 1]); + + if (rv == -2) + /* invalid comparison */ + return 1; + + stackpop (stack, depth); /* arg rhs */ + + stackpop (stack, depth); /* me */ + + stackpop (stack, depth); /* arg lhs */ + + srv.valuetype = ESI_EXPR_EXPR; + + srv.eval = evalexpr; + + srv.valuestored = ESI_LITERAL_BOOL; + + srv.value.integral = rv >= 0 ? 1 : 0; + + srv.precedence = 1; + + stack[(*depth)++] = srv; + + /* we're out of way, try adding now */ + if (!addmember (stack, depth, candidate)) + /* Something wrong upstream */ + return 1; + + /* debug (86,1) ("?= %d \n", srv.value.integral); */ + return 0; + + +} + +int evalmorethan +(stackmember * stack, int *depth, int whereAmI, stackmember * candidate) +{ + int rv; + stackmember srv; + + if (*depth < 3) + /* Not enough operands */ + return 1; + + if (whereAmI != *depth - 2) + /* invalid stack */ + return 1; + + rv = membercompare (stack[whereAmI - 1], stack[whereAmI + 1]); + + if (rv == -2) + /* invalid comparison */ + return 1; + + stackpop (stack, depth); /* arg rhs */ + + stackpop (stack, depth); /* me */ + + stackpop (stack, depth); /* arg lhs */ + + srv.valuetype = ESI_EXPR_EXPR; + + srv.eval = evalexpr; + + srv.valuestored = ESI_LITERAL_BOOL; + + srv.value.integral = rv > 0 ? 1 : 0; + + srv.precedence = 1; + + stack[(*depth)++] = srv; + + /* we're out of way, try adding now */ + if (!addmember (stack, depth, candidate)) + /* Something wrong upstream */ + return 1; + + /* debug (86,1) ("?= %d \n", srv.value.integral); */ + return 0; + +} + +int +evalequals (stackmember * stack, int *depth, int whereAmI, + stackmember * candidate) +{ + int rv; + stackmember srv; + + if (*depth < 3) + /* Not enough operands */ + return 1; + + if (whereAmI != *depth - 2) + /* invalid stack */ + return 1; + + rv = membercompare (stack[whereAmI - 1], stack[whereAmI + 1]); + + if (rv == -2) + /* invalid comparison */ + return 1; + + stackpop (stack, depth); /* arg rhs */ + + stackpop (stack, depth); /* me */ + + stackpop (stack, depth); /* arg lhs */ + + srv.valuetype = ESI_EXPR_EXPR; + + srv.eval = evalexpr; + + srv.valuestored = ESI_LITERAL_BOOL; + + srv.value.integral = rv ? 0 : 1; + + srv.precedence = 1; + + stack[(*depth)++] = srv; + + /* we're out of way, try adding now */ + if (!addmember (stack, depth, candidate)) + /* Something wrong upstream */ + return 1; + + /* debug (86,1) ("?= %d \n", srv.value.integral); */ + return 0; +} + +int evalnotequals +(stackmember * stack, int *depth, int whereAmI, stackmember * candidate) +{ + int rv; + stackmember srv; + + if (*depth < 3) + /* Not enough operands */ + return 1; + + if (whereAmI != *depth - 2) + /* invalid stack */ + return 1; + + rv = membercompare (stack[whereAmI - 1], stack[whereAmI + 1]); + + if (rv == -2) + /* invalid comparison */ + return 1; + + stackpop (stack, depth); /* arg rhs */ + + stackpop (stack, depth); /* me */ + + stackpop (stack, depth); /* arg lhs */ + + srv.valuetype = ESI_EXPR_EXPR; + + srv.eval = evalexpr; + + srv.valuestored = ESI_LITERAL_BOOL; + + srv.value.integral = rv ? 1 : 0; + + srv.precedence = 1; + + stack[(*depth)++] = srv; + + /* we're out of way, try adding now */ + if (!addmember (stack, depth, candidate)) + /* Something wrong upstream */ + return 1; + + /* debug (86,1) ("?= %d \n", srv.value.integral); */ + return 0; +} + +int evalstartexpr +(stackmember * stack, int *depth, int whereAmI, stackmember * candidate) +{ + /* debug (86,1) ("?(\n"); */ + + if (whereAmI != *depth - 2) + /* invalid stack */ + return 1; + + /* Only valid when RHS is an end bracket */ + if (candidate->valuetype != ESI_EXPR_END) + return 1; + + --(*depth); + + stack[whereAmI] = stack[(*depth)]; + + cleanmember (candidate); + + return 0; +} + +int evalendexpr +(stackmember * stack, int *depth, int whereAmI, stackmember * candidate) +{ + /* Can't evaluate ) brackets */ + return 1; +} + +char const * +trim (char const *s) +{ + while (*s == ' ') + ++s; + + return s; +} + +stackmember +getsymbol (const char *s, char const **endptr) +{ + stackmember rv; + char *end; + char const *origs = s; + /* trim whitespace */ + s = trim (s); + rv.eval = NULL; /* A literal */ + rv.valuetype = ESI_EXPR_INVALID; + rv.valuestored = ESI_LITERAL_INVALID; + + if (('0' <= *s && *s <= '9') || *s == '-') { + size_t length = strspn (s, "0123456789."); + char *point; + + if ((point = strchr (s, '.')) && point - s < (ssize_t)length) { + /* floating point */ + rv.value.floating = strtod (s, &end); + + if (s == end || errno) { + /* Couldn't convert to float */ + debug (86,1) ("failed to convert '%s' to float \n", s); + *endptr = origs; + } else { + debug (86,6) ("found %f of length %d\n",rv.value.floating, end - s); + *endptr = end; + rv.eval = evalliteral; + rv.valuestored = ESI_LITERAL_FLOAT; + rv.valuetype = ESI_EXPR_LITERAL; + rv.precedence = 1; + } + } else { + /* INT */ + rv.value.integral = strtol (s, &end, 0); + + if (s == end || errno) { + /* Couldn't convert to int */ + debug (86,1) ("failed to convert '%s' to int \n", s); + *endptr = origs; + } else { + debug (86,6) ("found %d of length %d\n",rv.value.integral, end - s); + *endptr = end; + rv.eval = evalliteral; + rv.valuestored = ESI_LITERAL_INT; + rv.valuetype = ESI_EXPR_LITERAL; + rv.precedence = 1; + } + } + } else if ('!' == *s) { + if ('=' == *(s + 1)) { + debug (86,6) ("found !=\n"); + *endptr = s + 2; + rv.eval = evalnotequals; + rv.valuetype = ESI_EXPR_NOTEQ; + rv.precedence = 5; + } else { + debug (86,6) ("found !\n"); + *endptr = s + 1; + rv.valuetype = ESI_EXPR_NOT; + rv.precedence = 4; + rv.eval = evalnegate; + } + } else if ('\'' == *s) { + char const *t = s + 1; + debug (86,6) ("found \'\n"); + + while (*t != '\'' && *t) + ++t; + + if (!*t) { + debug (86,1) ("missing end \' in '%s'\n", s); + *endptr = origs; + } else { + *endptr = t + 1; + rv.value.string = xstrndup (s + 1, t - s - 1); + rv.eval = evalliteral; + rv.valuestored = ESI_LITERAL_STRING; + rv.valuetype = ESI_EXPR_LITERAL; + rv.precedence = 1; + debug (86,6) ("found string '%s'\n", rv.value.string); + } + } else if ('(' == *s) { + debug (86,6)("found subexpr start\n"); + *endptr = s + 1; + rv.valuetype = ESI_EXPR_START; + rv.precedence = 5; + rv.eval = evalstartexpr; + } else if (')' == *s) { + debug (86,6)("found subexpr end\n"); + *endptr = s + 1; + rv.valuetype = ESI_EXPR_END; + rv.precedence = 0; + rv.eval = evalendexpr; + } else if ('&' == *s) { + debug (86,6) ("found AND\n"); + *endptr = s + 1; + rv.valuetype = ESI_EXPR_AND; + rv.precedence = 3; + rv.eval = evaland; + } else if ('|' == *s) { + debug (86,6) ("found OR\n"); + *endptr = s + 1; + rv.valuetype = ESI_EXPR_OR; + rv.precedence = 2; + rv.eval = evalor; + } else if ('=' == *s) { + if ('=' == *(s + 1)) { + debug (86,6) ("found equals\n"); + *endptr = s + 2; + rv.valuetype = ESI_EXPR_EQ; + rv.precedence = 5; + rv.eval = evalequals; + } else { + debug (86,1) ("invalid expr '%s'\n", s); + *endptr = origs; + } + } else if ('<' == *s) { + if ('=' == *(s + 1)) { + debug (86,6) ("found less-equals\n"); + *endptr = s + 2; + rv.valuetype = ESI_EXPR_LESSEQ; + rv.precedence = 5; + rv.eval = evallesseq; + } else { + debug (86,6) ("found less than\n"); + *endptr = s + 1; + rv.valuetype = ESI_EXPR_LESS; + rv.precedence = 5; + rv.eval = evallessthan; + } + } else if ('>' == *s) { + if ('=' == *(s + 1)) { + debug (86,6) ("found more-equals\n"); + *endptr = s + 2; + rv.valuetype = ESI_EXPR_MOREEQ; + rv.precedence = 5; + rv.eval = evalmoreeq; + } else { + debug (86,6) ("found more than\n"); + *endptr = s + 1; + rv.valuetype = ESI_EXPR_MORE; + rv.precedence = 5; + rv.eval = evalmorethan; + } + } else if (!strncmp (s, "false", 5)) { + debug (86,5)("getsymbol: found variable result 'false'\n"); + *endptr = s + 5; + rv.valuetype = ESI_EXPR_EXPR; + rv.valuestored = ESI_LITERAL_BOOL; + rv.value.integral = 0; + rv.precedence = 1; + rv.eval = evalexpr; + } else if (!strncmp (s, "true", 4)) { + debug (86,5)("getsymbol: found variable result 'true'\n"); + *endptr = s + 4; + rv.valuetype = ESI_EXPR_EXPR; + rv.valuestored = ESI_LITERAL_BOOL; + rv.value.integral = 1; + rv.precedence = 1; + rv.eval = evalexpr; + } else { + debug (86,1) ("invalid expr '%s'\n", s); + *endptr = origs; + } + + return rv; +} + +void +printliteral (stackmember s) +{ + switch (s.valuestored) { + + case ESI_LITERAL_INVALID: + debug (86,1) (" Invalid "); + break; + + case ESI_LITERAL_FLOAT: + debug (86,1) ("%f", s.value.floating); + break; + + case ESI_LITERAL_STRING: + debug (86,1) ("'%s'", s.value.string); + break; + + case ESI_LITERAL_INT: + debug (86,1) ("%d", s.value.integral); + break; + + case ESI_LITERAL_BOOL: + debug (86,1)("%s",s.value.integral ? "true" : "false"); + } +} + +void +printmember (stackmember s) +{ + switch (s.valuetype) { + + case ESI_EXPR_INVALID: + debug (86,1) (" Invalid "); + break; + + case ESI_EXPR_LITERAL: + printliteral (s); + break; + + case ESI_EXPR_EXPR: + debug (86,1) ("%s", s.value.integral ? "true" : "false"); + break; + + case ESI_EXPR_OR: + debug (86,1) ("|"); + break; + + case ESI_EXPR_AND: + debug (86,1) ("&"); + break; + + case ESI_EXPR_NOT: + debug (86,1) ("!"); + break; + + case ESI_EXPR_START: + debug (86,1) ("("); + break; + + case ESI_EXPR_END: + debug (86,1) (")"); + break; + + case ESI_EXPR_EQ: + debug (86,1) ("=="); + break; + + case ESI_EXPR_NOTEQ: + debug (86,1) ("!="); + break; + + case ESI_EXPR_LESS: + debug (86,1) ("<"); + break; + + case ESI_EXPR_LESSEQ: + debug (86,1) ("<="); + break; + + case ESI_EXPR_MORE: + debug (86,1) (">"); + break; + + case ESI_EXPR_MOREEQ: + debug (86,1) (">="); + break; + } +} + +void +dumpstack (stackmember * stack, int depth) +{ + int i; + + for (i = 0; i < depth; ++i) + printmember (stack[i]); + + if (depth) + debug (86,1) ("\n"); +} + +int +addmember (stackmember * stack, int *stackdepth, stackmember * candidate) +{ + if (candidate->valuetype != ESI_EXPR_LITERAL && *stackdepth > 1) { + /* !(!(a==b))) is why thats safe */ + /* strictly less than until we unwind */ + + if (candidate->precedence < stack[*stackdepth - 1].precedence || + candidate->precedence < stack[*stackdepth - 2].precedence) { + /* must be an operator */ + + if (stack[*stackdepth - 2].valuetype == ESI_EXPR_LITERAL || + stack[*stackdepth - 2].valuetype == ESI_EXPR_INVALID || + stack[*stackdepth - 2].eval (stack, stackdepth, + *stackdepth - 2, candidate)) { + /* cleanup candidate and stack */ + dumpstack (stack, *stackdepth); + cleanmember (candidate); + debug (86,1) ("invalid expression\n"); + return 0; + } + } else { + stack[(*stackdepth)++] = *candidate; + } + } else if (candidate->valuetype != ESI_EXPR_INVALID) + stack[(*stackdepth)++] = *candidate; + + return 1; +} + +int +esiExpressionEval (char const *s) +{ + stackmember stack[20]; + int stackdepth = 0; + char const *end; + PROF_start(esiExpressionEval); + + while (*s) { + stackmember candidate = getsymbol (s, &end); + + if (candidate.valuetype != ESI_EXPR_INVALID) { + assert (s != end); + + if (!addmember (stack, &stackdepth, &candidate)) { + PROF_stop(esiExpressionEval); + return 0; + } + + s = end; + } else { + assert (s == end); + debug (86,1) ("failed parsing expression\n"); + PROF_stop(esiExpressionEval); + return 0; + } + } + + if (stackdepth > 1) { + stackmember rv; + rv.valuetype = ESI_EXPR_INVALID; + rv.precedence = 0; + + if (stack[stackdepth - 2]. + eval (stack, &stackdepth, stackdepth - 2, &rv)) { + /* special case - leading operator failed */ + debug (86,1) ("invalid expression\n"); + PROF_stop(esiExpressionEval); + return 0; + } + } + + if (stackdepth == 0) { + /* Empty expression - evaluate to false */ + PROF_stop(esiExpressionEval); + return 0; + } + + /* if we hit here, we think we have a valid result */ + assert (stackdepth == 1); + + assert (stack[0].valuetype == ESI_EXPR_EXPR); + + PROF_stop(esiExpressionEval); + + return stack[0].value.integral ? 1 : 0; +} + +#if TESTING +int +main () +{ + char const *expressions[] = { + "!(1==1)", "!(1!=1)", "1!=1", "!1==1", "1==1", + "1 <=1","2<=1", "1 < 1", "1 < 2", "-1 < 1","!-1<1", + "1>2","2>1","2>=2", "2>3", "1==1&1==1","1==1&1==0", + "!('a'<='c')", + "(1==1)|('abc'=='def')", + "(4!=5)&(4==5)", + "(1==1)|(2==3)&(3==4)", /* should be true because of precedence */ + "(1 & 4)", + "(\"abc\" | \"edf\")", "1==1==1", + }; + + int i = 0; + + while (strlen (expressions[i])) { + printf("Expr '%s' = '%s'\n", expressions[i], + expreval (expressions[i]) ? "true" : "false"); + ++i; + } + + return 0; +} + +#endif diff --git a/src/ESILiteral.h b/src/ESILiteral.h new file mode 100644 index 0000000000..a209a13449 --- /dev/null +++ b/src/ESILiteral.h @@ -0,0 +1,78 @@ +/* + * $Id: ESILiteral.h,v 1.1 2003/03/10 04:56:35 robertc Exp $ + * + * DEBUG: section 86 ESI processing + * AUTHOR: Robert Collins + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + * Copyright (c) 2003, Robert Collins + */ + +#ifndef SQUID_ESILITERAL_H +#define SQUID_ESILITERAL_H + +#include "squid.h" +#include "ESIElement.h" + +class ESIContext; +/* esiLiteral */ + +struct esiLiteral : public ESIElement +{ + void *operator new (size_t byteCount); + void operator delete (void *address); + void deleteSelf() const; + + esiLiteral(ESISegment::Pointer); + esiLiteral(ESIContext *, const char *s, int len); + ~esiLiteral(); + + void render(ESISegment::Pointer); + esiProcessResult_t process (int dovars); + Pointer makeCacheable() const; + Pointer makeUsable(esiTreeParentPtr, esiVarState &) const; + /* optimise copies away later */ + ESISegment::Pointer buffer; + + struct + { + +int donevars: + 1; + } + + flags; + esiVarState *varState; + void finish(); + +private: + static MemPool *pool; + esiLiteral(esiLiteral const &); +}; + +#endif /* SQUID_ESILITERAL_H */ diff --git a/src/ESIParser.cc b/src/ESIParser.cc new file mode 100644 index 0000000000..aa433cad45 --- /dev/null +++ b/src/ESIParser.cc @@ -0,0 +1,55 @@ + +/* + * $Id: ESIParser.cc,v 1.1 2003/03/10 04:56:35 robertc Exp $ + * + * DEBUG: section 86 ESI processing + * AUTHOR: Robert Collins + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + */ + +#include "squid.h" +#include "ESIParser.h" +#include "ESIExpatParser.h" +#include "ESICustomParser.h" + +char *ESIParser::Type = NULL; + +ESIParser::Pointer +ESIParser::NewParser(ESIParserClient *aClient) +{ + if (!strcasecmp("expat", Type)) + return new ESIExpatParser (aClient); + + if (!strcasecmp("custom", Type)) + return new ESICustomParser (aClient); + + fatal ("Unknown ESI Parser type"); + + return NULL; +} diff --git a/src/ESIParser.h b/src/ESIParser.h new file mode 100644 index 0000000000..ec182c7385 --- /dev/null +++ b/src/ESIParser.h @@ -0,0 +1,65 @@ +/* + * $Id: ESIParser.h,v 1.1 2003/03/10 04:56:36 robertc Exp $ + * + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + */ + +#ifndef SQUID_ESIPARSER_H +#define SQUID_ESIPARSER_H + +class ESIParserClient +{ + +public: + virtual void start(const char *el, const char **attr, size_t attrCount) = 0; + virtual void end(const char *el) = 0; + virtual void parserDefault (const char *s, int len) =0; + virtual void parserComment (const char *s) = 0; +}; + +class ESIParser : public RefCountable +{ + +public: + typedef RefCount Pointer; + static Pointer NewParser(ESIParserClient *aClient); + static char *Type; + virtual void deleteSelf() const =0; + /* true on success */ + virtual bool parse(char const *dataToParse, size_t const lengthOfData, bool const endOfStream) = 0; + virtual size_t lineNumber() const =0; + virtual char const * errorString() const =0; + +protected: + ESIParser(){}; + +private: +}; + +#endif /* SQUID_ESIPARSER_H */ diff --git a/src/ESISegment.cc b/src/ESISegment.cc new file mode 100644 index 0000000000..5b53e56189 --- /dev/null +++ b/src/ESISegment.cc @@ -0,0 +1,246 @@ + +/* + * $Id: ESISegment.cc,v 1.1 2003/03/10 04:56:36 robertc Exp $ + * + * DEBUG: section 86 ESI processing + * AUTHOR: Robert Collins + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + */ + +#include "squid.h" +#include "ESISegment.h" +#include "SquidString.h" + +CBDATA_TYPE(ESISegment); + +/* ESISegment */ +void +ESISegmentFreeList (ESISegment::Pointer &head) +{ + while (head.getRaw()) { + ESISegment::Pointer temp = head; + head = head->next; + temp->next = NULL; + } +} + +size_t +ESISegment::space() const +{ + assert (len <= sizeof(buf)); + return sizeof (buf) - len; +} + +void +ESISegment::adsorbList (ESISegment::Pointer from) +{ + assert (next.getRaw() == NULL); + assert (from.getRaw() != NULL); + /* prevent worst case */ + assert (!(len == 0 && from->len == space() )); + Pointer copyFrom = from; + + while (copyFrom.getRaw() && space() >= copyFrom->len) { + assert (append (copyFrom) == copyFrom->len); + copyFrom = copyFrom->next; + } + + next = copyFrom; +} + +void +ESISegment::ListTransfer (ESISegment::Pointer &from, ESISegment::Pointer &to) +{ + if (!to.getRaw()) { + to = from; + from = NULL; + return; + } + + ESISegment::Pointer temp = to->tail(); + temp->adsorbList (from); + from = NULL; +} + +size_t +ESISegment::listLength() const +{ + size_t result = 0; + ESISegment const* temp = this; + + while (temp) { + result += temp->len; + temp = temp->next.getRaw(); + } + + return result; +} + +char * +ESISegment::listToChar() const +{ + size_t length = listLength(); + char *rv = (char *)xmalloc (length + 1); + assert (rv); + rv [length] = '\0'; + + ESISegment::Pointer temp = this; + size_t pos = 0; + + while (temp.getRaw()) { + xmemcpy (&rv[pos], temp->buf, temp->len); + pos += temp->len; + temp = temp->next; + } + + return rv; +} + +void +ESISegment::listAppend (char const *s, size_t length) +{ + assert (next.getRaw() == NULL); + ESISegment::Pointer output = this; + /* copy the string to output */ + size_t pos=0; + + while (pos < length) { + if (output->space() == 0) { + assert (output->next.getRaw() == NULL); + output->next = new ESISegment; + output = output->next; + } + + pos += output->append(s + pos, length - pos); + } +} + +void +ESISegment::ListAppend (ESISegment::Pointer &head, char const *s, size_t len) +{ + if (!head.getRaw()) + head = new ESISegment; + + head->tail()->listAppend (s, len); +} + +void * +ESISegment::operator new(size_t byteCount) +{ + assert (byteCount == sizeof (ESISegment)); + void *rv; + CBDATA_INIT_TYPE(ESISegment); + rv = (void *)cbdataAlloc (ESISegment); + return rv; +} + +void +ESISegment::operator delete (void *address) +{ + cbdataFree ((ESISegment *)address); +} + +void +ESISegment::deleteSelf() const +{ + delete this; +} + +/* XXX: if needed, make this iterative */ +ESISegment::Pointer +ESISegment::cloneList () const +{ + ESISegment::Pointer result = new ESISegment (*this); + result->next = next.getRaw() ? next->cloneList() : NULL; + return result; +} + +size_t +ESISegment::append(char const *appendBuffer, size_t appendLength) +{ + size_t toCopy = min(appendLength, space()); + xmemcpy (&buf[len], appendBuffer, toCopy); + len += toCopy; + return toCopy; +} + +size_t +ESISegment::append(ESISegment::Pointer from) +{ + return append (from->buf, from->len); +} + +ESISegment const * +ESISegment::tail() const +{ + ESISegment const *result = this; + + while (result->next.getRaw()) + result = result->next.getRaw(); + + return result; +} + +ESISegment * +ESISegment::tail() +{ + ESISegment::Pointer result = this; + + while (result->next.getRaw()) + result = result->next; + + return result.getRaw(); +} + +ESISegment::ESISegment() : len(0), next(NULL) +{} + +ESISegment::ESISegment(ESISegment const &old) : len (0), next(NULL) +{ + append (old.buf, old.len); +} + +void +ESISegment::dumpToLog() const +{ + ESISegment::Pointer temp = this; + + while (temp.getRaw()) { + temp->dumpOne(); + temp = temp->next; + } +} + +void +ESISegment::dumpOne() const +{ + String temp; + temp.limitInit(buf, len); + debug (86, 9) ("ESISegment::dumpOne: \"%s\"\n", temp.buf()); +} diff --git a/src/ESISegment.h b/src/ESISegment.h new file mode 100644 index 0000000000..2825736067 --- /dev/null +++ b/src/ESISegment.h @@ -0,0 +1,78 @@ +/* + * $Id: ESISegment.h,v 1.1 2003/03/10 04:56:36 robertc Exp $ + * + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + */ + +#ifndef SQUID_ESISEGMENT_H +#define SQUID_ESISEGMENT_H + +/* TODO: Factor the store memory segment management into a reusable code block + * or perhaps use membuffers here? + */ + +#include "RefCount.h" + +class ESISegment : public RefCountable +{ + +public: + typedef RefCount Pointer; + static void ListAppend (Pointer &, char const *, size_t); + static void ListTransfer (Pointer &from, Pointer &to); + void *operator new (size_t byteCount); + void operator delete (void *address); + void deleteSelf() const; + + ESISegment(); + ESISegment(ESISegment const &); + ESISegment::Pointer cloneList() const; + char *listToChar() const; + void listAppend (char const *s, size_t length); + void adsorbList (ESISegment::Pointer from); + size_t space() const; + + + char buf[HTTP_REQBUF_SZ]; + size_t len; /* how much data has been pushed into this */ + Pointer next; + size_t append(char const *, size_t); + size_t append (Pointer); + ESISegment const *tail() const; + ESISegment *tail(); + void dumpToLog() const; + +private: + size_t listLength()const; + void dumpOne() const; +}; + +extern void ESISegmentFreeList (ESISegment::Pointer &head); + +#endif /* SQUID_ESISEGMENT_H */ diff --git a/src/ESISequence.cc b/src/ESISequence.cc new file mode 100644 index 0000000000..3b06c47e30 --- /dev/null +++ b/src/ESISequence.cc @@ -0,0 +1,417 @@ +/* + * $Id: ESISequence.cc,v 1.1 2003/03/10 04:56:36 robertc Exp $ + * + * DEBUG: section 86 ESI processing + * AUTHOR: Robert Collins + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + * Copyright (c) 2003, Robert Collins + */ + +#include "squid.h" +#include "ESISequence.h" +#include "ESILiteral.h" +#include "ESIAttempt.h" +#include "ESIExcept.h" + +class esiExcept; + +MemPool *esiSequence::Pool = NULL; + +void +esiSequence::deleteSelf() const +{ + delete this; +} + +esiSequence::~esiSequence () +{ + debug (86,5)("esiSequence::~esiSequence %p\n", this); +} + +void * +esiSequence::operator new(size_t byteCount) +{ + assert (byteCount == sizeof (esiSequence)); + + if (!Pool) + Pool = memPoolCreate ("esiSequence", sizeof (esiSequence)); + + return memPoolAlloc (Pool); +} + +void +esiSequence::operator delete (void *address) +{ + memPoolFree (Pool, address); +} + + +esiSequence::esiSequence(esiTreeParentPtr aParent, bool incrementalFlag) : elements(), parent (aParent), mayFail_(true), failed (false), provideIncrementalData (incrementalFlag), processing (false), processingResult (ESI_PROCESS_COMPLETE), nextElementToProcess_ (0) +{} + +size_t +esiSequence::nextElementToProcess() const +{ + return nextElementToProcess_; +} + +void +esiSequence::nextElementToProcess(size_t const &aSizeT) +{ + nextElementToProcess_ = aSizeT; +} + +bool +esiSequence::finishedProcessing() const +{ + return nextElementToProcess() >= elements.size(); +} + +bool +esiSequence::mayFail () const +{ + if (failed) + return true; + + return mayFail_; +} + +void +esiSequence::wontFail() +{ + assert (!failed); + mayFail_ = false; +} + +void +esiSequence::render(ESISegment::Pointer output) +{ + /* append all processed elements, and trim processed + * and rendered elements + */ + assert (output->next == NULL); + debug (86,5)("esiSequenceRender: rendering %d elements\n", processedcount); + + for (size_t i = 0; i < processedcount; ++i) { + elements[i]->render(output); + elements.setNULL(i,i+1); + /* FIXME: pass a ESISegment ** ? */ + output = output->tail(); + } + + elements.pop_front (processedcount); + processedcount = 0; + assert (output->next == NULL); +} + +void +esiSequence::finish() +{ + debug (86,5) ("esiSequence::finish: %p is finished\n", this); + elements.setNULL(0, elements.size()); + parent = NULL; +} + + +void +esiSequence::provideData (ESISegment::Pointer data, ESIElement *source) +{ + ESIElement::Pointer lockthis = this; + + if (processing) + debug (86,5) ("esiSequence::provideData: %p data provided during processing\n", this); + + debug (86,5) ("esiSequence::provideData %p %p %p\n", this, data.getRaw(), source); + + /* when data is provided, the element *must* be completed */ + /* XXX: when the callback model is complete, + * we can introduce 'finished'. And then this rule can be + * relaxed + */ + /* find the index */ + int index = elementIndex (source); + + assert (index >= 0); + + /* remove the current node */ + elements.setNULL(index, index+1); + + /* create a literal */ + esiLiteral *temp = new esiLiteral (data); + + /* insert the literal */ + elements[index] = temp; + + /* XXX: TODO push any pushable data upwards */ + /* fail() not done */ + if (processing) + return; + + assert (process (flags.dovars) != ESI_PROCESS_FAILED); +} + +bool +esiSequence::addElement (ESIElement::Pointer element) +{ + /* add an element to the output list */ + /* Some elements require specific parents */ + + if (dynamic_cast(element.getRaw()) || + dynamic_cast(element.getRaw())) { + debug (86,0)("esiSequenceAdd: misparented Attempt or Except element (section 3.4)\n"); + return false; + } + + /* Tie literals together for efficiency */ + if (elements.size() && dynamic_cast(element.getRaw()) && + dynamic_cast(elements[elements.size() - 1].getRaw())) { + debug (86,5)("esiSequenceAdd: tying Literals %p and %p together\n", elements[elements.size() - 1].getRaw(), + element.getRaw()); + ESISegment::ListTransfer (((esiLiteral *)element.getRaw())->buffer, + ((esiLiteral *)elements[elements.size() - 1].getRaw())->buffer); + return true; + } + + elements.push_back(element); + debug (86,3)("esiSequenceAdd: Added a new element, elements = %d\n", elements.size()); + return true; +} + +int +esiSequence::elementIndex(ESIElement::Pointer anElement) const +{ + for (size_t i = 0; i < elements.size(); ++i) + if (elements[i] == anElement) + return i; + + return -1; +} + +void +esiSequence::processStep(int dovars) +{ + size_t elementToProcess = nextElementToProcess(); + nextElementToProcess(elementToProcess + 1); + esiProcessResult_t tempResult = processOne(dovars, elementToProcess); + + if (processingResult < tempResult) { + debug (86,5)("esiSequence::process: processingResult was %d, increasing to %d\n", processingResult, tempResult); + processingResult = tempResult; + } +} + +esiProcessResult_t +esiSequence::processOne(int dovars, size_t index) +{ + debug (86,5)("esiSequence::process %p about to process element[%d] %p\n", this, index, elements[index].getRaw()); + + switch (elements[index]->process(dovars)) { + + case ESI_PROCESS_COMPLETE: + debug (86,5)("esiSequenceProcess: %p element %p Processed OK\n", + this, elements[index].getRaw()); + + if (index == processedcount) + /* another completely ready */ + ++processedcount; + + return ESI_PROCESS_COMPLETE; + + case ESI_PROCESS_PENDING_WONTFAIL: + debug (86,5)("esiSequenceProcess: element Processed PENDING OK\n"); + + return ESI_PROCESS_PENDING_WONTFAIL; + + case ESI_PROCESS_PENDING_MAYFAIL: + debug (86,5)("eseSequenceProcess: element Processed PENDING UNKNOWN\n"); + + return ESI_PROCESS_PENDING_MAYFAIL; + + case ESI_PROCESS_FAILED: + debug (86,5)("esiSequenceProcess: element Processed FAILED\n"); + + return ESI_PROCESS_FAILED; + + default: + fatal ("unexpected code in esiSequence::processOne\n"); + + return ESI_PROCESS_FAILED; + } +} + +esiProcessResult_t +esiSequence::process (int inheritedVarsFlag) +{ + debug (86,5) ("esiSequence::process: %p processing\n", this); + + if (processing) { + debug (86,5)("esiSequence::process: %p reentry attempt during processing\n", this); + } + + /* process as much of the list as we can, stopping only on + * faliures + */ + if (!processing || processedcount == 0) + processingResult = ESI_PROCESS_COMPLETE; + + int dovars = inheritedVarsFlag; + + if (flags.dovars) + dovars = 1; + + debug (86,5)("esiSequence::process: Processing %p with%s variable processing\n", this, dovars ? "" : "out"); + + processing = true; + + nextElementToProcess(processedcount); + + while (!finishedProcessing()) { + processStep(dovars); + + if (!processing) + return processingResult; + + if (processingResult == ESI_PROCESS_FAILED) { + elements.setNULL (0, elements.size()); + failed = true; + parent = NULL; + processing = false; + return processingResult; + } + } + + assert (processingResult != ESI_PROCESS_COMPLETE || processedcount == elements.size()); + + if (processingResult == ESI_PROCESS_COMPLETE || processingResult == ESI_PROCESS_PENDING_WONTFAIL) + wontFail(); + + if (processedcount == elements.size() || provideIncrementalData) { + ESISegment::Pointer temp(new ESISegment); + render (temp); + + if (temp->next.getRaw() || temp->len) + parent->provideData(temp, this); + else + ESISegmentFreeList (temp); + } + + /* Depends on full parsing before processing */ + if (processedcount == elements.size()) + parent = NULL; + + debug (86,5)("esiSequence::process: %p completed\n", this); + + processing = false; + + return processingResult; +} + +void +esiSequence::fail (ESIElement *source) +{ + failed = true; + + if (processing) { + debug (86,5) ("esiSequence::fail: %p failure callback during processing\n", this); + return; + } + + debug (86,5)("esiSequence::fail: %p has failed.\n", this); + parent->fail (this); + elements.setNULL(0, elements.size()); + parent = NULL; +} + +esiSequence::esiSequence(esiSequence const &old) + : processedcount (0), mayFail_(old.mayFail_), failed (old.failed), provideIncrementalData (old.provideIncrementalData), processing (false), nextElementToProcess_ (0) +{ + flags.dovars = old.flags.dovars; + parent = NULL; +} + +void +esiSequence::makeCachableElements(esiSequence const &old) +{ + for (size_t counter = 0; counter < old.elements.size(); ++counter) { + ESIElement::Pointer newElement = old.elements[counter]->makeCacheable(); + + if (newElement.getRaw()) + assert (addElement(newElement)); + } +} + +void +esiSequence::makeUsableElements(esiSequence const &old, esiVarState &newVarState) +{ + for (size_t counter = 0; counter < old.elements.size(); ++counter) { + ESIElement::Pointer newElement = old.elements[counter]->makeUsable (this, newVarState); + + if (newElement.getRaw()) + assert (addElement(newElement)); + } +} + +ESIElement::Pointer +esiSequence::makeCacheable() const +{ + debug (86,5)("esiSequence::makeCacheable: Making cachable sequence from %p\n", this); + assert (processedcount == 0); + assert (!failed); + + if (elements.size() == 0) { + debug (86,5)("esiSequence::makeCacheable: No elements in sequence %p, returning NULL\n", this); + return NULL; + } + + esiSequence * resultS = new esiSequence (*this); + ESIElement::Pointer result = resultS; + resultS->makeCachableElements(*this); + debug (86,5)("esiSequence::makeCacheable: %p created %p\n", this, result.getRaw()); + return result; +} + +ESIElement::Pointer +esiSequence::makeUsable(esiTreeParentPtr newParent, esiVarState &newVarState) const +{ + debug (86,5)("esiSequence::makeUsable: Creating usable Sequence\n"); + assert (processedcount == 0); + assert (!failed); + + if (elements.size() == 0) { + debug (86,5)("esiSequence::makeUsable: No elements in sequence %p, returning NULL\n", this); + return NULL; + } + + esiSequence * resultS = new esiSequence (*this); + ESIElement::Pointer result = resultS; + resultS->parent = newParent; + resultS->makeUsableElements(*this, newVarState); + return result; +} + diff --git a/src/ESISequence.h b/src/ESISequence.h new file mode 100644 index 0000000000..06d9ec95ef --- /dev/null +++ b/src/ESISequence.h @@ -0,0 +1,101 @@ +/* + * $Id: ESISequence.h,v 1.1 2003/03/10 04:56:36 robertc Exp $ + * + * DEBUG: section 86 ESI processing + * AUTHOR: Robert Collins + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + * Copyright (c) 2003, Robert Collins + */ + +#ifndef SQUID_ESISEQUENCE_H +#define SQUID_ESISEQUENCE_H + +#include "squid.h" +#include "ESIElement.h" +#include "ElementList.h" + +/* esiSequence */ + +class esiSequence : public ESIElement +{ + +public: + void *operator new (size_t byteCount); + void operator delete (void *address); + void deleteSelf() const; + + esiSequence(esiTreeParentPtr, bool = false); + ~esiSequence(); + + void render(ESISegment::Pointer); + bool addElement (ESIElement::Pointer); + esiProcessResult_t process (int dovars); + void provideData (ESISegment::Pointer, ESIElement*); + bool mayFail () const; + void wontFail(); + void fail(ESIElement *); + void makeCachableElements(esiSequence const &old); + Pointer makeCacheable() const; + void makeUsableElements(esiSequence const &old, esiVarState &); + Pointer makeUsable(esiTreeParentPtr, esiVarState &) const; + + ElementList elements; /* unprocessed or rendered nodes */ + size_t processedcount; + + struct + { + +int dovars: + 1; /* for esiVar */ + } + + flags; + void finish(); + +protected: + esiSequence(esiSequence const &); + esiTreeParentPtr parent; + +private: + static MemPool *Pool; + int elementIndex (ESIElement::Pointer anElement) const; + bool mayFail_; + bool failed; + esiProcessResult_t processOne(int, size_t); + bool const provideIncrementalData; + bool processing; + esiProcessResult_t processingResult; + size_t nextElementToProcess_; + size_t nextElementToProcess() const; + void nextElementToProcess(size_t const &); + bool finishedProcessing() const; + void processStep(int dovars); +}; + +#endif /* SQUID_ESISEQUENCE_H */ diff --git a/src/ElementList.h b/src/ElementList.h new file mode 100644 index 0000000000..9cdef272b1 --- /dev/null +++ b/src/ElementList.h @@ -0,0 +1,67 @@ +/* + * $Id: ElementList.h,v 1.1 2003/03/10 04:56:36 robertc Exp $ + * + * DEBUG: section 86 ESI processing + * AUTHOR: Robert Collins + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + * Copyright (c) 2003, Robert Collins + */ + +#ifndef SQUID_ELEMENTLIST_H +#define SQUID_ELEMENTLIST_H + +#include "squid.h" +#include "ESIElement.h" + +class ElementList +{ + +public: + ElementList(); + ~ElementList(); + + ESIElement::Pointer &operator[](int); + ESIElement::Pointer const &operator[](int)const; + ESIElement::Pointer * elements; /* unprocessed or rendered nodes */ + void pop_front (size_t const); + void push_back(ESIElement::Pointer &); + size_t size() const; + void setNULL (int start, int end); + + int allocedcount; + size_t allocedsize; + int elementcount; + +private: + ElementList(ElementList const &); + ElementList &operator=(ElementList const&); +}; + + +#endif /* SQUID_ELEMENTLIST_H */ diff --git a/src/HttpHdrSc.cc b/src/HttpHdrSc.cc new file mode 100644 index 0000000000..775f496768 --- /dev/null +++ b/src/HttpHdrSc.cc @@ -0,0 +1,402 @@ + +/* + * $Id: HttpHdrSc.cc,v 1.1 2003/03/10 04:56:36 robertc Exp $ + * + * DEBUG: section 90 HTTP Cache Control Header + * AUTHOR: Alex Rousskov + * Robert Collins (Surrogate-Control is derived from + * Cache-Control). + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + */ + +#include "squid.h" +#include "Store.h" +#include "HttpHeader.h" + +/* this table is used for parsing surrogate control header */ +static const HttpHeaderFieldAttrs ScAttrs[SC_ENUM_END] = + { + {"no-store", (http_hdr_type)SC_NO_STORE}, + + {"no-store-remote", (http_hdr_type)SC_NO_STORE_REMOTE}, + {"max-age", (http_hdr_type)SC_MAX_AGE}, + {"content", (http_hdr_type)SC_CONTENT}, + {"Other,", (http_hdr_type)SC_OTHER} /* ',' will protect from matches */ + }; + +HttpHeaderFieldInfo *ScFieldsInfo = NULL; + +http_hdr_sc_type &operator++ (http_hdr_sc_type &aHeader) +{ + aHeader = (http_hdr_sc_type)(++(int)aHeader); + return aHeader; +} + +int operator - (http_hdr_sc_type const &anSc, http_hdr_sc_type const &anSc2) +{ + return (int)anSc - (int)anSc2; +} + + +/* local prototypes */ +static int httpHdrScParseInit(HttpHdrSc * sc, const String * str); + +/* module initialization */ + +void +httpHdrScInitModule(void) +{ + ScFieldsInfo = httpHeaderBuildFieldsInfo(ScAttrs, SC_ENUM_END); +} + +void +httpHdrScCleanModule(void) +{ + httpHeaderDestroyFieldsInfo(ScFieldsInfo, SC_ENUM_END); + ScFieldsInfo = NULL; +} + +/* implementation */ + +HttpHdrSc * +httpHdrScCreate(void) +{ + HttpHdrSc *sc = (HttpHdrSc *)memAllocate(MEM_HTTP_HDR_SC); + return sc; +} + +/* creates an sc object from a 0-terminating string */ +HttpHdrSc * +httpHdrScParseCreate(const String * str) +{ + HttpHdrSc *sc = httpHdrScCreate(); + + if (!httpHdrScParseInit(sc, str)) { + httpHdrScDestroy(sc); + sc = NULL; + } + + return sc; +} + +/* parses a 0-terminating string and inits sc */ +static int +httpHdrScParseInit(HttpHdrSc * sc, const String * str) +{ + const char *item; + const char *p; /* '=' parameter */ + const char *pos = NULL; + const char *target = NULL; /* ;foo */ + const char *temp = NULL; /* temp buffer */ + int type; + int ilen; + int initiallen; + HttpHdrScTarget *sct; + assert(sc && str); + + /* iterate through comma separated list */ + + while (strListGetItem(str, ',', &item, &ilen, &pos)) { + initiallen = ilen; + /* decrease ilen to still match the token for '=' statements */ + + if ((p = strchr(item, '=')) && (p - item < ilen)) + ilen = p++ - item; + + /* decrease ilen to still match the token for ';' qualified non '=' statments */ + else if ((p = strchr(item, ';')) && (p - item < ilen)) + ilen = p++ - item; + + /* find type */ + type = httpHeaderIdByName(item, ilen, + ScFieldsInfo, SC_ENUM_END); + + if (type < 0) { + debug(90, 2) ("hdr sc: unknown control-directive: near '%s' in '%s'\n", item, str->buf()); + type = SC_OTHER; + } + + /* Is this a targeted directive? */ + /* TODO sometime: implement a strnrchr that looks at a substring */ + temp = xstrndup (item, initiallen + 1); + + if (!((target = strrchr (temp, ';')) && !strchr (target, '"') && *(target + 1) != '\0')) + target = NULL; + else + ++target; + + sct = httpHdrScFindTarget (sc, target); + + if (!sct) { + sct = httpHdrScTargetCreate (target); + dlinkAdd(sct, &sct->node, &sc->targets); + } + + safe_free (temp); + + if (EBIT_TEST(sct->mask, type)) { + if (type != SC_OTHER) + debug(90, 2) ("hdr sc: ignoring duplicate control-directive: near '%s' in '%s'\n", item, str->buf()); + + ScFieldsInfo[type].stat.repCount++; + + continue; + } + + /* update mask */ + EBIT_SET(sct->mask, type); + + /* post-processing special cases */ + switch (type) { + + case SC_MAX_AGE: + + if (!p || !httpHeaderParseInt(p, &sct->max_age)) { + debug(90, 2) ("sc: invalid max-age specs near '%s'\n", item); + sct->max_age = -1; + EBIT_CLR(sct->mask, type); + } + + if ((p = strchr (p, '+'))) + if (!httpHeaderParseInt(++p, &sct->max_stale)) { + debug(90, 2) ("sc: invalid max-stale specs near '%s'\n", item); + sct->max_stale = 0; + /* leave the max-age alone */ + } + + break; + + case SC_CONTENT: + + if (!p || !httpHeaderParseQuotedString(p, &sct->content)) { + debug (90, 2) ("sc: invalid content= quoted string near '%s'\n",item); + sct->content.clean(); + EBIT_CLR(sct->mask, type); + } + + default: + break; + } + } + + return sc->targets.head != NULL; +} + +void +httpHdrScDestroy(HttpHdrSc * sc) +{ + assert(sc); + + if (sc->targets.head) { + dlink_node *sct = sc->targets.head; + + while (sct) { + HttpHdrScTarget *t = (HttpHdrScTarget *)sct->data; + sct = sct->next; + dlinkDelete (&t->node, &sc->targets); + httpHdrScTargetDestroy (t); + } + } + + memFree(sc, MEM_HTTP_HDR_SC); +} + +HttpHdrSc * +httpHdrScDup(const HttpHdrSc * sc) +{ + HttpHdrSc *dup; + dlink_node *node; + assert(sc); + node = sc->targets.head; + dup = httpHdrScCreate(); + + while (node) { + HttpHdrScTarget *dupsct; + dupsct = httpHdrScTargetDup ((HttpHdrScTarget *)node->data); + dlinkAddTail (dupsct, &dupsct->node, &dup->targets); + node = node->next; + } + + return dup; +} + +void +httpHdrScTargetPackInto(const HttpHdrScTarget * sc, Packer * p) +{ + http_hdr_sc_type flag; + int pcount = 0; + assert(sc && p); + + for (flag = SC_NO_STORE; flag < SC_ENUM_END; ++flag) { + if (EBIT_TEST(sc->mask, flag) && flag != SC_OTHER) { + + /* print option name */ + packerPrintf(p, (pcount ? ", %s" : "%s"), ScFieldsInfo[flag].name.buf()); + + /* handle options with values */ + + if (flag == SC_MAX_AGE) + packerPrintf(p, "=%d", (int) sc->max_age); + + if (flag == SC_CONTENT) + packerPrintf(p, "=\"%s\"", sc->content.buf()); + + pcount++; + } + } + + if (sc->target.size()) + packerPrintf (p, ";%s", sc->target.buf()); +} + +void +httpHdrScPackInto(const HttpHdrSc * sc, Packer * p) +{ + dlink_node *node; + assert(sc && p); + node = sc->targets.head; + + while (node) { + httpHdrScTargetPackInto((HttpHdrScTarget *)node->data, p); + node = node->next; + } +} + +void +httpHdrScJoinWith(HttpHdrSc * sc, const HttpHdrSc * new_sc) +{ + assert(sc && new_sc); +#if 0 + /* RC TODO: check that both have the same target */ + + if (sc->max_age < 0) + sc->max_age = new_sc->max_age; + + /* RC TODO: copy unique missing stringlist entries */ + cc->mask |= new_cc->mask; + +#endif +} + +/* negative max_age will clean old max_Age setting */ +void +httpHdrScSetMaxAge(HttpHdrSc * sc, char const *target, int max_age) +{ + HttpHdrScTarget *sct; + assert(sc); + sct = httpHdrScFindTarget (sc, target); + + if (!sct) { + sct = httpHdrScTargetCreate (target); + dlinkAddTail (sct, &sct->node, &sc->targets); + } + + httpHdrScTargetSetMaxAge(sct, max_age); +} + +void +httpHdrScUpdateStats(const HttpHdrSc * sc, StatHist * hist) +{ + dlink_node *sct; + assert(sc); + sct = sc->targets.head; + + while (sct) { + httpHdrScTargetUpdateStats((HttpHdrScTarget *)sct->data, hist); + sct = sct->next; + } +} + +void +httpHdrScTargetStatDumper(StoreEntry * sentry, int idx, double val, double size, int count) +{ + extern const HttpHeaderStat *dump_stat; /* argh! */ + const int id = (int) val; + const int valid_id = id >= 0 && id < SC_ENUM_END; + const char *name = valid_id ? ScFieldsInfo[id].name.buf() : "INVALID"; + + if (count || valid_id) + storeAppendPrintf(sentry, "%2d\t %-20s\t %5d\t %6.2f\n", + id, name, count, xdiv(count, dump_stat->scParsedCount)); +} + +void +httpHdrScStatDumper(StoreEntry * sentry, int idx, double val, double size, int count) +{ + extern const HttpHeaderStat *dump_stat; /* argh! */ + const int id = (int) val; + const int valid_id = id >= 0 && id < SC_ENUM_END; + const char *name = valid_id ? ScFieldsInfo[id].name.buf() : "INVALID"; + + if (count || valid_id) + storeAppendPrintf(sentry, "%2d\t %-20s\t %5d\t %6.2f\n", + id, name, count, xdiv(count, dump_stat->scParsedCount)); +} + +HttpHdrScTarget * +httpHdrScFindTarget (HttpHdrSc *sc, const char *target) +{ + dlink_node *node; + assert (sc); + node = sc->targets.head; + + while (node) { + HttpHdrScTarget *sct = (HttpHdrScTarget *)node->data; + + if (target && sct->target.buf() && !strcmp (target, sct->target.buf())) + return sct; + else if (!target && !sct->target.buf()) + return sct; + + node = node->next; + } + + return NULL; +} + +HttpHdrScTarget * +httpHdrScGetMergedTarget (HttpHdrSc *sc, const char *ourtarget) +{ + HttpHdrScTarget *sctus = httpHdrScFindTarget (sc, ourtarget); + HttpHdrScTarget *sctgeneric = httpHdrScFindTarget (sc, NULL); + + if (sctgeneric || sctus) { + HttpHdrScTarget *sctusable = httpHdrScTargetCreate (NULL); + + if (sctgeneric) + httpHdrScTargetMergeWith (sctusable, sctgeneric); + + if (sctus) + httpHdrScTargetMergeWith (sctusable, sctus); + + return sctusable; + } + + return NULL; +} diff --git a/src/HttpHdrScTarget.cc b/src/HttpHdrScTarget.cc new file mode 100644 index 0000000000..11ea30229d --- /dev/null +++ b/src/HttpHdrScTarget.cc @@ -0,0 +1,150 @@ + +/* + * $Id: HttpHdrScTarget.cc,v 1.1 2003/03/10 04:56:36 robertc Exp $ + * + * DEBUG: section 90 HTTP Cache Control Header + * AUTHOR: Alex Rousskov + * Robert Collins (Surrogate-Control is derived from + * Cache-Control). + * + * SQUID Web Proxy Cache http://www.squid-cache.org/ + * ---------------------------------------------------------- + * + * Squid is the result of efforts by numerous individuals from + * the Internet community; see the CONTRIBUTORS file for full + * details. Many organizations have provided support for Squid's + * development; see the SPONSORS file for full details. Squid is + * Copyrighted (C) 2001 by the Regents of the University of + * California; see the COPYRIGHT file for full details. Squid + * incorporates software developed and/or copyrighted by other + * sources; see the CREDITS file for full details. + * + * 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, USA. + * + */ + +#include "squid.h" + +/* local prototypes */ + +/* module initialization */ + +/* implementation */ + +HttpHdrScTarget * +httpHdrScTargetCreate(char const *target) +{ + HttpHdrScTarget *sc = (HttpHdrScTarget *)memAllocate(MEM_HTTP_HDR_SCTARGET); + sc->max_age = -1; + /* max_stale is specified as 0 if not specified in the header */ + sc->target = target; + return sc; +} + +void +httpHdrScTargetDestroy(HttpHdrScTarget * sc) +{ + assert(sc); + sc->target.clean(); + sc->content.clean(); + memFree(sc, MEM_HTTP_HDR_SCTARGET); +} + +HttpHdrScTarget * +httpHdrScTargetDup(const HttpHdrScTarget * sc) +{ + HttpHdrScTarget *dup; + assert(sc); + dup = httpHdrScTargetCreate(sc->target.buf()); + dup->mask = sc->mask; + dup->max_age = sc->max_age; + dup->content = sc->content; + return dup; +} + +/* union of two targets */ +void +httpHdrScTargetJoinWith(HttpHdrScTarget * sc, const HttpHdrScTarget * new_sc) +{ + assert(sc && new_sc); + /* TODO: check both targets are the same */ + + if (sc->max_age < 0) + sc->max_age = new_sc->max_age; + + if (sc->max_stale < new_sc->max_stale) + sc->max_stale = new_sc->max_stale; + + /* RC TODO: copy unique missing content stringlist entries */ + sc->mask |= new_sc->mask; +} + +extern http_hdr_sc_type &operator++ (http_hdr_sc_type &aHeader); +extern int operator - (http_hdr_sc_type const &anSc, http_hdr_sc_type const &anSc2); +/* copies non-extant fields from new_sc to this sc */ +void +httpHdrScTargetMergeWith(HttpHdrScTarget * sc, const HttpHdrScTarget * new_sc) +{ + http_hdr_sc_type c; + assert(sc && new_sc); + /* Don't touch the target - this is used to get the operations for a + * single surrogate + */ + + for (c = SC_NO_STORE; c < SC_ENUM_END; ++c) + if (!EBIT_TEST(sc->mask, c) && EBIT_TEST(new_sc->mask,c)) { + EBIT_SET(sc->mask, c); + + switch (c) { + + case SC_MAX_AGE: + sc->max_age = new_sc->max_age; + sc->max_stale = new_sc->max_stale; + break; + + case SC_CONTENT: + assert (sc->content.size() == 0); + sc->content = new_sc->content; + break; + + default: + break; + } + } +} + +/* negative max_age will clean old max_Age setting */ +void +httpHdrScTargetSetMaxAge(HttpHdrScTarget * sc, int max_age) +{ + assert(sc); + sc->max_age = max_age; + + if (max_age >= 0) + EBIT_SET(sc->mask, SC_MAX_AGE); + else + EBIT_CLR(sc->mask, SC_MAX_AGE); +} + +void +httpHdrScTargetUpdateStats(const HttpHdrScTarget * sc, StatHist * hist) +{ + http_hdr_sc_type c; + assert(sc); + + for (c = SC_NO_STORE; c < SC_ENUM_END; ++c) + if (EBIT_TEST(sc->mask, c)) + statHistCount(hist, c); +} diff --git a/src/HttpHeader.cc b/src/HttpHeader.cc index d7a518e862..54dc20de63 100644 --- a/src/HttpHeader.cc +++ b/src/HttpHeader.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpHeader.cc,v 1.88 2003/03/09 12:29:40 robertc Exp $ + * $Id: HttpHeader.cc,v 1.89 2003/03/10 04:56:36 robertc Exp $ * * DEBUG: section 55 HTTP Header * AUTHOR: Alex Rousskov @@ -133,6 +133,8 @@ static const HttpHeaderFieldAttrs HeadersAttrs[] = #if X_ACCELERATOR_VARY {"X-Accelerator-Vary", HDR_X_ACCELERATOR_VARY, ftStr}, #endif + {"Surrogate-Capability", HDR_SURROGATE_CAPABILITY, ftStr}, + {"Surrogate-Control", HDR_SURROGATE_CONTROL, ftPSc}, {"Front-End-Https", HDR_FRONT_END_HTTPS, ftStr}, {"Other:", HDR_OTHER, ftStr} /* ':' will not allow matches */ }; @@ -176,6 +178,8 @@ static http_hdr_type ListHeadersArr[] = #if X_ACCELERATOR_VARY HDR_X_ACCELERATOR_VARY, #endif + HDR_SURROGATE_CAPABILITY, + HDR_SURROGATE_CONTROL, HDR_X_FORWARDED_FOR }; @@ -186,7 +190,7 @@ static http_hdr_type GeneralHeadersArr[] = HDR_TRANSFER_ENCODING, HDR_UPGRADE, /* HDR_TRAILER, */ - HDR_VIA + HDR_VIA, }; /* entity-headers */ @@ -212,7 +216,8 @@ static http_hdr_type ReplyHeadersArr[] = #if X_ACCELERATOR_VARY HDR_X_ACCELERATOR_VARY, #endif - HDR_X_SQUID_ERROR + HDR_X_SQUID_ERROR, + HDR_SURROGATE_CONTROL }; static HttpHeaderMask RequestHeadersMask; /* set run-time using RequestHeaders */ @@ -222,7 +227,7 @@ static http_hdr_type RequestHeadersArr[] = HDR_IF_MATCH, HDR_IF_MODIFIED_SINCE, HDR_IF_NONE_MATCH, HDR_IF_RANGE, HDR_MAX_FORWARDS, HDR_PROXY_CONNECTION, HDR_PROXY_AUTHORIZATION, HDR_RANGE, HDR_REFERER, HDR_REQUEST_RANGE, - HDR_USER_AGENT, HDR_X_FORWARDED_FOR + HDR_USER_AGENT, HDR_X_FORWARDED_FOR, HDR_SURROGATE_CAPABILITY }; /* header accounting */ @@ -308,6 +313,8 @@ httpHeaderInitModule(void) /* init dependent modules */ httpHdrCcInitModule(); + httpHdrScInitModule(); + /* register with cache manager */ cachemgrRegister("http_headers", "HTTP Header Statistics", httpHeaderStoreReport, 0, 1); @@ -319,6 +326,7 @@ httpHeaderCleanModule(void) httpHeaderDestroyFieldsInfo(Headers, HDR_ENUM_END); Headers = NULL; httpHdrCcCleanModule(); + httpHdrScCleanModule(); } static void @@ -331,6 +339,7 @@ httpHeaderStatInit(HttpHeaderStat * hs, const char *label) statHistEnumInit(&hs->hdrUCountDistr, 32); /* not a real enum */ statHistEnumInit(&hs->fieldTypeDistr, HDR_ENUM_END); statHistEnumInit(&hs->ccTypeDistr, CC_ENUM_END); + statHistEnumInit(&hs->scTypeDistr, SC_ENUM_END); } /* @@ -898,6 +907,25 @@ httpHeaderPutRange(HttpHeader * hdr, const HttpHdrRange * range) memBufClean(&mb); } +void +httpHeaderPutSc(HttpHeader *hdr, const HttpHdrSc *sc) +{ + MemBuf mb; + Packer p; + assert(hdr && sc); + /* remove old directives if any */ + httpHeaderDelById(hdr, HDR_RANGE); + /* pack into mb */ + memBufDefInit(&mb); + packerToMemInit(&p, &mb); + httpHdrScPackInto(sc, &p); + /* put */ + httpHeaderAddEntry(hdr, httpHeaderEntryCreate(HDR_SURROGATE_CONTROL, NULL, mb.buf)); + /* cleanup */ + packerClean(&p); + memBufClean(&mb); +} + /* add extension header (these fields are not parsed/analyzed/joined, etc.) */ void httpHeaderPutExt(HttpHeader * hdr, const char *name, const char *value) @@ -1028,6 +1056,26 @@ httpHeaderGetRange(const HttpHeader * hdr) return r; } +HttpHdrSc * +httpHeaderGetSc(const HttpHeader *hdr) +{ + if (!CBIT_TEST(hdr->mask, HDR_SURROGATE_CONTROL)) + return NULL; + + String s (httpHeaderGetList(hdr, HDR_SURROGATE_CONTROL)); + + HttpHdrSc *sc = httpHdrScParseCreate(&s); + + HttpHeaderStats[hdr->owner].ccParsedCount++; + + if (sc) + httpHdrScUpdateStats(sc, &HttpHeaderStats[hdr->owner].scTypeDistr); + + httpHeaderNoteParsedEntry(HDR_SURROGATE_CONTROL, s, !sc); + + return sc; +} + HttpHdrContRange * httpHeaderGetContRange(const HttpHeader * hdr) { @@ -1314,6 +1362,10 @@ httpHeaderStatDump(const HttpHeaderStat * hs, StoreEntry * e) storeAppendPrintf(e, "%2s\t %-20s\t %5s\t %6s\n", "id", "name", "count", "#/cc_field"); statHistDump(&hs->ccTypeDistr, e, httpHdrCcStatDumper); + storeAppendPrintf(e, "\nSurrogate-control directives distribution\n"); + storeAppendPrintf(e, "%2s\t %-20s\t %5s\t %6s\n", + "id", "name", "count", "#/sc_field"); + statHistDump(&hs->scTypeDistr, e, httpHdrScStatDumper); storeAppendPrintf(e, "\nNumber of fields per header distribution\n"); storeAppendPrintf(e, "%2s\t %-5s\t %5s\t %6s\n", "id", "#flds", "count", "%total"); diff --git a/src/HttpHeader.h b/src/HttpHeader.h index fb0f8335c0..57539ef6bb 100644 --- a/src/HttpHeader.h +++ b/src/HttpHeader.h @@ -1,6 +1,6 @@ /* - * $Id: HttpHeader.h,v 1.3 2003/02/21 22:50:05 robertc Exp $ + * $Id: HttpHeader.h,v 1.4 2003/03/10 04:56:36 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -46,6 +46,9 @@ struct _HttpHeaderFieldAttrs field_type type; }; +extern int httpHeaderParseQuotedString (const char *start, String *val); +extern void httpHeaderPutSc(HttpHeader *hdr, const HttpHdrSc *sc); +extern HttpHdrSc *httpHeaderGetSc(const HttpHeader *hdr); SQUIDCEXTERN void httpHeaderAddContRange(HttpHeader *, HttpHdrRangeSpec, ssize_t); #endif /* SQUID_HTTPHEADER_H */ diff --git a/src/HttpHeaderTools.cc b/src/HttpHeaderTools.cc index 9b5aea92ae..d343d8761d 100644 --- a/src/HttpHeaderTools.cc +++ b/src/HttpHeaderTools.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpHeaderTools.cc,v 1.40 2003/03/06 11:51:55 robertc Exp $ + * $Id: HttpHeaderTools.cc,v 1.41 2003/03/10 04:56:36 robertc Exp $ * * DEBUG: section 66 HTTP Header Tools * AUTHOR: Alex Rousskov @@ -338,6 +338,37 @@ httpHeaderParseSize(const char *start, ssize_t * value) } +/* Parses a quoted-string field (RFC 2616 section 2.2), complains if + * something went wrong, returns non-zero on success. + * start should point at the first ". + * RC TODO: This is too looose. We should honour the BNF and exclude CTL's + */ +int +httpHeaderParseQuotedString (const char *start, String *val) +{ + const char *end, *pos; + val->clean(); + assert (*start == '"'); + pos = start + 1; + + while (1) { + if (!(end = index (pos,'"'))) { + debug (66, 2) ("failed to parse a quoted-string header field near '%s'\n", start); + return 0; + } + + /* check for quoted-chars */ + if (*(end - 1) != '\\') { + /* done */ + val->append(start + 1, end-start-1); + return 1; + } + + /* try for the end again */ + pos = end + 1; + } +} + /* * parses a given string then packs compiled headers and compares the result * with the original, reports discrepancies diff --git a/src/HttpReply.cc b/src/HttpReply.cc index 239192b974..e646fe6db5 100644 --- a/src/HttpReply.cc +++ b/src/HttpReply.cc @@ -1,6 +1,6 @@ /* - * $Id: HttpReply.cc,v 1.57 2003/03/09 12:29:40 robertc Exp $ + * $Id: HttpReply.cc,v 1.58 2003/03/10 04:56:36 robertc Exp $ * * DEBUG: section 58 HTTP Reply (Response) * AUTHOR: Alex Rousskov @@ -462,6 +462,8 @@ httpReplyHdrCacheInit(HttpReply * rep) rep->cache_control = httpHeaderGetCc(hdr); + rep->surrogate_control = httpHeaderGetSc(hdr); + rep->content_range = httpHeaderGetContRange(hdr); rep->keep_alive = httpMsgIsPersistent(rep->sline.version, &rep->header); @@ -479,6 +481,9 @@ httpReplyHdrCacheClean(HttpReply * rep) if (rep->cache_control) httpHdrCcDestroy(rep->cache_control); + if (rep->surrogate_control) + httpHdrScDestroy(rep->surrogate_control); + if (rep->content_range) httpHdrContRangeDestroy(rep->content_range); } diff --git a/src/Makefile.am b/src/Makefile.am index 98cf3ab201..0239761640 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.am,v 1.64 2003/03/08 09:43:49 robertc Exp $ +# $Id: Makefile.am,v 1.65 2003/03/10 04:56:36 robertc Exp $ # # Uncomment and customize the following to suit your needs: # @@ -48,6 +48,33 @@ else DELAY_POOL_SOURCE = endif +ESI_ALL_SOURCE = \ + ElementList.h \ + ESI.cc \ + ESI.h \ + ESIAttempt.h \ + ESIContext.cc \ + ESIContext.h \ + ESICustomParser.cc \ + ESICustomParser.h \ + ESIElement.h \ + ESIExcept.h \ + ESIExpatParser.cc \ + ESIExpatParser.h \ + ESIExpression.cc \ + ESILiteral.h \ + ESIParser.cc \ + ESIParser.h \ + ESISegment.cc \ + ESISegment.h \ + ESISequence.cc \ + ESISequence.h +if USE_ESI + ESI_SOURCE = $(ESI_ALL_SOURCE) +else + ESI_SOURCE = +endif + if ENABLE_XPROF_STATS XPROF_STATS_SOURCE = ProfStats.cc else @@ -107,12 +134,12 @@ else ARP_ACL_SOURCE = endif -AM_CFLAGS = -Werror -Wall -AM_CXXFLAGS = -Werror -Wall +AM_CFLAGS = -Werror -Wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wcomments +AM_CXXFLAGS = -Werror -Wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wcomments SUBDIRS = fs repl auth -INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include +INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir)/lib/libTrie/include EXTRA_PROGRAMS = \ unlinkd \ @@ -150,6 +177,7 @@ EXTRA_squid_SOURCES = \ dnsserver.cc \ dns_internal.cc \ htcp.cc \ + $(ESI_ALL_SOURCE) \ ProfStats.cc \ leakfinder.cc \ snmp_core.cc \ @@ -268,6 +296,7 @@ squid_SOURCES = \ $(DNSSOURCE) \ enums.h \ errorpage.cc \ + $(ESI_SOURCE) \ ETag.cc \ event.cc \ external_acl.cc \ @@ -289,6 +318,8 @@ squid_SOURCES = \ HttpStatusLine.cc \ HttpHdrCc.cc \ HttpHdrRange.cc \ + HttpHdrSc.cc \ + HttpHdrScTarget.cc \ HttpHdrContRange.cc \ HttpHdrContRange.h \ HttpHeader.cc \ @@ -448,6 +479,7 @@ ufsdump_SOURCES = debug.cc \ StoreMetaVary.h \ access_log.cc \ acl.cc \ + ACLChecklist.cc \ $(squid_ACLSOURCES) \ ACLChecklist.cc \ asn.cc \ @@ -476,6 +508,7 @@ ufsdump_SOURCES = debug.cc \ $(DNSSOURCE) \ enums.h \ errorpage.cc \ + $(ESI_SOURCE) \ ETag.cc \ event.cc \ external_acl.cc \ @@ -493,6 +526,8 @@ ufsdump_SOURCES = debug.cc \ HttpStatusLine.cc \ HttpHdrCc.cc \ HttpHdrRange.cc \ + HttpHdrSc.cc \ + HttpHdrScTarget.cc \ HttpHdrContRange.cc \ HttpHeader.cc \ HttpHeaderTools.cc \ @@ -535,8 +570,8 @@ ufsdump_SOURCES = debug.cc \ send-announce.cc \ $(SNMPSOURCE) \ squid.h \ - tunnel.cc \ $(SSLSOURCE) \ + tunnel.cc \ stat.cc \ StatHist.cc \ String.cc \ diff --git a/src/ProfStats.cc b/src/ProfStats.cc index 8caf8dc67a..da1fdbbca2 100644 --- a/src/ProfStats.cc +++ b/src/ProfStats.cc @@ -1,6 +1,6 @@ /* - * $Id: ProfStats.cc,v 1.4 2003/02/21 22:50:06 robertc Exp $ + * $Id: ProfStats.cc,v 1.5 2003/03/10 04:56:36 robertc Exp $ * * DEBUG: section 81 CPU Profiling Routines * AUTHOR: Andres Kroonmaa @@ -61,6 +61,7 @@ static TimersArray *xprof_stats_avg5hour = NULL; static TimersArray *xprof_stats_avg24hour = NULL; static xprof_stats_node *sortlist[XPROF_LAST + 2]; +static void xprof_summary(StoreEntry * sentry); static void xprof_reset(xprof_stats_data * head) @@ -122,7 +123,7 @@ xprof_show_item(StoreEntry * sentry, const char *name, xprof_stats_data * hist) } static void -xprof_summary_item(StoreEntry * sentry, char *descr, TimersArray * list) +xprof_summary_item(StoreEntry * sentry, char const *descr, TimersArray * list) { int i; xprof_stats_node **hist; diff --git a/src/SquidString.h b/src/SquidString.h index 167fa68dba..f41ecbdff4 100644 --- a/src/SquidString.h +++ b/src/SquidString.h @@ -1,6 +1,6 @@ /* - * $Id: SquidString.h,v 1.4 2003/03/06 11:51:55 robertc Exp $ + * $Id: SquidString.h,v 1.5 2003/03/10 04:56:36 robertc Exp $ * * DEBUG: section 67 String * AUTHOR: Duane Wessels @@ -95,6 +95,7 @@ public: void reset(char const *str); void append(char const *buf, int len); void append(char const *buf); + void append(char const); void append (String const &); void absorb(String &old); _SQUID_INLINE_ const char * pos(char const *) const; diff --git a/src/Store.h b/src/Store.h index 3582d79f29..b763072d96 100644 --- a/src/Store.h +++ b/src/Store.h @@ -1,6 +1,6 @@ /* - * $Id: Store.h,v 1.8 2003/03/04 01:40:25 robertc Exp $ + * $Id: Store.h,v 1.9 2003/03/10 04:56:36 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -38,6 +38,10 @@ #include "Range.h" #include "CommRead.h" +#if ESI +#include "ESIElement.h" +#endif + class StoreClient; class MemObject; @@ -53,6 +57,8 @@ public: bool checkDeferRead(int fd) const; virtual const char *getMD5Text() const; + virtual ~StoreEntry(){} + virtual HttpReply const *getReply() const; virtual void write (StoreIOBuffer); virtual _SQUID_INLINE_ bool isEmpty() const; @@ -64,6 +70,7 @@ public: virtual void trimMemory(); void delayAwareRead(int fd, char *buf, int len, IOCB *handler, void *data); + void setNoDelay (bool const); MemObject *mem_obj; @@ -110,6 +117,11 @@ public: void *operator new(size_t byteCount); void operator delete(void *address); + void setReleaseFlag(); +#if ESI + + ESIElement::Pointer cachedESITree; +#endif private: static MemPool *pool; @@ -150,6 +162,7 @@ private: static NullStoreEntry _instance; }; +SQUIDCEXTERN size_t storeEntryInUse(); SQUIDCEXTERN off_t storeLowestMemReaderOffset(const StoreEntry * entry); SQUIDCEXTERN const char *storeEntryFlags(const StoreEntry *); SQUIDCEXTERN int storeEntryLocked(const StoreEntry *); diff --git a/src/String.cc b/src/String.cc index f9d63d6557..9ddc87bc5f 100644 --- a/src/String.cc +++ b/src/String.cc @@ -1,6 +1,6 @@ /* - * $Id: String.cc,v 1.16 2003/03/08 09:35:15 robertc Exp $ + * $Id: String.cc,v 1.17 2003/03/10 04:56:36 robertc Exp $ * * DEBUG: section 67 String * AUTHOR: Duane Wessels @@ -166,6 +166,15 @@ String::append(char const *str) append (str, strlen(str)); } +void +String::append (char chr) +{ + char myString[2]; + myString[0]=chr; + myString[1]='\0'; + append (myString, 1); +} + void String::append(String const &old) { diff --git a/src/cache_cf.cc b/src/cache_cf.cc index aeaeae1ac2..8aff02feab 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.437 2003/03/08 09:43:49 robertc Exp $ + * $Id: cache_cf.cc,v 1.438 2003/03/10 04:56:36 robertc Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -43,6 +43,9 @@ #if SQUID_SNMP #include "snmp.h" #endif +#if ESI +#include "ESIParser.h" +#endif static const char *const T_SECOND_STR = "second"; static const char *const T_MINUTE_STR = "minute"; diff --git a/src/cbdata.cc b/src/cbdata.cc index 4a69b497f0..46715e7c6f 100644 --- a/src/cbdata.cc +++ b/src/cbdata.cc @@ -1,6 +1,6 @@ /* - * $Id: cbdata.cc,v 1.55 2003/03/04 01:40:25 robertc Exp $ + * $Id: cbdata.cc,v 1.56 2003/03/10 04:56:36 robertc Exp $ * * DEBUG: section 45 Callback Data Registry * ORIGINAL AUTHOR: Duane Wessels @@ -72,9 +72,14 @@ public: #endif -typedef struct _cbdata +#define OFFSET_OF(TYPE, MEMBER) ((size_t) &(((TYPE) *)0)->(MEMBER)) + +class cbdata { + +public: #if CBDATA_DEBUG + void dump(StoreEntry *)const; #endif @@ -86,7 +91,7 @@ typedef struct _cbdata void addHistory(char const *label, char const *file, int line) const { - if (calls->count > 100) + if (calls->count > 1000) return; stackPush (calls, new CBDataCall(label, file, line)); @@ -98,15 +103,28 @@ typedef struct _cbdata Stack *calls; #endif - long y; /* cookie used while debugging */ - union { - void *pointer; - double double_float; - int integer; - } data; -} + /* cookie used while debugging */ + long cookie; + /* MUST be the last per-instance member */ + void *data; +void check() const { assert(cookie == ((long)this ^ Cookie));} + + size_t dataSize() const { return sizeof(data);} -cbdata; + static const long Cookie = (long)0xDEADBEEF; + static long MakeOffset(); + static const long Offset; +}; + +const long cbdata::Offset(MakeOffset()); + +long +cbdata::MakeOffset() +{ + cbdata *zero = (cbdata *)0L; + void **dataOffset = &zero->data; + return (long)dataOffset; +} static OBJH cbdataDump; #ifdef CBDATA_DEBUG @@ -122,12 +140,8 @@ struct CBDataIndex *cbdata_index = NULL; int cbdata_types = 0; -#define OFFSET_OF(type, member) ((int)(char *)&((type *)0L)->member) -#define CBDATA_COOKIE (long)0xDEADBEEF -#define CBDATA_CHECK(c) assert(c->y == ((long)c ^ CBDATA_COOKIE)) - void -_cbdata::deleteSelf() +cbdata::deleteSelf() { #if CBDATA_DEBUG CBDataCall *aCall; @@ -166,9 +180,9 @@ cbdataInternalInitType(cbdata_type type, const char *name, int size, FREE * free snprintf(label, strlen(name) + 20, "cbdata %s (%d)", name, (int) type); - assert(OFFSET_OF(cbdata, data) == (sizeof(cbdata) - sizeof(((cbdata *) NULL)->data))); + assert((size_t)cbdata::Offset == (sizeof(cbdata) - ((cbdata *)NULL)->dataSize())); - cbdata_index[type].pool = memPoolCreate(label, size + OFFSET_OF(cbdata, data)); + cbdata_index[type].pool = memPoolCreate(label, size + cbdata::Offset); cbdata_index[type].free_func = free_func; } @@ -231,7 +245,7 @@ cbdataInternalAlloc(cbdata_type type) p->type = type; p->valid = 1; p->locks = 0; - p->y = (long) p ^ CBDATA_COOKIE; + p->cookie = (long) p ^ cbdata::Cookie; cbdataCount++; #if CBDATA_DEBUG @@ -254,7 +268,7 @@ cbdataInternalFree(void *p) #endif { cbdata *c; - c = (cbdata *) (((char *) p) - OFFSET_OF(cbdata, data)); + c = (cbdata *) (((char *) p) - cbdata::Offset); #if CBDATA_DEBUG debug(45, 3) ("cbdataFree: %p %s:%d\n", p, file, line); @@ -263,7 +277,7 @@ cbdataInternalFree(void *p) debug(45, 3) ("cbdataFree: %p\n", p); #endif - CBDATA_CHECK(c); + c->check(); c->valid = 0; #if CBDATA_DEBUG @@ -299,7 +313,7 @@ cbdataInternalLock(const void *p) if (p == NULL) return; - c = (cbdata *) (((char *) p) - OFFSET_OF(cbdata, data)); + c = (cbdata *) (((char *) p) - cbdata::Offset); #if CBDATA_DEBUG @@ -313,7 +327,7 @@ cbdataInternalLock(const void *p) #endif - CBDATA_CHECK(c); + c->check(); assert(c->locks < 65535); @@ -332,7 +346,7 @@ cbdataInternalUnlock(const void *p) if (p == NULL) return; - c = (cbdata *) (((char *) p) - OFFSET_OF(cbdata, data)); + c = (cbdata *) (((char *) p) - cbdata::Offset); #if CBDATA_DEBUG @@ -346,7 +360,7 @@ cbdataInternalUnlock(const void *p) #endif - CBDATA_CHECK(c); + c->check(); assert(c != NULL); @@ -380,9 +394,9 @@ cbdataReferenceValid(const void *p) debug(45, 3) ("cbdataReferenceValid: %p\n", p); - c = (cbdata *) (((char *) p) - OFFSET_OF(cbdata, data)); + c = (cbdata *) (((char *) p) - cbdata::Offset); - CBDATA_CHECK(c); + c->check(); assert(c->locks > 0); @@ -418,17 +432,17 @@ cbdataInternalReferenceDoneValid(void **pp, void **tp) #if CBDATA_DEBUG void -_cbdata::dump(StoreEntry *sentry) const +cbdata::dump(StoreEntry *sentry) const { storeAppendPrintf(sentry, "%c%p\t%d\t%d\t%20s:%-5d\n", valid ? ' ' : '!', &data, type, locks, file, line); } -struct CBDataDumper : public unary_function<_cbdata, void> +struct CBDataDumper : public unary_function { CBDataDumper(StoreEntry *anEntry):where(anEntry){} - void operator()(_cbdata const &x) + void operator()(cbdata const &x) { x.dump(where); } @@ -454,7 +468,7 @@ cbdataDump(StoreEntry * sentry) MemPool *pool = cbdata_index[i].pool; if (pool) { - int obj_size = pool->obj_size - OFFSET_OF(cbdata, data); + int obj_size = pool->obj_size - cbdata::Offset; storeAppendPrintf(sentry, "%s\t%d\t%d\t%d\n", pool->label + 7, obj_size, pool->meter.inuse.level, obj_size * pool->meter.inuse.level); } } @@ -494,7 +508,7 @@ struct CBDataHistoryDumper : public CBDataDumper { CBDataHistoryDumper(StoreEntry *anEntry):CBDataDumper(anEntry),where(anEntry), callDumper(anEntry){} - void operator()(_cbdata const &x) + void operator()(cbdata const &x) { CBDataDumper::operator()(x); storeAppendPrintf(where, "\n"); diff --git a/src/cf.data.pre b/src/cf.data.pre index 3d69f41877..2b300f1b87 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.306 2003/02/22 14:59:33 hno Exp $ +# $Id: cf.data.pre,v 1.307 2003/03/10 04:56:36 robertc Exp $ # # # SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -2703,6 +2703,41 @@ DOC_START message. DOC_END +NAME: httpd_accel_surrogate_id +IFDEF: ESI +TYPE: string +LOC: Config.Accel.surrogate_id +DEFAULT: none +DOC_START + Surrogates (http://www.esi.org/architecture_spec_1.0.html) + need an identification token to allow control targeting. Because + a farm of surrogates may all perform the same tasks, they may share + an identification token. +DOC_END + +NAME: http_accel_surrogate_remote +IFDEF: ESI +COMMENT: on|off +TYPE: onoff +DEFAULT: off +LOC: Config.onoff.surrogate_is_remote +DOC_START + Remote surrogates (such as those in a CDN) honour Surrogate-Control: no-store-remote. + Set this to on to have squid behave as a remote surrogate. +DOC_END + +NAME: esi_parser +IFDEF: ESI +COMMENT: expat|custom +TYPE: string +LOC: ESIParser::Type +DEFAULT: custom +DOC_START + ESI markup is not strictly XML compatible. The custom ESI parser + will give higher performance, but cannot handle non ASCII character + encodings. +DOC_END + COMMENT_START MISCELLANEOUS ----------------------------------------------------------------------------- diff --git a/src/clientStream.cc b/src/clientStream.cc index c91656d183..7b16df5a60 100644 --- a/src/clientStream.cc +++ b/src/clientStream.cc @@ -1,6 +1,6 @@ /* - * $Id: clientStream.cc,v 1.5 2003/02/21 22:50:07 robertc Exp $ + * $Id: clientStream.cc,v 1.6 2003/03/10 04:56:37 robertc Exp $ * * DEBUG: section 87 Client-side Stream routines. * AUTHOR: Robert Collins @@ -146,8 +146,6 @@ clientStreamInit(dlink_list * list, CSR * func, CSD * rdetach, CSS * readstatus, * Doesn't actually insert at head. Instead it inserts one *after* * head. This is because HEAD is a special node, as is tail * This function is not suitable for inserting the real HEAD. - * TODO: should we always initalise the buffers and length, to - * allow safe insertion of elements in the downstream cycle? */ void clientStreamInsertHead(dlink_list * list, CSR * func, CSCB * callback, @@ -163,7 +161,12 @@ clientStreamInsertHead(dlink_list * list, CSR * func, CSCB * callback, debug(87, 3) ("clientStreamInsertHead: Inserted node %p with data %p after head\n", temp, data); + + if (list->head->next) + temp->readBuffer = ((clientStreamNode *)list->head->next->data)->readBuffer; + dlinkAddAfter(temp, &temp->node, list->head, list); + cbdataReference(temp); } @@ -276,22 +279,23 @@ clientStreamFree(void *foo) if (thisObject->node.next || thisObject->node.prev) { dlinkDelete(&thisObject->node, thisObject->head); } + } -_clientStreamNode * -_clientStreamNode::prev() const +clientStreamNode * +clientStreamNode::prev() const { if (node.prev) - return (_clientStreamNode *)node.prev->data; + return (clientStreamNode *)node.prev->data; else return NULL; } -_clientStreamNode * -_clientStreamNode::next() const +clientStreamNode * +clientStreamNode::next() const { if (node.next) - return (_clientStreamNode *)node.next->data; + return (clientStreamNode *)node.next->data; else return NULL; } diff --git a/src/clientStream.h b/src/clientStream.h index 7cb4e5615c..b3c2b9265f 100644 --- a/src/clientStream.h +++ b/src/clientStream.h @@ -1,6 +1,6 @@ /* - * $Id: clientStream.h,v 1.4 2003/02/21 22:50:07 robertc Exp $ + * $Id: clientStream.h,v 1.5 2003/03/10 04:56:37 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -36,7 +36,7 @@ #include "StoreIOBuffer.h" -typedef struct _clientStreamNode clientStreamNode; +class clientStreamNode; class ClientHttpRequest; /* client stream read callback */ @@ -48,15 +48,12 @@ typedef void CSD(clientStreamNode *, ClientHttpRequest *); typedef clientStream_status_t CSS(clientStreamNode *, ClientHttpRequest *); -struct _clientStreamNode +class clientStreamNode { -#ifdef __cplusplus public: - _clientStreamNode *prev() const; - _clientStreamNode *next() const; -#endif - + clientStreamNode *prev() const; + clientStreamNode *next() const; dlink_node node; dlink_list *head; /* sucks I know, but hey, the interface is limited */ CSR *readfunc; diff --git a/src/client_side.cc b/src/client_side.cc index 4f1d14b504..bd1fc29fb1 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.630 2003/03/07 04:40:59 adrian Exp $ + * $Id: client_side.cc,v 1.631 2003/03/10 04:56:37 robertc Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -2445,7 +2445,7 @@ clientAbortBody(request_t * request) requestUnlink(request); } - clientReadBodyAbortHandler(NULL, -1, conn); /* Install abort handler */ + clientReadBodyAbortHandler(NULL, -1, conn); /* Install abort handler */ /* clientProcessBody() */ return 1; /* Aborted */ } diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index 699b94cc59..dfe579d52c 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.cc,v 1.44 2003/03/06 11:51:55 robertc Exp $ + * $Id: client_side_reply.cc,v 1.45 2003/03/10 04:56:37 robertc Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -41,6 +41,9 @@ #include "clientStream.h" #include "authenticate.h" +#if ESI +#include "ESI.h" +#endif #include "MemObject.h" #include "client_side_request.h" #include "ACLChecklist.h" @@ -1920,14 +1923,12 @@ clientReplyContext::pushStreamData(StoreIOBuffer const &result, char *source) flags.complete = 1; } - /* REMOVE ME: Only useful for two node streams */ - assert(result.offset - headers_sz == ((clientStreamNode *) http->client_stream.tail->data)->readBuffer.offset); - + assert(result.offset - headers_sz == next()->readBuffer.offset); tempBuffer.offset = result.offset - headers_sz; - tempBuffer.length = result.length; - tempBuffer.data = source; + if (tempBuffer.length) + tempBuffer.data = source; clientStreamCallback((clientStreamNode*)http->client_stream.head->data, http, NULL, tempBuffer); @@ -2030,7 +2031,17 @@ clientReplyContext::processReply(bool accessAllowed) debug(88,3) ("clientSendMoreData: Appending %d bytes after %d bytes of headers\n", (int) body_size, rep->hdr_sz); +#if ESI + if (http->flags.accel && rep->sline.status != HTTP_FORBIDDEN && + !clientAlwaysAllowResponse(rep->sline.status) && + esiEnableProcessing(rep)) { + debug(88, 2) ("Enabling ESI processing for %s\n", http->uri); + clientStreamInsertHead(&http->client_stream, esiStreamRead, + esiProcessStream, esiStreamDetach, esiStreamStatus, NULL); + } + +#endif if (http->request->method == METHOD_HEAD) { /* do not forward body for HEAD replies */ body_size = 0; @@ -2157,6 +2168,7 @@ clientReplyContext::sendMoreData (StoreIOBuffer result) holdingBuffer = result; processReplyAccess (); return; + } else if (reqofs < HTTP_REQBUF_SZ && entry->store_status == STORE_PENDING) { waitForMoreData(result); return; diff --git a/src/comm.cc b/src/comm.cc index ad5e207e0b..99c42c76c6 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.371 2003/03/08 16:18:45 robertc Exp $ + * $Id: comm.cc,v 1.372 2003/03/10 04:56:37 robertc Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -217,7 +217,7 @@ public: protected: CommCommonCallback result; - friend void _comm_close(int fd, char *file, int line); + friend void _comm_close(int fd, char const *file, int line); friend void comm_calliocallback(void); private: @@ -294,7 +294,7 @@ private: struct _fd_debug_t { - char *close_file; + char const *close_file; int close_line; }; @@ -839,7 +839,7 @@ comm_read_cancel(int fd, IOCB *callback, void *data) * + accept() poll time is 250ms */ void -fdc_open(int fd, unsigned int type, char *desc) +fdc_open(int fd, unsigned int type, char const *desc) { assert(fdc_table[fd].active == 0); @@ -1732,7 +1732,7 @@ AcceptFD::doCallback(int fd, int newfd, comm_err_t errcode, int xerrno, Connecti * DeferredReadManager. */ void -_comm_close(int fd, char *file, int line) +_comm_close(int fd, char const *file, int line) { fde *F = NULL; dlink_node *node; diff --git a/src/comm.h b/src/comm.h index 1f263b84ac..c013fe3ab3 100644 --- a/src/comm.h +++ b/src/comm.h @@ -18,7 +18,7 @@ extern int comm_has_pending_read_callback(int fd); extern bool comm_has_pending_read(int fd); extern void comm_read(int fd, char *buf, int len, IOCB *handler, void *data); extern void comm_read_cancel(int fd, IOCB *callback, void *data); -extern void fdc_open(int fd, unsigned int type, char *desc); +extern void fdc_open(int fd, unsigned int type, char const *desc); extern int comm_udp_recvfrom(int fd, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen); diff --git a/src/enums.h b/src/enums.h index e3b642d329..5584377290 100644 --- a/src/enums.h +++ b/src/enums.h @@ -1,6 +1,6 @@ /* - * $Id: enums.h,v 1.229 2003/03/06 11:51:55 robertc Exp $ + * $Id: enums.h,v 1.230 2003/03/10 04:56:38 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -93,6 +93,7 @@ typedef enum { ERR_ONLY_IF_CACHED_MISS, /* failure to satisfy only-if-cached request */ ERR_TOO_BIG, TCP_RESET, + ERR_ESI, /* Failure to perform ESI processing */ ERR_MAX } err_type; @@ -189,6 +190,8 @@ typedef enum { #if X_ACCELERATOR_VARY HDR_X_ACCELERATOR_VARY, #endif + HDR_SURROGATE_CAPABILITY, + HDR_SURROGATE_CONTROL, HDR_FRONT_END_HTTPS, HDR_OTHER, HDR_ENUM_END @@ -211,6 +214,15 @@ typedef enum { CC_ENUM_END } http_hdr_cc_type; +typedef enum { + SC_NO_STORE, + SC_NO_STORE_REMOTE, + SC_MAX_AGE, + SC_CONTENT, + SC_OTHER, + SC_ENUM_END +} http_hdr_sc_type; + /* possible types for http header fields */ typedef enum { ftInvalid = HDR_ENUM_END, /* to catch nasty errors with hdr_id<->fld_type clashes */ @@ -221,6 +233,7 @@ typedef enum { ftPCc, ftPContRange, ftPRange, + ftPSc, ftDate_1123_or_ETag } field_type; @@ -549,6 +562,8 @@ typedef enum { MEM_HELPER_STATEFUL_REQUEST, MEM_HTTP_HDR_CC, MEM_HTTP_HDR_CONTENT_RANGE, + MEM_HTTP_HDR_SC, + MEM_HTTP_HDR_SCTARGET, MEM_IPCACHE_ENTRY, MEM_MD5_DIGEST, MEM_NETDBENTRY, diff --git a/src/errorpage.cc b/src/errorpage.cc index 33b2304601..05a6a49f82 100644 --- a/src/errorpage.cc +++ b/src/errorpage.cc @@ -1,6 +1,6 @@ /* - * $Id: errorpage.cc,v 1.187 2003/03/09 12:29:41 robertc Exp $ + * $Id: errorpage.cc,v 1.188 2003/03/10 04:56:38 robertc Exp $ * * DEBUG: section 4 Error Generation * AUTHOR: Duane Wessels @@ -475,6 +475,8 @@ errorStateFree(ErrorState * err) err->auth_user_request = NULL; + safe_free(err->err_msg); + cbdataFree(err); } @@ -584,6 +586,7 @@ errorDump(ErrorState * err, MemBuf * mb) * w - cachemgr email address x * W - error data (to be included in the mailto links) * z - dns server error message x + * Z - Preformatted error message x */ static const char * @@ -779,6 +782,14 @@ errorConvert(char token, ErrorState * err) break; + case 'Z': + if (err->err_msg) + p = err->err_msg; + else + p = "[unknown]"; + + break; + case '%': p = "%"; diff --git a/src/http.cc b/src/http.cc index 82eb66f080..d28580fa36 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.412 2003/03/06 06:21:38 robertc Exp $ + * $Id: http.cc,v 1.413 2003/03/10 04:56:38 robertc Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -287,6 +287,48 @@ httpMaybeRemovePublic(StoreEntry * e, http_status status) } } +void +HttpStateData::processSurrogateControl(HttpReply *reply) +{ +#if ESI + + if (request->flags.accelerated && reply->surrogate_control) { + HttpHdrScTarget *sctusable = + httpHdrScGetMergedTarget(reply->surrogate_control, + Config.Accel.surrogate_id); + + if (sctusable) { + if (EBIT_TEST(sctusable->mask, SC_NO_STORE) || + (Config.onoff.surrogate_is_remote + && EBIT_TEST(sctusable->mask, SC_NO_STORE_REMOTE))) { + surrogateNoStore = true; + httpMakePrivate(entry); + } + + /* The HttpHeader logic cannot tell if the header it's parsing is a reply to an + * accelerated request or not... + * Still, this is an abtraction breach. - RC + */ + if (sctusable->max_age != -1) { + if (sctusable->max_age < sctusable->max_stale) + reply->expires = reply->date + sctusable->max_age; + else + reply->expires = reply->date + sctusable->max_stale; + + /* And update the timestamps */ + storeTimestampsSet(entry); + } + + /* We ignore cache-control directives as per the Surrogate specification */ + ignoreCacheControl = true; + + httpHdrScTargetDestroy(sctusable); + } + } + +#endif +} + int cacheControlAllowsCaching(HttpHdrCc *cc) { @@ -314,9 +356,23 @@ httpCachableReply(HttpStateData * httpState) const int cc_mask = (rep->cache_control) ? rep->cache_control->mask : 0; const char *v; + if (httpState->surrogateNoStore) + return 0; + if (!cacheControlAllowsCaching(rep->cache_control)) return 0; + if (!httpState->ignoreCacheControl) { + if (EBIT_TEST(cc_mask, CC_PRIVATE)) + return 0; + + if (EBIT_TEST(cc_mask, CC_NO_CACHE)) + return 0; + + if (EBIT_TEST(cc_mask, CC_NO_STORE)) + return 0; + } + if (httpState->request->flags.auth) { /* * Responses to requests with authorization may be cached @@ -596,6 +652,7 @@ HttpStateData::processReplyHeader(const char *buf, int size) /* Parse headers into reply structure */ /* what happens if we fail to parse here? */ httpReplyParse(reply, reply_hdr, hdr_len); + processSurrogateControl (reply); /* TODO: we need our own reply * in the httpState, as we probably don't want to replace * the storeEntry with interim headers */ @@ -656,7 +713,7 @@ HttpStateData::processReplyHeader(const char *buf, int size) break; } - if (entry->getReply()->cache_control) { + if (!ignoreCacheControl && entry->getReply()->cache_control) { if (EBIT_TEST(entry->getReply()->cache_control->mask, CC_PROXY_REVALIDATE)) EBIT_SET(entry->flags, ENTRY_REVALIDATE); else if (EBIT_TEST(entry->getReply()->cache_control->mask, CC_MUST_REVALIDATE)) @@ -1068,7 +1125,7 @@ httpBuildRequestHeader(request_t * request, while ((e = httpHeaderGetEntry(hdr_in, &pos))) copyOneHeaderFromClientsideRequestToUpstreamRequest(e, strConnection, request, orig_request, hdr_out, we_do_ranges, flags); - /* Abstraction break: We should interpret myultipart/byterange responses + /* Abstraction break: We should interpret multipart/byterange responses * into offset-length data, and this works around our inability to do so. */ if (!we_do_ranges && orig_request->multipartRangeRequest()) { @@ -1083,7 +1140,8 @@ httpBuildRequestHeader(request_t * request, /* append Via */ if (Config.onoff.via) { - String strVia = httpHeaderGetList(hdr_in, HDR_VIA); + String strVia; + strVia = httpHeaderGetList(hdr_in, HDR_VIA); snprintf(bbuf, BBUF_SZ, "%d.%d %s", orig_request->http_ver.major, orig_request->http_ver.minor, ThisCache); @@ -1092,6 +1150,17 @@ httpBuildRequestHeader(request_t * request, strVia.clean(); } +#if ESI + { + /* Append Surrogate-Capabilities */ + String strSurrogate (httpHeaderGetList(hdr_in, HDR_SURROGATE_CAPABILITY)); + snprintf(bbuf, BBUF_SZ, "%s=Surrogate/1.0 ESI/1.0", + Config.Accel.surrogate_id); + strListAdd(&strSurrogate, bbuf, ','); + httpHeaderPutStr(hdr_out, HDR_SURROGATE_CAPABILITY, strSurrogate.buf()); + } +#endif + /* append X-Forwarded-For */ strFwd = httpHeaderGetList(hdr_in, HDR_X_FORWARDED_FOR); @@ -1190,7 +1259,8 @@ httpBuildRequestHeader(request_t * request, cc = httpHdrCcCreate(); if (!EBIT_TEST(cc->mask, CC_MAX_AGE)) { - const char *url = entry ? storeUrl(entry) : urlCanonical(orig_request); + const char *url = + entry ? storeUrl(entry) : urlCanonical(orig_request); httpHdrCcSetMaxAge(cc, getMaxAge(url)); if (request->urlpath.size()) @@ -1409,7 +1479,8 @@ httpSendRequest(HttpStateData * httpState) peer *p = httpState->_peer; CWCB *sendHeaderDone; - debug(11, 5) ("httpSendRequest: FD %d: httpState %p.\n", httpState->fd, httpState); + debug(11, 5) ("httpSendRequest: FD %d: httpState %p.\n", httpState->fd, + httpState); if (httpState->orig_request->body_connection) sendHeaderDone = httpSendRequestEntity; @@ -1438,7 +1509,8 @@ httpSendRequest(HttpStateData * httpState) httpState->flags.keepalive = 1; else if (p->stats.n_keepalives_sent < 10) httpState->flags.keepalive = 1; - else if ((double) p->stats.n_keepalives_recv / (double) p->stats.n_keepalives_sent > 0.50) + else if ((double) p->stats.n_keepalives_recv / + (double) p->stats.n_keepalives_sent > 0.50) httpState->flags.keepalive = 1; if (httpState->_peer) { @@ -1471,6 +1543,8 @@ httpStart(FwdState * fwd) storeUrl(fwd->entry)); CBDATA_INIT_TYPE(HttpStateData); httpState = cbdataAlloc(HttpStateData); + httpState->ignoreCacheControl = false; + httpState->surrogateNoStore = false; storeLockObject(fwd->entry); httpState->fwd = fwd; httpState->entry = fwd->entry; @@ -1546,8 +1620,7 @@ httpSendRequestEntityDone(int fd, void *data) { HttpStateData *httpState = static_cast(data); ACLChecklist ch; - debug(11, 5) ("httpSendRequestEntityDone: FD %d\n", - fd); + debug(11, 5) ("httpSendRequestEntityDone: FD %d\n", fd); ch.request = requestLink(httpState->request); if (!Config.accessList.brokenPosts) { diff --git a/src/http.h b/src/http.h index ffd9af09bb..646752aa23 100644 --- a/src/http.h +++ b/src/http.h @@ -1,6 +1,6 @@ /* - * $Id: http.h,v 1.6 2003/03/04 01:40:28 robertc Exp $ + * $Id: http.h,v 1.7 2003/03/10 04:56:38 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -62,6 +62,9 @@ public: int do_next_read; size_t read_sz; char buf[SQUID_TCP_SO_RCVBUF]; + bool ignoreCacheControl; + bool surrogateNoStore; + void processSurrogateControl(HttpReply *); private: enum ConnectionStatus { diff --git a/src/mem.cc b/src/mem.cc index 7f5dfd3c0e..f092f70f48 100644 --- a/src/mem.cc +++ b/src/mem.cc @@ -1,6 +1,6 @@ /* - * $Id: mem.cc,v 1.77 2003/03/09 12:29:41 robertc Exp $ + * $Id: mem.cc,v 1.78 2003/03/10 04:56:38 robertc Exp $ * * DEBUG: section 13 High Level Memory Pool Management * AUTHOR: Harvest Derived @@ -401,6 +401,8 @@ Mem::Init(void) memDataInit(MEM_DWRITE_Q, "dwrite_q", sizeof(dwrite_q), 0); memDataInit(MEM_FWD_SERVER, "FwdServer", sizeof(FwdServer), 0); memDataInit(MEM_HTTP_HDR_CC, "HttpHdrCc", sizeof(HttpHdrCc), 0); + memDataInit(MEM_HTTP_HDR_SC, "HttpHdrSc", sizeof(HttpHdrSc), 0); + memDataInit(MEM_HTTP_HDR_SCTARGET, "HttpHdrScTarget", sizeof(HttpHdrScTarget), 0); memDataInit(MEM_HTTP_HDR_CONTENT_RANGE, "HttpHdrContRange", sizeof(HttpHdrContRange), 0); memDataInit(MEM_NETDBENTRY, "netdbEntry", sizeof(netdbEntry), 0); memDataInit(MEM_NET_DB_NAME, "net_db_name", sizeof(net_db_name), 0); diff --git a/src/protos.h b/src/protos.h index 068c317623..97d8cf1a3a 100644 --- a/src/protos.h +++ b/src/protos.h @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.472 2003/03/08 09:35:15 robertc Exp $ + * $Id: protos.h,v 1.473 2003/03/10 04:56:38 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -132,7 +132,7 @@ extern int comm_listen(int fd); SQUIDCEXTERN int commSetNonBlocking(int fd); SQUIDCEXTERN int commUnsetNonBlocking(int fd); SQUIDCEXTERN void commSetCloseOnExec(int fd); -extern void _comm_close(int fd, char *file, int line); +extern void _comm_close(int fd, char const *file, int line); #define comm_close(fd) (_comm_close((fd), __FILE__, __LINE__)) SQUIDCEXTERN void comm_reset_close(int fd); #if LINGERING_CLOSE @@ -345,6 +345,33 @@ SQUIDCEXTERN void httpHdrCcSetSMaxAge(HttpHdrCc * cc, int s_maxage); SQUIDCEXTERN void httpHdrCcUpdateStats(const HttpHdrCc * cc, StatHist * hist); SQUIDCEXTERN void httpHdrCcStatDumper(StoreEntry * sentry, int idx, double val, double size, int count); +/* Http Surrogate Control Header Field */ +extern void httpHdrScStatDumper(StoreEntry * sentry, int idx, double val, double size, int count); +extern void httpHdrScInitModule (void); +extern void httpHdrScCleanModule (void); +extern HttpHdrSc *httpHdrScCreate(void); +extern HttpHdrSc *httpHdrScParseCreate(String const *); +extern void httpHdrScDestroy(HttpHdrSc * sc); +extern HttpHdrSc *httpHdrScDup(const HttpHdrSc * sc); +extern void httpHdrScPackInto(const HttpHdrSc * sc, Packer * p); +extern void httpHdrScJoinWith(HttpHdrSc *, const HttpHdrSc *); +extern void httpHdrScSetMaxAge(HttpHdrSc *, char const *, int); +extern void httpHdrScUpdateStats(const HttpHdrSc *, StatHist *); +extern HttpHdrScTarget * httpHdrScFindTarget (HttpHdrSc *sc, const char *target); +extern HttpHdrScTarget * httpHdrScGetMergedTarget (HttpHdrSc *sc, const char *ourtarget); + +/* Http Surrogate control header field 'targets' */ +extern HttpHdrScTarget * httpHdrScTargetCreate (const char *); +extern void httpHdrScTargetDestroy(HttpHdrScTarget *); +extern HttpHdrScTarget *httpHdrScTargetDup(const HttpHdrScTarget *); +extern void httpHdrScTargetPackInto(const HttpHdrScTarget *, Packer *); +extern void httpHdrScTargetSetMaxAge(HttpHdrScTarget *, int); +extern void httpHdrScTargetUpdateStats(const HttpHdrScTarget *, StatHist *); +extern void httpHdrScTargetJoinWith(HttpHdrScTarget *, const HttpHdrScTarget *); +extern void httpHdrScTargetMergeWith(HttpHdrScTarget *, const HttpHdrScTarget *); +extern void httpHdrScTargetStatDumper(StoreEntry * sentry, int idx, double val, double size, int count); + + /* Http Header Tools */ SQUIDCEXTERN HttpHeaderFieldInfo *httpHeaderBuildFieldsInfo(const HttpHeaderFieldAttrs * attrs, int count); SQUIDCEXTERN void httpHeaderDestroyFieldsInfo(HttpHeaderFieldInfo * info, int count); diff --git a/src/squid.h b/src/squid.h index 6822479d5c..720a3633f1 100644 --- a/src/squid.h +++ b/src/squid.h @@ -1,6 +1,6 @@ /* - * $Id: squid.h,v 1.231 2003/02/23 00:08:04 robertc Exp $ + * $Id: squid.h,v 1.232 2003/03/10 04:56:38 robertc Exp $ * * AUTHOR: Duane Wessels * @@ -366,8 +366,28 @@ extern "C" #include "snprintf.h" #endif -#define XMIN(x,y) ((x)<(y)? (x) : (y)) -#define XMAX(a,b) ((a)>(b)? (a) : (b)) +template +inline A const & +min(A const & lhs, A const & rhs) +{ + if (rhs < lhs) + return rhs; + + return lhs; +} + +#define XMIN(x,y) (min (x,y)) +template +inline A const & +max(A const & lhs, A const & rhs) +{ + if (rhs > lhs) + return rhs; + + return lhs; +} + +#define XMAX(a,b) (max (a,b)) /* * Squid source files should not call these functions directly. diff --git a/src/store.cc b/src/store.cc index f89c9c1fe0..00d0d97efd 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.563 2003/03/08 09:35:15 robertc Exp $ + * $Id: store.cc,v 1.564 2003/03/10 04:56:38 robertc Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -401,15 +401,24 @@ storeLockObject(StoreEntry * e) storeEntryReferenced(e); } +void +StoreEntry::setReleaseFlag() +{ + if (EBIT_TEST(flags, RELEASE_REQUEST)) + return; + + debug(20, 3) ("StoreEntry::setReleaseFlag: '%s'\n", getMD5Text()); + + EBIT_SET(flags, RELEASE_REQUEST); +} + void storeReleaseRequest(StoreEntry * e) { if (EBIT_TEST(e->flags, RELEASE_REQUEST)) return; - debug(20, 3) ("storeReleaseRequest: '%s'\n", e->getMD5Text()); - - EBIT_SET(e->flags, RELEASE_REQUEST); + e->setReleaseFlag(); /* * Clear cachable flag here because we might get called before @@ -434,7 +443,7 @@ storeUnlockObject(StoreEntry * e) return (int) e->lock_count; if (e->store_status == STORE_PENDING) - EBIT_SET(e->flags, RELEASE_REQUEST); + e->setReleaseFlag(); assert(storePendingNClients(e) == 0); @@ -1178,7 +1187,7 @@ storeRelease(StoreEntry * e) * we'll just call storeUnlockObject() on these. */ e->lock_count++; - EBIT_SET(e->flags, RELEASE_REQUEST); + e->setReleaseFlag(); stackPush(&LateReleaseStack, e); PROF_stop(storeRelease); return; @@ -1864,6 +1873,12 @@ NullStoreEntry::getMD5Text() const return "N/A"; } +void +NullStoreEntry::operator delete(void*) +{ + fatal ("Attempt to delete NullStoreEntry\n"); +} + char const * NullStoreEntry::getSerialisedMetaData() { diff --git a/src/structs.h b/src/structs.h index 05c43e2067..3f003f73fe 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.458 2003/03/08 09:35:16 robertc Exp $ + * $Id: structs.h,v 1.459 2003/03/10 04:56:39 robertc Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -400,6 +400,16 @@ struct _SquidConfig time_t authenticateGCInterval; time_t authenticateTTL; time_t authenticateIpTTL; + + struct + { +#if ESI + char *surrogate_id; +#endif + + } + + Accel; char *appendDomain; size_t appendDomainLen; char *debugOptions; @@ -534,6 +544,11 @@ struct _SquidConfig int ie_refresh; int vary_ignore_expire; int pipeline_prefetch; +#if ESI + + int surrogate_is_remote; +#endif + int request_entities; int check_hostnames; int via; @@ -905,6 +920,25 @@ struct _HttpHeader int len; /* length when packed, not counting terminating '\0' */ }; +/* http surogate control header field */ + +struct _HttpHdrScTarget +{ + dlink_node node; + int mask; + int max_age; + int max_stale; + String content; + String target; +}; + +struct _HttpHdrSc +{ + dlink_list targets; +}; + +/* Sync changes here with HttpReply.c */ + class HttpHdrContRange; class HttpReply @@ -923,6 +957,7 @@ public: time_t expires; String content_type; HttpHdrCc *cache_control; + HttpHdrSc *surrogate_control; HttpHdrContRange *content_range; short int keep_alive; @@ -1749,6 +1784,7 @@ unsigned int flag_cbdata: ftp; char *request_hdrs; + char *err_msg; /* Preformatted error message from the cache */ }; /* @@ -1949,9 +1985,11 @@ struct _HttpHeaderStat StatHist hdrUCountDistr; StatHist fieldTypeDistr; StatHist ccTypeDistr; + StatHist scTypeDistr; int parsedCount; int ccParsedCount; + int scParsedCount; int destroyedCount; int busyDestroyedCount; }; diff --git a/test-suite/http_range_test.cc b/test-suite/http_range_test.cc index 3a5b9feed0..1e24158c41 100644 --- a/test-suite/http_range_test.cc +++ b/test-suite/http_range_test.cc @@ -1,6 +1,6 @@ /* - * $Id: http_range_test.cc,v 1.4 2003/02/12 06:11:41 robertc Exp $ + * $Id: http_range_test.cc,v 1.5 2003/03/10 04:57:29 robertc Exp $ * * DEBUG: section 64 HTTP Range Header * AUTHOR: Alex Rousskov @@ -41,9 +41,9 @@ #include "ACLChecklist.h" /* Stub routines */ -SQUIDCEXTERN void -cachemgrRegister(const char *, const char *, OBJH *, int, int){ -} +SQUIDCEXTERN void +cachemgrRegister(const char *, const char *, OBJH *, int, int) +{} SQUIDCEXTERN void httpHeaderPutStr(HttpHeader * hdr, http_hdr_type type, const char *str) { @@ -119,8 +119,8 @@ SQUIDCEXTERN void fatal (char const *msg) } SQUIDCEXTERN ACLChecklist *aclChecklistCreate(const acl_access *, - request_t *, - const char *ident) + request_t *, + const char *ident) { fatal ("dummy function\n"); return NULL; @@ -129,7 +129,7 @@ SQUIDCEXTERN ACLChecklist *aclChecklistCreate(const acl_access *, SQUIDCEXTERN String httpHeaderGetList(const HttpHeader * hdr, http_hdr_type id) { fatal ("dummy function\n"); - return StringNull; + return String(); } SQUIDCEXTERN int httpHeaderHas(const HttpHeader * hdr, http_hdr_type type) @@ -164,14 +164,18 @@ testRangeParser(char const *rangestring) { String aString (rangestring); HttpHdrRange *range = HttpHdrRange::ParseCreate (&aString); + if (!range) - exit (1); + exit (1); + HttpHdrRange copy(*range); + assert (copy.specs.count == range->specs.count); HttpHdrRange::iterator pos = range->begin(); + assert (*pos); - + range->deleteSelf(); } @@ -180,8 +184,10 @@ rangeFromString(char const *rangestring) { String aString (rangestring); HttpHdrRange *range = HttpHdrRange::ParseCreate (&aString); + if (!range) - exit (1); + exit (1); + return range; } @@ -192,10 +198,12 @@ testRangeIter () assert (range->specs.count == 3); size_t counter = 0; HttpHdrRange::iterator i = range->begin(); + while (i != range->end()) { - ++counter; - ++i; + ++counter; + ++i; } + assert (counter == 3); i = range->begin(); assert (i - range->begin() == 0); @@ -212,37 +220,53 @@ testRangeCanonization() /* 0-3 needs a content length of 4 */ /* This passes in the extant code - but should it? */ + if (!range->canonize(3)) - exit(1); + exit(1); + assert (range->specs.count == 3); + range->deleteSelf(); - + range=rangeFromString("bytes=0-3, 1-, -2"); + assert (range->specs.count == 3); + /* 0-3 needs a content length of 4 */ if (!range->canonize(4)) - exit(1); + exit(1); + range->deleteSelf(); - + range=rangeFromString("bytes=3-6"); + assert (range->specs.count == 1); + /* 3-6 needs a content length of 4 or more */ if (range->canonize(3)) - exit(1); + exit(1); + range->deleteSelf(); range=rangeFromString("bytes=3-6"); + assert (range->specs.count == 1); + /* 3-6 needs a content length of 4 or more */ if (!range->canonize(4)) - exit(1); + exit(1); + range->deleteSelf(); - + range=rangeFromString("bytes=1-1,2-3"); + assert (range->specs.count == 2); + if (!range->canonize(4)) - exit(1); + exit(1); + assert (range->specs.count == 2); + range->deleteSelf(); } @@ -251,8 +275,8 @@ main (int argc, char **argv) { Mem::Init(); /* enable for debugging to console */ -// _db_init (NULL, NULL); -// Debug::Levels[64] = 9; + // _db_init (NULL, NULL); + // Debug::Levels[64] = 9; testRangeParser ("bytes=0-3"); testRangeParser ("bytes=-3"); testRangeParser ("bytes=1-");