c_icap-0.4.2/0000775000175000017500000000000012601747561007747 500000000000000c_icap-0.4.2/INSTALL0000644000175000017500000003661012601747524010723 00000000000000Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell command `./configure && make && make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. 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 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. Running `configure' might take a while. 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, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. 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. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. 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=c99 CFLAGS=-g 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 can use 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 `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer 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. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' 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. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= 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'. 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. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common 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 option `--target=TYPE' 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 causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf limitation. Until the limitation is lifted, you can use this workaround: CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--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. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. c_icap-0.4.2/README0000664000175000017500000000400012567550777010555 00000000000000This is NOT a real release. Must considered just as a stable snapshot from cvs repository. Read the INSTALL.txt file and web pages at http://c-icap.sourceforge.net/ for information about how to configure. COMMENTS: *c-icap is more tested in Linux systems. However compiles and runs at least in FreeBSD 6.x and possibly in other platforms. At regular times I am testing it also in solaris 10. I was not able to check this release due to a problem in my solaris machine. I will do it soon... *ipv6 support for Linux and Solaris looks that works OK but it is not enough tested. *Although I was able to compile c-icap with IPv6 support in FreeBSD 5.x-6.x it was not possible for me to make it to work. Maybe becouse of bugs in implementation maybe becouse of my inability to correctly setup the ipv6 in FreeBSD. NEW FEATURES: * ServiceAlias: They are useful in the case the icap client has hardcoded the service name. As an example in the default config file there is the avscan service alias which can used by samba vscan-icap module. * You can send commands to the c-icap server from command line using the following syndax: echo -n command_name > /var/run/c-icap.ctl Currently the following commands are implemented: "stop": The c-icap will shutdown "reconfigure": The service will reread the config file without the need for stop and restart the c-icap server. The services will be reinitialized "relog": This command causes c_icap to close and reopen the log files. This is very useful for log rotation if you have services that take a long time to start, such as srv_classify can. "srv_clamav:dbreload" : It reloads the clamav virus database Examples: - To reconfigure c-icap: echo -n "reconfigure" > /var/run/c-icap.ctl - To close and reopen all log files (for log rotation, etc.) echo -n "relog" > /var/run/c-icap.ctl - To reload clamav virusdb without stoping the c-icap: echo -n "srv_clamav:dbreload" > /var/run/c-icap.ctl c_icap-0.4.2/RECONF0000664000175000017500000000032312567550776010577 00000000000000echo trunk-`svnversion | cut -d ':' -f 2` > VERSION.m4 autoreconf -f -i -v #aclocal #autoconf ##autoheader ##cp /usr/share/libtool/ltmain.sh . #libtoolize --copy --automake -f #automake --add-missing --copy c_icap-0.4.2/decode.c0000664000175000017500000002243312567550776011275 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include "simple_api.h" #include "debug.h" #ifdef HAVE_ZLIB #include #endif #ifdef HAVE_BZLIB #include #endif unsigned char base64_table[] = { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62, 255, 255, 255, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255, 255, 0, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 255, 255, 255, 255, 255, 255, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }; int ci_base64_decode(const char *encoded, char *decoded, int len) { int i; unsigned char *str,*result; if (!encoded || !decoded || !len) return 0; str = (unsigned char *)encoded; result = (unsigned char *)decoded; for (i=len; i>3; i-=3) { /*if one of the last 4 bytes going to be proccessed is not valid just stops processing. This "if" cover the '\0' string termination character of str (because base64_table[0]=255) */ if(base64_table[*str]>63 || base64_table[*(str+1)] > 63 || base64_table[*(str+2)] > 63 ||base64_table[*(str+3)] > 63) break; /*6 bits from the first + 2 last bits from second*/ *(result++)=(base64_table[*str] << 2) | (base64_table[*(str+1)] >>4); /*last 4 bits from second + first 4 bits from third*/ *(result++)=(base64_table[*(str+1)] << 4) | (base64_table[*(str+2)] >>2); /*last 2 bits from third + 6 bits from forth */ *(result++)=(base64_table[*(str+2)] << 6) | (base64_table[*(str+3)]); str += 4; } *result='\0'; return len-i; } char *ci_base64_decode_dup(const char *encoded) { int len; char *result; len=strlen(encoded); len=((len+3)/4)*3+1; if(!(result=malloc(len*sizeof(char)))) return NULL; ci_base64_decode(encoded,result,len); return result; } /* byte1____ byte2____ byte3____ */ /* 123456 78 1234 5678 12 345678 */ /* b64_1_ b64_2__ b64_3__ b64_4_ */ #define dobase64(s, b0, b1, b2) \ s[k++] = base64_set[(b0 >> 2) & 0x3F]; \ s[k++] = base64_set[((b0 << 4) | (b1 >> 4)) & 0x3F]; \ s[k++] = base64_set[((b1 << 2) | (b2 >> 6)) & 0x3F]; \ s[k++] = base64_set[b2 & 0x3F]; int ci_base64_encode(const unsigned char *data, size_t len, char *out, size_t outlen) { int i, k; const char *base64_set = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \ "abcdefghijklmnopqrstuvwxyz"\ "0123456789"\ "+/"; for (i = 0, k=0; i < (len - 3) && k < (outlen - 4); i+=3) { dobase64(out, data[i], data[i + 1], data[i + 2]); } /*if the outlen is enough big*/ if (k < (outlen -4) && i < len) { dobase64(out, (i < len ? data[i] : 0), (i + 1 < len ? data[i + 1] : 0), (i + 2 < len ? data[i + 2] : 0)); } out[k] = '\0'; return k; } /*url decoders */ CI_DECLARE_FUNC(int) url_decoder(const char *input,char *output, int output_len) { int i, k; char str[3]; i = 0; k = 0; while ((input[i] != '\0') && (k < output_len-1)) { if (input[i] == '%'){ str[0] = input[i+1]; str[1] = input[i+2]; str[2] = '\0'; output[k] = strtol(str, NULL, 16); i = i + 3; } else if (input[i] == '+') { output[k] = ' '; i++; } else { output[k] = input[i]; i++; } k++; } output[k] = '\0'; if (k == output_len-1) return -1; return 1; } CI_DECLARE_FUNC(int) url_decoder2(char *input) { int i, k; char str[3]; i = 0; k = 0; while (input[i] != '\0') { if (input[i] == '%') { str[0] = input[i+1]; str[1] = input[i+2]; str[2] = '\0'; input[k] = strtol(str, NULL, 16); i = i + 3; } else if (input[i] == '+') { input[k] = ' '; i++; } else { input[k] = input[i]; i++; } k++; } input[k] = '\0'; return 1; } #ifdef HAVE_ZLIB #define ZIP_HEAD_CRC 0x02 /* bit 1 set: header CRC present */ #define ZIP_EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ #define ZIP_ORIG_NAME 0x08 /* bit 3 set: original file name present */ #define ZIP_COMMENT 0x10 /* bit 4 set: file comment present */ static void *alloc_a_buffer(void *op, unsigned int items, unsigned int size) { return ci_buffer_alloc(items*size); } static void free_a_buffer(void *op, void *ptr) { ci_buffer_free(ptr); } static int zlib_inflate(const char *buf, int len, char *unzipped_buf, int *unzipped_buf_len) { int ret, retriable; z_stream strm; strm.zalloc = alloc_a_buffer; strm.zfree = free_a_buffer; strm.opaque = Z_NULL; strm.avail_in = 0; strm.next_in = Z_NULL; ret = inflateInit2(&strm, 32 + 15); /*MAX_WBITS + 32 for both deflate and gzip decompress */ retriable = 1; zlib_inflate_retry: if (ret != Z_OK) { ci_debug_printf(1, "Error initializing zlib (inflateInit2 return:%d)\n", ret); return CI_ERROR; } strm.next_in = (Bytef *) buf; strm.avail_in = len; strm.avail_out = *unzipped_buf_len; strm.next_out = (Bytef *) unzipped_buf; ret = inflate(&strm, Z_NO_FLUSH); inflateEnd(&strm); switch (ret) { case Z_NEED_DICT: case Z_DATA_ERROR: if (retriable) { ret = inflateInit2(&strm, -15); retriable = 0; goto zlib_inflate_retry; } case Z_MEM_ERROR: return CI_ERROR; } /*If the data was not enough to get decompressed data return error */ if (*unzipped_buf_len == strm.avail_out && ret != Z_STREAM_END) return CI_ERROR; *unzipped_buf_len = *unzipped_buf_len - strm.avail_out; return CI_OK; } #endif #ifdef HAVE_BZLIB static void *bzalloc_a_buffer(void *op, int items, int size) { return ci_buffer_alloc(items*size); } static void bzfree_a_buffer(void *op, void *ptr) { ci_buffer_free(ptr); } static int bzlib_uncompress(const char *buf, int len, char *unzipped_buf, int *unzipped_buf_len) { /*we can use BZ2_bzBuffToBuffDecompress but we need to use our buffer_alloc interface...*/ int ret; bz_stream strm; strm.bzalloc = bzalloc_a_buffer; strm.bzfree = bzfree_a_buffer; strm.opaque = NULL; strm.avail_in = 0; strm.next_in = NULL; ret = BZ2_bzDecompressInit(&strm, 0, 0); if (ret != BZ_OK) { ci_debug_printf(1, "Error initializing bzlib (BZ2_bzDeompressInit return:%d)\n", ret); return CI_ERROR; } strm.next_in = (char *)buf; strm.avail_in = len; strm.avail_out = *unzipped_buf_len; strm.next_out = unzipped_buf; ret = BZ2_bzDecompress(&strm); BZ2_bzDecompressEnd(&strm); switch (ret) { case BZ_PARAM_ERROR: case BZ_DATA_ERROR: case BZ_DATA_ERROR_MAGIC: case BZ_MEM_ERROR: return CI_ERROR; } /*If the data was not enough to get decompressed data return error */ if (*unzipped_buf_len == strm.avail_out && ret != BZ_STREAM_END) return CI_ERROR; *unzipped_buf_len = *unzipped_buf_len - strm.avail_out; return CI_OK; } #endif int ci_uncompress_preview(int compress_method, const char *buf, int len, char *unzipped_buf, int *unzipped_buf_len) { #ifdef HAVE_BZLIB if (compress_method == CI_ENCODE_BZIP2) return bzlib_uncompress(buf, len, unzipped_buf, unzipped_buf_len); else #endif #ifdef HAVE_ZLIB return zlib_inflate(buf, len, unzipped_buf, unzipped_buf_len); #endif return CI_ERROR; } c_icap-0.4.2/aserver.c0000664000175000017500000001213312575757011011503 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include #include "net_io.h" #include "debug.h" #include "module.h" #include "log.h" #include "cfg_param.h" #include "filetype.h" #include "acl.h" #include "txtTemplate.h" #include "commands.h" /* extern char *PIDFILE; extern char *RUN_USER; extern char *RUN_GROUP; extern int PORT; */ extern int DAEMON_MODE; extern int MAX_SECS_TO_LINGER; char MY_HOSTNAME[CI_MAXHOSTNAMELEN + 1]; void init_conf_tables(); int init_body_system(); int config(int, char **); int init_server(char *address, int port, int *family); int start_server(); int store_pid(char *pidfile); int clear_pid(char *pidfile); int is_icap_running(char *pidfile); int set_running_permissions(char *user, char *group); void init_internal_lookup_tables(); void request_stats_init(); int mem_init(); void init_http_auth(); void compute_my_hostname() { char hostname[64]; struct hostent *hent; int ret; ret = gethostname(hostname, 63); if (ret == 0) { hostname[63] = '\0'; if ((hent = gethostbyname(hostname)) != NULL) { strncpy(MY_HOSTNAME, hent->h_name, CI_MAXHOSTNAMELEN); MY_HOSTNAME[CI_MAXHOSTNAMELEN] = '\0'; } else strcpy(MY_HOSTNAME, hostname); } else strcpy(MY_HOSTNAME, "localhost"); } #if ! defined(_WIN32) void run_as_daemon() { int fd; int pid, sid; pid = fork(); if (pid < 0) { ci_debug_printf(1, "Unable to fork. exiting..."); exit(-1); } if (pid > 0) exit(0); /* Change the file mode mask */ umask(0); /* Create a new SID for the child process */ sid = setsid(); if (sid < 0) { ci_debug_printf(1, "Unable to create a new SID for the main process. exiting..."); exit(-1); } /* Change the current working directory */ if ((chdir("/")) < 0) { ci_debug_printf(1, "Unable to change the working directory. exiting..."); exit(-1); } /* Direct standard file descriptors to "/dev/null"*/ fd = open("/dev/null", O_RDWR); if (fd < 0) { ci_debug_printf(1, "Unable to open '/dev/null'. exiting..."); exit(-1); } if (dup2(fd, STDIN_FILENO) < 0) { ci_debug_printf(1, "Unable to set stdin to '/dev/null'. exiting..."); exit(-1); } if (dup2(fd, STDOUT_FILENO) < 0) { ci_debug_printf(1, "Unable to set stdout to '/dev/null'. exiting..."); exit(-1); } if (dup2(fd, STDERR_FILENO) < 0) { ci_debug_printf(1, "Unable to set stderr to '/dev/null'. exiting..."); exit(-1); } close(fd); } #endif int main(int argc, char **argv) { #if ! defined(_WIN32) __log_error = (void (*)(void *, const char *,...)) log_server; /*set c-icap library log function */ #else __vlog_error = vlog_server; /*set c-icap library log function */ #endif mem_init(); init_internal_lookup_tables(); ci_acl_init(); init_http_auth(); if (init_body_system() != CI_OK) { ci_debug_printf(1, "Can not initialize body system\n"); exit(-1); } ci_txt_template_init(); ci_txt_template_set_dir(DATADIR"templates"); commands_init(); if (!(CI_CONF.MAGIC_DB = ci_magic_db_load(CI_CONF.magics_file))) { ci_debug_printf(1, "Can not load magic file %s!!!\n", CI_CONF.magics_file); } init_conf_tables(); request_stats_init(); init_modules(); init_services(); config(argc, argv); compute_my_hostname(); ci_debug_printf(2, "My hostname is:%s\n", MY_HOSTNAME); if (!log_open()) { ci_debug_printf(1, "Can not init loggers. Exiting.....\n"); exit(-1); } #if ! defined(_WIN32) if (is_icap_running(CI_CONF.PIDFILE)) { ci_debug_printf(1, "c-icap server already running!\n"); exit(-1); } if (DAEMON_MODE) run_as_daemon(); if (!set_running_permissions(CI_CONF.RUN_USER, CI_CONF.RUN_GROUP)) exit(-1); store_pid(CI_CONF.PIDFILE); #endif if (!init_server(CI_CONF.ADDRESS, CI_CONF.PORT, &(CI_CONF.PROTOCOL_FAMILY))) return -1; post_init_modules(); post_init_services(); start_server(); clear_pid(CI_CONF.PIDFILE); return 0; } c_icap-0.4.2/http_auth.c0000664000175000017500000003546612567550776012064 00000000000000/* * Copyright (C) 2004-2010 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include "request.h" #include "access.h" #include "module.h" #include "simple_api.h" #include "acl.h" #include "lookup_table.h" #include "debug.h" char *DEFAULT_AUTH_METHOD="basic"; char *REMOTE_PROXY_USER_HEADER = "X-Authenticated-User"; int ALLOW_REMOTE_PROXY_USERS = 0; int REMOTE_PROXY_USER_HEADER_ENCODED = 1; /*To be repleced by http_authenticate .......*/ int http_authorize(ci_request_t * req, char *method) { return http_authenticate(req, method); ci_debug_printf(1, "Allowing http_access.....\n"); return CI_ACCESS_ALLOW; } int call_authenticators(authenticator_module_t ** authenticators, void *method_data) { int i, res; for (i = 0; authenticators[i] != NULL; i++) { if ((res = authenticators[i]->authenticate(method_data, NULL)) != CI_ACCESS_UNKNOWN) { return res; } } return CI_ACCESS_DENY; } int http_authenticate(ci_request_t * req, char *use_method) { struct http_auth_method *auth_method; authenticator_module_t **authenticators; void *method_data; const char *auth_str, *method_str, *username; char *auth_header = NULL; int len, res; if (ALLOW_REMOTE_PROXY_USERS && !use_method) { username = ci_headers_value(req->request_header, REMOTE_PROXY_USER_HEADER); if (username) { if (REMOTE_PROXY_USER_HEADER_ENCODED) ci_base64_decode(username, req->user, MAX_USERNAME_LEN); else { strncpy(req->user, username, MAX_USERNAME_LEN); req->user[MAX_USERNAME_LEN] = '\0';; } return CI_ACCESS_ALLOW; } } if (!use_method) use_method = DEFAULT_AUTH_METHOD; auth_method = get_authentication_schema(use_method, &authenticators); if (auth_method == NULL) { ci_debug_printf(1, "Authentication method not found ...\n"); return CI_ACCESS_DENY; } res = CI_ACCESS_DENY; if ((method_str = ci_headers_value(req->request_header, "Proxy-Authorization")) != NULL) { ci_debug_printf(5, "Str is %s ....\n", method_str); if ((auth_str = strchr(method_str, ' ')) == NULL) return CI_ACCESS_DENY; len = auth_str - method_str; if (strncmp(method_str, use_method, len) != 0) return CI_ACCESS_DENY; ci_debug_printf(5, "Method is %s ....\n", method_str); auth_str++; method_data = auth_method->create_auth_data(auth_str, &username); strncpy(req->user, username, MAX_USERNAME_LEN); req->user[MAX_USERNAME_LEN] = '\0'; /*Call an authenticator now ........ */ res = call_authenticators(authenticators, method_data); /*And release data ..... */ auth_method->release_auth_data(method_data); } if (res == CI_ACCESS_DENY) { auth_header = auth_method->authentication_header(); ci_headers_add(req->xheaders, auth_header); if (auth_method->release_authentication_header) auth_method->release_authentication_header(auth_header); req->auth_required = 1; ci_debug_printf(3, "Access denied. Authentication required!!!!!\n"); } return res; } /******************************************************/ /* Group handling */ enum {INDEX_BY_GROUP, INDEX_BY_USER}; struct group_source{ char *name; int type; struct ci_lookup_table *db; struct group_source *next; }; struct group_source *GROUPS_SOURCE = NULL; int group_source_add(const char *table_name, int type){ struct group_source *gsrc_indx, *gsrc; if (type<0 || type >INDEX_BY_USER) { ci_debug_printf(1, "Non valid group lookup DB type for DB %s! (BUG?)", table_name); return 0; } gsrc = malloc(sizeof(struct group_source)); if (!gsrc) { ci_debug_printf(1, "Error allocating memory/add_group_source!\n"); return 0; } gsrc->name = strdup(table_name); if (!gsrc->name) { ci_debug_printf(1, "Error strduping/add_group_source!\n"); free(gsrc); return 0; } gsrc->type = type; gsrc->db = NULL; gsrc->next = NULL; gsrc->db = ci_lookup_table_create(gsrc->name); if (!gsrc->db) { ci_debug_printf(1, "Error creating lookup table:%s!\n", gsrc->name); free(gsrc->name); free(gsrc); return 0; } if (!gsrc->db->open(gsrc->db)) { ci_debug_printf(1, "Error opening lookup table:%s!\n", gsrc->name); ci_lookup_table_destroy(gsrc->db); free(gsrc->name); free(gsrc); return 0; } if (GROUPS_SOURCE==NULL) GROUPS_SOURCE = gsrc; else { gsrc_indx = GROUPS_SOURCE; while(gsrc_indx->next!=NULL) gsrc_indx = gsrc_indx->next; gsrc_indx->next = gsrc; } return 1; } int group_source_add_by_group(const char *table_name) { return group_source_add(table_name, INDEX_BY_GROUP); } int group_source_add_by_user(const char *table_name) { return group_source_add(table_name, INDEX_BY_USER); } void group_source_release() { struct group_source *gsrc; while (GROUPS_SOURCE != NULL) { gsrc = GROUPS_SOURCE; GROUPS_SOURCE= GROUPS_SOURCE->next; free(gsrc->name); if (gsrc->db) { ci_lookup_table_destroy(gsrc->db); } free(gsrc); } } int check_user_group(const char *user, const char *group) { struct group_source *gsrc; char **users, **groups; void *ret; int i; gsrc = GROUPS_SOURCE; while (gsrc!=NULL) { if (!gsrc->db) { ci_debug_printf(1,"The lookup-table in group source %s is not open!", gsrc->name); return 0; } if (gsrc->type == INDEX_BY_USER) { ret = gsrc->db->search(gsrc->db, (char *)user, (void ***)&groups); if (ret) { for (i=0; groups[i]!=NULL; i++) { if (strcmp(group, groups[i]) == 0) { gsrc->db->release_result(gsrc->db, (void **)groups); return 1; } } gsrc->db->release_result(gsrc->db, (void **)groups); return 0; /*user found but does not attached to group */ } } else { ret = gsrc->db->search(gsrc->db, (char *)group, (void ***)&users); if (ret) { for (i=0; users[i]!=NULL; i++) { if (strcmp(user, users[i]) == 0) { gsrc->db->release_result(gsrc->db, (void **)users); return 1; } } gsrc->db->release_result(gsrc->db, (void **)users); return 0; /*group found but user does not belong to this group*/ } } gsrc = gsrc->next; } return 0; } /******************************************************/ /* The group acl implementation */ /*defined in types_ops*/ static void *group_dup(const char *str, ci_mem_allocator_t *allocator) { char *new_s = allocator->alloc(allocator,strlen(str)+1); if(new_s) strcpy(new_s, str); return new_s; } static void group_free(void *key, ci_mem_allocator_t *allocator) { allocator->free(allocator, key); } static size_t group_len(const void *key) { return strlen((const char *)key)+1; } int group_cmp(const void *key1,const void *key2) { const char *group, *user; if (!key2) return -1; group = (const char *)key1; user = (const char *)key2; return check_user_group(user, group); } int group_equal(const void *key1,const void *key2) { const char *group, *user; if (!key2) return 0; group = (const char *)key1; user = (const char *)key2; return check_user_group(user, group); } ci_type_ops_t ci_group_ops = { group_dup, group_free, group_cmp, group_len, group_equal, }; void *get_auth(ci_request_t *req, char *param); void free_user(ci_request_t *req, void *data) { } ci_acl_type_t acl_group={ "group", get_auth, free_user, &ci_group_ops }; /******************************************************/ /* The auth acl implementation */ void *get_auth(ci_request_t *req, char *param); void free_auth(ci_request_t *req,void *data); ci_acl_type_t acl_auth={ "auth", get_auth, free_auth, &ci_str_ext_ops }; void *get_auth(ci_request_t *req, char *param) { int res; if ((res = http_authorize(req, param)) != CI_ACCESS_ALLOW) { return NULL; } ci_debug_printf(5, "Authenticated user: %s\n", req->user); return req->user; } void free_auth(ci_request_t *req, void *data) { } void init_http_auth() { ci_acl_type_add(&acl_auth); ci_acl_type_add(&acl_group); } void reset_http_auth() { group_source_release(); ci_acl_type_add(&acl_auth); ci_acl_type_add(&acl_group); } /**********************************************************************************/ /* basic auth method implementation */ static char *basic_realm = "Basic authentication"; static char *basic_authentication = NULL; /*Configuration Table .....*/ static struct ci_conf_entry basic_conf_params[] = { {"Realm", &basic_realm, ci_cfg_set_str, NULL}, {NULL, NULL, NULL, NULL} }; int basic_post_init(struct ci_server_conf *server_conf); void basic_close(); struct http_basic_auth_data *basic_create_auth_data(const char *auth_line, const char **username); void basic_release_auth_data(struct http_basic_auth_data *data); char *basic_authentication_header(); http_auth_method_t basic_auth = { "basic", NULL, /*init */ basic_post_init, basic_close, (void *(*)(const char *, const char **)) basic_create_auth_data, (void (*)(void *)) basic_release_auth_data, basic_authentication_header, NULL, /*release_authentication_header*/ basic_conf_params }; #define BASIC_HEAD_PREFIX "Proxy-Authenticate: Basic realm=" int basic_post_init(struct ci_server_conf *server_conf) { int size = strlen(BASIC_HEAD_PREFIX)+strlen(basic_realm)+3; basic_authentication = malloc((size+1)*sizeof(char)); if (!basic_authentication) return 0; snprintf(basic_authentication, size, "%s\"%s\"", BASIC_HEAD_PREFIX, basic_realm); return 1; } void basic_close() { if (basic_authentication) { free(basic_authentication); basic_authentication = NULL; } } struct http_basic_auth_data *basic_create_auth_data(const char *auth_line, const char **username) { struct http_basic_auth_data *data; char dec_http_user[MAX_USERNAME_LEN + HTTP_MAX_PASS_LEN + 2], *str; int max_decode_len = MAX_USERNAME_LEN + HTTP_MAX_PASS_LEN + 2; data = malloc(sizeof(struct http_basic_auth_data)); ci_base64_decode(auth_line, dec_http_user, max_decode_len); ci_debug_printf(5, "The proxy user is:%s (basic method) \n", dec_http_user); if ((str = strchr(dec_http_user, ':')) != NULL) { *str = '\0'; str++; strncpy(data->http_pass, str, HTTP_MAX_PASS_LEN); data->http_pass[HTTP_MAX_PASS_LEN - 1] = '\0'; } strncpy(data->http_user, dec_http_user, MAX_USERNAME_LEN); data->http_user[MAX_USERNAME_LEN] = '\0'; if (username) *username = data->http_user; return data; } void basic_release_auth_data(struct http_basic_auth_data *data) { free(data); } char *basic_authentication_header() { return basic_authentication; } /***********************************************************************/ /*file_basic authenticator ....... */ char *USERS_DB_PATH = NULL; int PASSWORDS_ENCRYPTED = 1; struct ci_lookup_table *users_db = NULL; /*Configuration Table .....*/ static struct ci_conf_entry basic_simple_db_conf_variables[] = { {"UsersDB", &USERS_DB_PATH, ci_cfg_set_str, NULL}, {NULL, NULL, NULL, NULL} }; int basic_simple_db_post_init(struct ci_server_conf *server_conf); void basic_simple_db_close(); int basic_simple_db_athenticate(struct http_basic_auth_data *data, const char *usedb); authenticator_module_t basic_simple_db = { "basic_simple_db", /* char *name; */ "basic", /* char *method; */ NULL, /* int (*init_authenticator)(); */ basic_simple_db_post_init, /* int (*post_init_authenticator)(); */ basic_simple_db_close, /* void (*close_authenticator)(); */ (int (*)(void *, const char *)) basic_simple_db_athenticate, /* int (*authenticate)(void *data); */ basic_simple_db_conf_variables /* struct ci_conf_entry *conf_table; */ }; int basic_simple_db_post_init(struct ci_server_conf *server_conf) { if (USERS_DB_PATH) { users_db = ci_lookup_table_create(USERS_DB_PATH); if (!users_db->open(users_db)) { ci_lookup_table_destroy(users_db); users_db = NULL; } } return 1; } void basic_simple_db_close() { if (users_db) { ci_lookup_table_destroy(users_db); users_db = NULL; } } /* This function is under construction ........ */ int basic_simple_db_athenticate(struct http_basic_auth_data *data, const char *usedb) { char **pass = NULL; #ifdef HAVE_CRYPT_R char *pass_enc; struct crypt_data crypt_data; #endif void *user_ret; int ret = CI_ACCESS_ALLOW; ci_debug_printf(1, "Going to authenticate user %s:%s\n", data->http_user, data->http_pass); if (!users_db) return CI_ACCESS_DENY; user_ret = users_db->search(users_db, data->http_user, (void ***)&pass); if (!user_ret) return CI_ACCESS_DENY; if(!pass || pass[0]=='\0') { if (data->http_pass[0] != '\0') ret = CI_ACCESS_DENY; else ret = CI_ACCESS_ALLOW; } #ifdef HAVE_CRYPT_R else if (PASSWORDS_ENCRYPTED) { pass_enc = crypt_r(data->http_pass, pass[0], &crypt_data); if (strcmp(pass_enc, pass[0]) != 0) ret = CI_ACCESS_DENY; } #endif else { if (strcmp(data->http_pass, pass[0]) != 0) ret = CI_ACCESS_DENY; } users_db->release_result(users_db, (void **)pass); ci_debug_printf(4, "User %s, %s\n", data->http_user, ret == CI_ACCESS_ALLOW?"authenticated":"authentication/authorization fails"); return ret; /* if (strcmp(data->http_user, "squiduser") != 0) return CI_ACCESS_UNKNOWN; if (strcmp(data->http_pass, "123") != 0) return CI_ACCESS_DENY; ci_debug_printf(1, "User authenticated ........\n"); */ return CI_ACCESS_ALLOW; } c_icap-0.4.2/modules/0000775000175000017500000000000012601747560011416 500000000000000c_icap-0.4.2/modules/sys_logger.c0000664000175000017500000001624612567550776013704 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include #include #include #include #include "log.h" #include "module.h" #include "cfg_param.h" #include "debug.h" #include "txt_format.h" #include "access.h" #include "acl.h" /************************************************************************/ /* sys_logger implementation. */ /* */ int sys_log_open(); void sys_log_close(); void sys_log_access(ci_request_t *req); void sys_log_server(const char *server, const char *format, va_list ap); char *log_ident = "c-icap: "; static int FACILITY = LOG_DAEMON; static int ACCESS_PRIORITY = LOG_INFO; static int SERVER_PRIORITY = LOG_CRIT; char *syslog_logformat = "%la %a %im %iu %is"; static ci_access_entry_t *syslog_access_list = NULL; int cfg_set_facility(const char *directive, const char **argv, void *setdata); int cfg_set_priority(const char *directive, const char **argv, void *setdata); /*int cfg_set_prefix(const char *directive,const char **argv,void *setdata);*/ int cfg_syslog_logformat(const char *directive, const char **argv, void *setdata); int cfg_syslog_access(const char *directive, const char **argv, void *setdata); /* functions declared in log.c. This file is not included in c-icap library but defined in primary c-icap binary. */ extern char *logformat_fmt(const char *name); /*Configuration Table .....*/ static struct ci_conf_entry conf_variables[] = { {"Facility", NULL, cfg_set_facility, NULL}, {"access_priority", &ACCESS_PRIORITY, cfg_set_priority, NULL}, {"server_priority", &SERVER_PRIORITY, cfg_set_priority, NULL}, {"Prefix", &log_ident, ci_cfg_set_str, NULL}, {"LogFormat", NULL, cfg_syslog_logformat}, {"access", NULL, cfg_syslog_access}, {NULL, NULL, NULL, NULL} }; CI_DECLARE_MOD_DATA logger_module_t module = { "sys_logger", NULL, sys_log_open, sys_log_close, sys_log_access, sys_log_server, conf_variables }; int cfg_set_facility(const char *directive, const char **argv, void *setdata) { if (argv == NULL || argv[0] == NULL) { // ci_debug_printf(1,"Missing arguments in directive\n"); return 0; } if (strcmp(argv[0], "daemon") == 0) FACILITY = LOG_DAEMON; else if (strcmp(argv[0], "user") == 0) FACILITY = LOG_USER; else if (strncmp(argv[0], "local", 5) == 0 && strlen(argv[0]) == 6) { switch (argv[0][5]) { case '0': FACILITY = LOG_LOCAL0; break; case '1': FACILITY = LOG_LOCAL1; break; case '2': FACILITY = LOG_LOCAL2; break; case '3': FACILITY = LOG_LOCAL3; break; case '4': FACILITY = LOG_LOCAL4; break; case '5': FACILITY = LOG_LOCAL5; break; case '6': FACILITY = LOG_LOCAL6; break; case '7': FACILITY = LOG_LOCAL7; break; } } return 1; } int cfg_set_priority(const char *directive, const char **argv, void *setdata) { if (argv == NULL || argv[0] == NULL) { ci_debug_printf(1, "Missing arguments in directive\n"); return 0; } if (!setdata) return 0; if (strcmp(argv[0], "alert") == 0) *((int *) setdata) = LOG_ALERT; else if (strcmp(argv[0], "crit") == 0) *((int *) setdata) = LOG_CRIT; else if (strcmp(argv[0], "debug") == 0) *((int *) setdata) = LOG_DEBUG; else if (strcmp(argv[0], "emerg") == 0) *((int *) setdata) = LOG_EMERG; else if (strcmp(argv[0], "err") == 0) *((int *) setdata) = LOG_ERR; else if (strcmp(argv[0], "info") == 0) *((int *) setdata) = LOG_INFO; else if (strcmp(argv[0], "notice") == 0) *((int *) setdata) = LOG_NOTICE; else if (strcmp(argv[0], "warning") == 0) *((int *) setdata) = LOG_WARNING; return 1; } int cfg_syslog_logformat(const char *directive, const char **argv, void *setdata) { if (argv == NULL || argv[0] == NULL) { ci_debug_printf(1, "Missing arguments in directive\n"); return 0; } /* the folowing return format txt or NULL. It is OK */ syslog_logformat = logformat_fmt(argv[0]); return 1; } int sys_log_open() { openlog(log_ident, 0, FACILITY); return 1; } void sys_log_close() { closelog(); if (syslog_access_list) ci_access_entry_release(syslog_access_list); syslog_access_list = NULL; } void sys_log_access(ci_request_t *req) { char logline[1024]; if (!syslog_logformat) return; if (syslog_access_list && !(ci_access_entry_match_request(syslog_access_list, req) == CI_ACCESS_ALLOW)) { ci_debug_printf(6, "Access list for syslog access does not match\n"); return; } ci_format_text(req, syslog_logformat, logline, 1024, NULL); syslog(ACCESS_PRIORITY, "%s\n", logline); } void sys_log_server(const char *server, const char *format, va_list ap) { char buf[512]; char prefix[150]; snprintf(prefix, 149, "%s, %s ", server, format); prefix[149] = '\0'; vsnprintf(buf, 511, (const char *) prefix, ap); buf[511] = '\0'; syslog(SERVER_PRIORITY, "%s", buf); } int cfg_syslog_access(const char *directive, const char **argv, void *setdata) { int argc, error; const char *acl_spec_name; if (argv[0] == NULL) { ci_debug_printf(1, "Parse error in directive %s \n", directive); return 0; } if (ci_access_entry_new(&syslog_access_list, CI_ACCESS_ALLOW) == NULL) { ci_debug_printf(1, "Error creating access list for syslog logger!\n"); return 0; } ci_debug_printf(1,"Creating new access entry for syslog module with specs:\n"); error = 0; for(argc=0; argv[argc] != NULL; argc++){ acl_spec_name = argv[argc]; /*TODO: check return type.....*/ if (!ci_access_entry_add_acl_by_name(syslog_access_list, acl_spec_name)) { ci_debug_printf(1,"Error adding acl spec: %s. Probably does not exist!\n", acl_spec_name); error = 1; } else ci_debug_printf(1,"\tAdding acl spec: %s\n", acl_spec_name); } if (error) return 0; return 1; } c_icap-0.4.2/modules/Makefile.am0000664000175000017500000000347012567550776013412 00000000000000 # lib_LTLIBRARIES=sys_logger.la perl_handler.la pkglib_LTLIBRARIES= sys_logger.la dnsbl_tables.la shared_cache.la if USEPERL pkglib_LTLIBRARIES += perl_handler.la endif if USEBDB pkglib_LTLIBRARIES += bdb_tables.la endif if USELDAP pkglib_LTLIBRARIES += ldap_module.la endif if USEMEMCACHED pkglib_LTLIBRARIES += memcached_cache.la endif INCLUDES = -I$(top_srcdir) sys_logger_la_LIBADD = @MODULES_LIBADD@ sys_logger_la_CFLAGS= @MODULES_CFLAGS@ -I../include/ sys_logger_la_LDFLAGS= -module -avoid-version sys_logger_la_SOURCES = sys_logger.c dnsbl_tables_la_LIBADD = @MODULES_LIBADD@ dnsbl_tables_la_CFLAGS= @MODULES_CFLAGS@ -I../include/ dnsbl_tables_la_LDFLAGS= -module -avoid-version dnsbl_tables_la_SOURCES = dnsbl_tables.c perl_handler_la_LIBADD = @MODULES_LIBADD@ @perllib@ -L@perlcore@ -lperl perl_handler_la_CFLAGS= @MODULES_CFLAGS@ -I../include/ @perlccflags@ -I@perlcore@ perl_handler_la_LDFLAGS= -module -avoid-version @perlldflags@ perl_handler_la_SOURCES = perl_handler.c bdb_tables_la_LIBADD = @MODULES_LIBADD@ @BDB_ADD_LDADD@ bdb_tables_la_CFLAGS= @MODULES_CFLAGS@ -I../include/ @BDB_ADD_FLAG@ bdb_tables_la_LDFLAGS= -module -avoid-version bdb_tables_la_SOURCES = bdb_tables.c ldap_module_la_LIBADD = @MODULES_LIBADD@ @LDAP_ADD_LDADD@ $(top_srcdir)/libicapapi.la ldap_module_la_CFLAGS= @MODULES_CFLAGS@ -I../include/ @LDAP_ADD_FLAG@ ldap_module_la_LDFLAGS= -module -avoid-version ldap_module_la_SOURCES = ldap_module.c memcached_cache_la_LIBADD= -lmemcached -lmemcachedutil memcached_cache_la_CFLAGS= @MEMCACHED_CFLAGS@ -I../include/ memcached_cache_la_LDFLAGS= -module -avoid-version @MEMCACHED_LDFLAGS@ memcached_cache_la_SOURCES= memcached.c shared_cache_la_LIBADD= @MODULES_LIBADD@ shared_cache_la_CFLAGS= -I../include/ shared_cache_la_LDFLAGS= -module -avoid-version shared_cache_la_SOURCES= shared_cache.c c_icap-0.4.2/modules/bdb_tables.c0000664000175000017500000001366612567550776013613 00000000000000#include "common.h" #include "c-icap.h" #include "module.h" #include "lookup_table.h" #include "commands.h" #include "debug.h" #include int init_bdb_tables(struct ci_server_conf *server_conf); void release_bdb_tables(); CI_DECLARE_MOD_DATA common_module_t module = { "bdb_tables", init_bdb_tables, NULL, release_bdb_tables, NULL, }; void *bdb_table_open(struct ci_lookup_table *table); void bdb_table_close(struct ci_lookup_table *table); void *bdb_table_search(struct ci_lookup_table *table, void *key, void ***vals); void bdb_table_release_result(struct ci_lookup_table *table_data,void **val); struct ci_lookup_table_type bdb_table_type={ bdb_table_open, bdb_table_close, bdb_table_search, bdb_table_release_result, NULL, "bdb" }; int init_bdb_tables(struct ci_server_conf *server_conf) { return (ci_lookup_table_type_register(&bdb_table_type) != NULL); } void release_bdb_tables() { ci_lookup_table_type_unregister(&bdb_table_type); } /***********************************************************/ /* bdb_table_type inmplementation */ struct bdb_data { DB_ENV *env_db; DB *db; }; int bdb_table_do_real_open(struct ci_lookup_table *table) { int ret; char *s,home[CI_MAX_PATH]; struct bdb_data *dbdata = table->data; if (!dbdata) { ci_debug_printf(1, "Db table %s is not initialized?\n", table->path); return 0; } if (dbdata->db || dbdata->env_db) { ci_debug_printf(1, "Db table %s already open?\n", table->path); return 0; } strncpy(home,table->path,CI_MAX_PATH); home[CI_MAX_PATH-1] = '\0'; s=strrchr(home,'/'); if(s) *s = '\0'; else /*no path in filename?*/ home[0]='\0'; /* * Create an environment and initialize it for additional error * reporting. */ if ((ret = db_env_create(&dbdata->env_db, 0)) != 0) { return 0; } ci_debug_printf(5, "bdb_table_open: Environment created OK.\n"); dbdata->env_db->set_data_dir(dbdata->env_db, home); ci_debug_printf(5, "bdb_table_open: Data dir set to %s.\n", home); /* Open the environment */ if ((ret = dbdata->env_db->open(dbdata->env_db, home, DB_CREATE | DB_INIT_LOCK | DB_INIT_MPOOL|DB_THREAD /*| DB_SYSTEM_MEM*/, 0)) != 0){ ci_debug_printf(1, "bdb_table_open: Environment open failed: %s\n", db_strerror(ret)); dbdata->env_db->close(dbdata->env_db, 0); dbdata->env_db = NULL; return 0; } ci_debug_printf(5, "bdb_table_open: DB environment setup OK.\n"); if ((ret = db_create(&dbdata->db, dbdata->env_db, 0)) != 0) { ci_debug_printf(1, "db_create: %s\n", db_strerror(ret)); dbdata->db = NULL; dbdata->env_db->close(dbdata->env_db, 0); dbdata->env_db = NULL; return 0; } #if (DB_VERSION_MAJOR > 4) || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1) if ((ret = dbdata->db->open( dbdata->db, NULL, table->path, NULL, DB_BTREE, DB_RDONLY|DB_THREAD, 0)) != 0) { #else if ((ret = dbdata->db->open( dbdata->db, table->path, NULL, DB_BTREE, DB_RDONLY, 0)) != 0) { #endif ci_debug_printf(1, "open db %s: %s\n", table->path, db_strerror(ret)); dbdata->db->close(dbdata->db, 0); dbdata->db = NULL; dbdata->env_db->close(dbdata->env_db, 0); dbdata->env_db = NULL; return 0; } return 1; } void command_real_open_table(const char *name, int type, void *data) { struct ci_lookup_table *table = data; bdb_table_do_real_open(table); } void *bdb_table_open(struct ci_lookup_table *table) { struct bdb_data *dbdata = malloc(sizeof(struct bdb_data)); if(!dbdata) return NULL; dbdata->env_db = NULL; dbdata->db = NULL; table->data = dbdata; /*We can not fork a Berkeley DB table, so we have to open bdb tables for every child, on childs start-up procedure*/ register_command_extend("openBDBtable", CHILD_START_CMD, table, command_real_open_table); return table->data; } void bdb_table_close(struct ci_lookup_table *table) { struct bdb_data *dbdata; dbdata = table->data; if(dbdata && dbdata->db && dbdata->env_db) { dbdata->db->close(dbdata->db,0); dbdata->env_db->close(dbdata->env_db,0); free(table->data); table->data = NULL; } else { ci_debug_printf(3,"table %s is not open?\n", table->path); } } #define DATA_SIZE 32768 #define BDB_MAX_COLS 1024 /*Shound be: BDB_MAX_COLS*sizeof(void *) < DATA_SIZE */ void *bdb_table_search(struct ci_lookup_table *table, void *key, void ***vals) { void *store; void **store_index; void *endstore; DBT db_key, db_data; int ret, i, parse_error=0; struct bdb_data *dbdata = (struct bdb_data *)table->data; if(!dbdata) { ci_debug_printf(1,"table %s is not initialized?\n", table->path); return NULL; } if(!dbdata->db) { ci_debug_printf(1,"table %s is not open?\n", table->path); return NULL; } *vals = NULL; memset(&db_data, 0, sizeof(db_data)); memset(&db_key, 0, sizeof(db_key)); db_key.data = key; db_key.size = table->key_ops->size(key); db_data.flags = DB_DBT_USERMEM; db_data.data = ci_buffer_alloc(DATA_SIZE); db_data.size = DATA_SIZE; if ((ret = dbdata->db->get(dbdata->db, NULL, &db_key, &db_data, 0)) != 0){ ci_debug_printf(5, "db_entry_exists does not exists: %s\n", db_strerror(ret)); *vals = NULL; return NULL; } if(db_data.size) { store = db_data.data; store_index = store; endstore=store+db_data.size; for(i=0; store_index[i]!= NULL && i < BDB_MAX_COLS && !parse_error; i++) { store_index[i]=store+(unsigned long int)store_index[i]; if(store_index[i] > endstore) parse_error = 1; } if(!parse_error) *vals = store; else { ci_debug_printf(1, "Error while parsing data in bdb_table_search.Is this a c-icap bdb table?\n"); } } return key; } void bdb_table_release_result(struct ci_lookup_table *table,void **val) { ci_buffer_free(val); } c_icap-0.4.2/modules/Makefile.in0000664000175000017500000010640112601747525013406 00000000000000# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ # lib_LTLIBRARIES=sys_logger.la perl_handler.la VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ @USEPERL_TRUE@am__append_1 = perl_handler.la @USEBDB_TRUE@am__append_2 = bdb_tables.la @USELDAP_TRUE@am__append_3 = ldap_module.la @USEMEMCACHED_TRUE@am__append_4 = memcached_cache.la subdir = modules DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/autoconf.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) bdb_tables_la_DEPENDENCIES = am_bdb_tables_la_OBJECTS = bdb_tables_la-bdb_tables.lo bdb_tables_la_OBJECTS = $(am_bdb_tables_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = bdb_tables_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(bdb_tables_la_CFLAGS) \ $(CFLAGS) $(bdb_tables_la_LDFLAGS) $(LDFLAGS) -o $@ @USEBDB_TRUE@am_bdb_tables_la_rpath = -rpath $(pkglibdir) dnsbl_tables_la_DEPENDENCIES = am_dnsbl_tables_la_OBJECTS = dnsbl_tables_la-dnsbl_tables.lo dnsbl_tables_la_OBJECTS = $(am_dnsbl_tables_la_OBJECTS) dnsbl_tables_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(dnsbl_tables_la_CFLAGS) $(CFLAGS) $(dnsbl_tables_la_LDFLAGS) \ $(LDFLAGS) -o $@ ldap_module_la_DEPENDENCIES = $(top_srcdir)/libicapapi.la am_ldap_module_la_OBJECTS = ldap_module_la-ldap_module.lo ldap_module_la_OBJECTS = $(am_ldap_module_la_OBJECTS) ldap_module_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(ldap_module_la_CFLAGS) $(CFLAGS) $(ldap_module_la_LDFLAGS) \ $(LDFLAGS) -o $@ @USELDAP_TRUE@am_ldap_module_la_rpath = -rpath $(pkglibdir) memcached_cache_la_DEPENDENCIES = am_memcached_cache_la_OBJECTS = memcached_cache_la-memcached.lo memcached_cache_la_OBJECTS = $(am_memcached_cache_la_OBJECTS) memcached_cache_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(memcached_cache_la_CFLAGS) $(CFLAGS) \ $(memcached_cache_la_LDFLAGS) $(LDFLAGS) -o $@ @USEMEMCACHED_TRUE@am_memcached_cache_la_rpath = -rpath $(pkglibdir) perl_handler_la_DEPENDENCIES = am_perl_handler_la_OBJECTS = perl_handler_la-perl_handler.lo perl_handler_la_OBJECTS = $(am_perl_handler_la_OBJECTS) perl_handler_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(perl_handler_la_CFLAGS) $(CFLAGS) $(perl_handler_la_LDFLAGS) \ $(LDFLAGS) -o $@ @USEPERL_TRUE@am_perl_handler_la_rpath = -rpath $(pkglibdir) shared_cache_la_DEPENDENCIES = am_shared_cache_la_OBJECTS = shared_cache_la-shared_cache.lo shared_cache_la_OBJECTS = $(am_shared_cache_la_OBJECTS) shared_cache_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(shared_cache_la_CFLAGS) $(CFLAGS) $(shared_cache_la_LDFLAGS) \ $(LDFLAGS) -o $@ sys_logger_la_DEPENDENCIES = am_sys_logger_la_OBJECTS = sys_logger_la-sys_logger.lo sys_logger_la_OBJECTS = $(am_sys_logger_la_OBJECTS) sys_logger_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(sys_logger_la_CFLAGS) \ $(CFLAGS) $(sys_logger_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(bdb_tables_la_SOURCES) $(dnsbl_tables_la_SOURCES) \ $(ldap_module_la_SOURCES) $(memcached_cache_la_SOURCES) \ $(perl_handler_la_SOURCES) $(shared_cache_la_SOURCES) \ $(sys_logger_la_SOURCES) DIST_SOURCES = $(bdb_tables_la_SOURCES) $(dnsbl_tables_la_SOURCES) \ $(ldap_module_la_SOURCES) $(memcached_cache_la_SOURCES) \ $(perl_handler_la_SOURCES) $(shared_cache_la_SOURCES) \ $(sys_logger_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BDB_ADD_FLAG = @BDB_ADD_FLAG@ BDB_ADD_LDADD = @BDB_ADD_LDADD@ BZLIB_ADD_FLAG = @BZLIB_ADD_FLAG@ BZLIB_ADD_LDADD = @BZLIB_ADD_LDADD@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CICAPLIB_VERSION = @CICAPLIB_VERSION@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ C_ICAP_HEX_VERSION = @C_ICAP_HEX_VERSION@ DEFINE_INT64 = @DEFINE_INT64@ DEFINE_INT8 = @DEFINE_INT8@ DEFINE_OFF_T = @DEFINE_OFF_T@ DEFINE_SIZE_OFF_T = @DEFINE_SIZE_OFF_T@ DEFINE_SIZE_T = @DEFINE_SIZE_T@ DEFINE_SIZE_VOID_P = @DEFINE_SIZE_VOID_P@ DEFINE_UINT64 = @DEFINE_UINT64@ DEFINE_UINT8 = @DEFINE_UINT8@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_ADD_FLAG = @DL_ADD_FLAG@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTTYPES_H = @INTTYPES_H@ INVISIBILITY_CFLAG = @INVISIBILITY_CFLAG@ LD = @LD@ LDAP_ADD_FLAG = @LDAP_ADD_FLAG@ LDAP_ADD_LDADD = @LDAP_ADD_LDADD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MEMCACHED_CFLAGS = @MEMCACHED_CFLAGS@ MEMCACHED_LDFLAGS = @MEMCACHED_LDFLAGS@ MKDIR_P = @MKDIR_P@ MODULES_CFLAGS = @MODULES_CFLAGS@ MODULES_LIBADD = @MODULES_LIBADD@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_ADD_FLAG = @PCRE_ADD_FLAG@ PCRE_ADD_LDADD = @PCRE_ADD_LDADD@ POSIX_FILE_LOCK = @POSIX_FILE_LOCK@ POSIX_MAPPED_FILES = @POSIX_MAPPED_FILES@ POSIX_SEMAPHORES = @POSIX_SEMAPHORES@ POSIX_SHARED_MEM = @POSIX_SHARED_MEM@ PTHREADS_RWLOCK = @PTHREADS_RWLOCK@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SYSV_IPC = @SYSV_IPC@ SYS_TYPES_H = @SYS_TYPES_H@ THREADS_LDADD = @THREADS_LDADD@ THREADS_LDFLAGS = @THREADS_LDFLAGS@ USE_COMPAT = @USE_COMPAT@ USE_IPV6 = @USE_IPV6@ USE_REGEX = @USE_REGEX@ VERSION = @VERSION@ VISIBILITY_ATTR = @VISIBILITY_ATTR@ ZLIB_ADD_FLAG = @ZLIB_ADD_FLAG@ ZLIB_ADD_LDADD = @ZLIB_ADD_LDADD@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_bin = @doxygen_bin@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ has_doxygen = @has_doxygen@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ perlccflags = @perlccflags@ perlcore = @perlcore@ perlldflags = @perlldflags@ perllib = @perllib@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = sys_logger.la dnsbl_tables.la shared_cache.la \ $(am__append_1) $(am__append_2) $(am__append_3) \ $(am__append_4) INCLUDES = -I$(top_srcdir) sys_logger_la_LIBADD = @MODULES_LIBADD@ sys_logger_la_CFLAGS = @MODULES_CFLAGS@ -I../include/ sys_logger_la_LDFLAGS = -module -avoid-version sys_logger_la_SOURCES = sys_logger.c dnsbl_tables_la_LIBADD = @MODULES_LIBADD@ dnsbl_tables_la_CFLAGS = @MODULES_CFLAGS@ -I../include/ dnsbl_tables_la_LDFLAGS = -module -avoid-version dnsbl_tables_la_SOURCES = dnsbl_tables.c perl_handler_la_LIBADD = @MODULES_LIBADD@ @perllib@ -L@perlcore@ -lperl perl_handler_la_CFLAGS = @MODULES_CFLAGS@ -I../include/ @perlccflags@ -I@perlcore@ perl_handler_la_LDFLAGS = -module -avoid-version @perlldflags@ perl_handler_la_SOURCES = perl_handler.c bdb_tables_la_LIBADD = @MODULES_LIBADD@ @BDB_ADD_LDADD@ bdb_tables_la_CFLAGS = @MODULES_CFLAGS@ -I../include/ @BDB_ADD_FLAG@ bdb_tables_la_LDFLAGS = -module -avoid-version bdb_tables_la_SOURCES = bdb_tables.c ldap_module_la_LIBADD = @MODULES_LIBADD@ @LDAP_ADD_LDADD@ $(top_srcdir)/libicapapi.la ldap_module_la_CFLAGS = @MODULES_CFLAGS@ -I../include/ @LDAP_ADD_FLAG@ ldap_module_la_LDFLAGS = -module -avoid-version ldap_module_la_SOURCES = ldap_module.c memcached_cache_la_LIBADD = -lmemcached -lmemcachedutil memcached_cache_la_CFLAGS = @MEMCACHED_CFLAGS@ -I../include/ memcached_cache_la_LDFLAGS = -module -avoid-version @MEMCACHED_LDFLAGS@ memcached_cache_la_SOURCES = memcached.c shared_cache_la_LIBADD = @MODULES_LIBADD@ shared_cache_la_CFLAGS = -I../include/ shared_cache_la_LDFLAGS = -module -avoid-version shared_cache_la_SOURCES = shared_cache.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu modules/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu modules/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } bdb_tables.la: $(bdb_tables_la_OBJECTS) $(bdb_tables_la_DEPENDENCIES) $(EXTRA_bdb_tables_la_DEPENDENCIES) $(AM_V_CCLD)$(bdb_tables_la_LINK) $(am_bdb_tables_la_rpath) $(bdb_tables_la_OBJECTS) $(bdb_tables_la_LIBADD) $(LIBS) dnsbl_tables.la: $(dnsbl_tables_la_OBJECTS) $(dnsbl_tables_la_DEPENDENCIES) $(EXTRA_dnsbl_tables_la_DEPENDENCIES) $(AM_V_CCLD)$(dnsbl_tables_la_LINK) -rpath $(pkglibdir) $(dnsbl_tables_la_OBJECTS) $(dnsbl_tables_la_LIBADD) $(LIBS) ldap_module.la: $(ldap_module_la_OBJECTS) $(ldap_module_la_DEPENDENCIES) $(EXTRA_ldap_module_la_DEPENDENCIES) $(AM_V_CCLD)$(ldap_module_la_LINK) $(am_ldap_module_la_rpath) $(ldap_module_la_OBJECTS) $(ldap_module_la_LIBADD) $(LIBS) memcached_cache.la: $(memcached_cache_la_OBJECTS) $(memcached_cache_la_DEPENDENCIES) $(EXTRA_memcached_cache_la_DEPENDENCIES) $(AM_V_CCLD)$(memcached_cache_la_LINK) $(am_memcached_cache_la_rpath) $(memcached_cache_la_OBJECTS) $(memcached_cache_la_LIBADD) $(LIBS) perl_handler.la: $(perl_handler_la_OBJECTS) $(perl_handler_la_DEPENDENCIES) $(EXTRA_perl_handler_la_DEPENDENCIES) $(AM_V_CCLD)$(perl_handler_la_LINK) $(am_perl_handler_la_rpath) $(perl_handler_la_OBJECTS) $(perl_handler_la_LIBADD) $(LIBS) shared_cache.la: $(shared_cache_la_OBJECTS) $(shared_cache_la_DEPENDENCIES) $(EXTRA_shared_cache_la_DEPENDENCIES) $(AM_V_CCLD)$(shared_cache_la_LINK) -rpath $(pkglibdir) $(shared_cache_la_OBJECTS) $(shared_cache_la_LIBADD) $(LIBS) sys_logger.la: $(sys_logger_la_OBJECTS) $(sys_logger_la_DEPENDENCIES) $(EXTRA_sys_logger_la_DEPENDENCIES) $(AM_V_CCLD)$(sys_logger_la_LINK) -rpath $(pkglibdir) $(sys_logger_la_OBJECTS) $(sys_logger_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bdb_tables_la-bdb_tables.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dnsbl_tables_la-dnsbl_tables.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ldap_module_la-ldap_module.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcached_cache_la-memcached.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perl_handler_la-perl_handler.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shared_cache_la-shared_cache.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sys_logger_la-sys_logger.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< bdb_tables_la-bdb_tables.lo: bdb_tables.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bdb_tables_la_CFLAGS) $(CFLAGS) -MT bdb_tables_la-bdb_tables.lo -MD -MP -MF $(DEPDIR)/bdb_tables_la-bdb_tables.Tpo -c -o bdb_tables_la-bdb_tables.lo `test -f 'bdb_tables.c' || echo '$(srcdir)/'`bdb_tables.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/bdb_tables_la-bdb_tables.Tpo $(DEPDIR)/bdb_tables_la-bdb_tables.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bdb_tables.c' object='bdb_tables_la-bdb_tables.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(bdb_tables_la_CFLAGS) $(CFLAGS) -c -o bdb_tables_la-bdb_tables.lo `test -f 'bdb_tables.c' || echo '$(srcdir)/'`bdb_tables.c dnsbl_tables_la-dnsbl_tables.lo: dnsbl_tables.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dnsbl_tables_la_CFLAGS) $(CFLAGS) -MT dnsbl_tables_la-dnsbl_tables.lo -MD -MP -MF $(DEPDIR)/dnsbl_tables_la-dnsbl_tables.Tpo -c -o dnsbl_tables_la-dnsbl_tables.lo `test -f 'dnsbl_tables.c' || echo '$(srcdir)/'`dnsbl_tables.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dnsbl_tables_la-dnsbl_tables.Tpo $(DEPDIR)/dnsbl_tables_la-dnsbl_tables.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dnsbl_tables.c' object='dnsbl_tables_la-dnsbl_tables.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dnsbl_tables_la_CFLAGS) $(CFLAGS) -c -o dnsbl_tables_la-dnsbl_tables.lo `test -f 'dnsbl_tables.c' || echo '$(srcdir)/'`dnsbl_tables.c ldap_module_la-ldap_module.lo: ldap_module.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ldap_module_la_CFLAGS) $(CFLAGS) -MT ldap_module_la-ldap_module.lo -MD -MP -MF $(DEPDIR)/ldap_module_la-ldap_module.Tpo -c -o ldap_module_la-ldap_module.lo `test -f 'ldap_module.c' || echo '$(srcdir)/'`ldap_module.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ldap_module_la-ldap_module.Tpo $(DEPDIR)/ldap_module_la-ldap_module.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ldap_module.c' object='ldap_module_la-ldap_module.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ldap_module_la_CFLAGS) $(CFLAGS) -c -o ldap_module_la-ldap_module.lo `test -f 'ldap_module.c' || echo '$(srcdir)/'`ldap_module.c memcached_cache_la-memcached.lo: memcached.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(memcached_cache_la_CFLAGS) $(CFLAGS) -MT memcached_cache_la-memcached.lo -MD -MP -MF $(DEPDIR)/memcached_cache_la-memcached.Tpo -c -o memcached_cache_la-memcached.lo `test -f 'memcached.c' || echo '$(srcdir)/'`memcached.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/memcached_cache_la-memcached.Tpo $(DEPDIR)/memcached_cache_la-memcached.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='memcached.c' object='memcached_cache_la-memcached.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(memcached_cache_la_CFLAGS) $(CFLAGS) -c -o memcached_cache_la-memcached.lo `test -f 'memcached.c' || echo '$(srcdir)/'`memcached.c perl_handler_la-perl_handler.lo: perl_handler.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(perl_handler_la_CFLAGS) $(CFLAGS) -MT perl_handler_la-perl_handler.lo -MD -MP -MF $(DEPDIR)/perl_handler_la-perl_handler.Tpo -c -o perl_handler_la-perl_handler.lo `test -f 'perl_handler.c' || echo '$(srcdir)/'`perl_handler.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/perl_handler_la-perl_handler.Tpo $(DEPDIR)/perl_handler_la-perl_handler.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='perl_handler.c' object='perl_handler_la-perl_handler.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(perl_handler_la_CFLAGS) $(CFLAGS) -c -o perl_handler_la-perl_handler.lo `test -f 'perl_handler.c' || echo '$(srcdir)/'`perl_handler.c shared_cache_la-shared_cache.lo: shared_cache.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(shared_cache_la_CFLAGS) $(CFLAGS) -MT shared_cache_la-shared_cache.lo -MD -MP -MF $(DEPDIR)/shared_cache_la-shared_cache.Tpo -c -o shared_cache_la-shared_cache.lo `test -f 'shared_cache.c' || echo '$(srcdir)/'`shared_cache.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/shared_cache_la-shared_cache.Tpo $(DEPDIR)/shared_cache_la-shared_cache.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='shared_cache.c' object='shared_cache_la-shared_cache.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(shared_cache_la_CFLAGS) $(CFLAGS) -c -o shared_cache_la-shared_cache.lo `test -f 'shared_cache.c' || echo '$(srcdir)/'`shared_cache.c sys_logger_la-sys_logger.lo: sys_logger.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sys_logger_la_CFLAGS) $(CFLAGS) -MT sys_logger_la-sys_logger.lo -MD -MP -MF $(DEPDIR)/sys_logger_la-sys_logger.Tpo -c -o sys_logger_la-sys_logger.lo `test -f 'sys_logger.c' || echo '$(srcdir)/'`sys_logger.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sys_logger_la-sys_logger.Tpo $(DEPDIR)/sys_logger_la-sys_logger.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sys_logger.c' object='sys_logger_la-sys_logger.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sys_logger_la_CFLAGS) $(CFLAGS) -c -o sys_logger_la-sys_logger.lo `test -f 'sys_logger.c' || echo '$(srcdir)/'`sys_logger.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$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 $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-pkglibLTLIBRARIES install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-pkglibLTLIBRARIES # 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: c_icap-0.4.2/modules/shared_cache.c0000664000175000017500000002734412567550776014121 00000000000000#include "common.h" #include "c-icap.h" #include "commands.h" #include "debug.h" #include "cache.h" #include "module.h" #include "proc_mutex.h" #include "shared_mem.h" #include static int init_shared_cache(struct ci_server_conf *server_conf); static void release_shared_cache(); CI_DECLARE_MOD_DATA common_module_t module = { "shared_cache", init_shared_cache, NULL, release_shared_cache, NULL, }; struct ci_cache_type ci_shared_cache; static int init_shared_cache(struct ci_server_conf *server_conf) { ci_cache_type_register(&ci_shared_cache); return 1; } static void release_shared_cache() { } int ci_shared_cache_init(struct ci_cache *cache, const char *name); const void *ci_shared_cache_search(struct ci_cache *cache, const void *key, void **val, void *data, void *(*dup_from_cache)(const void *stored_val, size_t stored_val_size, void *data)); int ci_shared_cache_update(struct ci_cache *cache, const void *key, const void *val, size_t val_size, void *(*copy_to_cache)(void *buf, const void *val, size_t buf_size)); void ci_shared_cache_destroy(struct ci_cache *cache); struct ci_cache_type ci_shared_cache = { ci_shared_cache_init, ci_shared_cache_search, ci_shared_cache_update, ci_shared_cache_destroy, "shared" }; /*Should be power of 2 and equal or less than 64*/ #define CACHE_PAGES 4 struct shared_cache_stats { int cache_users; struct page_stats { int64_t hits; int64_t searches; int64_t updates; int64_t update_hits; } page[CACHE_PAGES]; }; struct shared_cache_data { void *mem_ptr; void *slots; ci_shared_mem_id_t id; size_t max_hash; size_t entry_size; size_t shared_mem_size; int entries; int pages; int page_size; int page_shift_op; struct shared_cache_stats *stats; ci_proc_mutex_t cache_mutex; ci_proc_mutex_t mutex[CACHE_PAGES]; }; struct shared_cache_slot { unsigned int hash; time_t expires; size_t key_size; size_t value_size; unsigned char bytes[]; }; unsigned int ci_hash_compute2(unsigned long hash_max_value, const void *data, unsigned int len) { const unsigned char *s = (const unsigned char *)(data); unsigned int n = 0; unsigned int j = 0; unsigned int i = 0; while ((s - (const unsigned char *)data) < len) { ++j; n ^= 271 * *s; ++s; } i = n ^ (j * 271); return i % hash_max_value; } const char *ci_shared_mem_print_id(char *buf, size_t size, ci_shared_mem_id_t *id) { if (buf) { if (id->scheme) id->scheme->shared_mem_print_info(id, buf, size); else *buf = '\0'; } return buf; } void command_attach_shared_mem(const char *name, int type, void *data) { char buf[128]; struct shared_cache_data *shared_cache = (struct shared_cache_data *)data; shared_cache->mem_ptr = ci_shared_mem_attach(&shared_cache->id); shared_cache->stats = (struct shared_cache_stats *)shared_cache->mem_ptr; shared_cache->slots = (void *)(shared_cache->mem_ptr + sizeof(struct shared_cache_stats)); ci_debug_printf(3, "Shared cache id:'%s' attached on address %p\n", ci_shared_mem_print_id(buf, sizeof(buf), &shared_cache->id), shared_cache->mem_ptr); ci_proc_mutex_lock(&(shared_cache->cache_mutex)); ++shared_cache->stats->cache_users; ci_proc_mutex_unlock(&(shared_cache->cache_mutex)); } int ci_shared_cache_init(struct ci_cache *cache, const char *name) { unsigned int next_hash = 63; unsigned int final_max_hash = 63; int i; struct shared_cache_data *data; data = (struct shared_cache_data *)malloc(sizeof(struct shared_cache_data)); data->entry_size = _CI_ALIGN(cache->max_object_size); data->entries = _CI_ALIGN(cache->mem_size) / data->entry_size; while(next_hash < data->entries){ final_max_hash = next_hash; next_hash++; next_hash = (next_hash << 1) -1; } data->max_hash = final_max_hash; data->entries = final_max_hash + 1; data->shared_mem_size = sizeof(struct shared_cache_stats) + data->entries * data->entry_size; data->mem_ptr = ci_shared_mem_create(&data->id, name, data->shared_mem_size); if (!data->mem_ptr) { free(data); ci_debug_printf(1, "Error allocating shared mem for %s cache\n", name); return 0; } data->stats = (struct shared_cache_stats *)data->mem_ptr; data->slots = data->mem_ptr + sizeof(struct shared_cache_stats); memset(data->stats, 0 , sizeof(struct shared_cache_stats)); data->stats->cache_users = 1; /*TODO: check for error*/ for (i = 0; i < CACHE_PAGES; ++i) { ci_proc_mutex_init(&(data->mutex[i]), name); } ci_proc_mutex_init(&(data->cache_mutex), name); data->page_size = data->entries / CACHE_PAGES; /* CACHE_PAGES can not be bigger than 64, the minimum entries value*/ assert(data->entries % data->page_size == 0); data->pages = CACHE_PAGES; /* The pages and page_size should be a power of 2*/ assert((data->pages & (data->pages - 1)) == 0); assert((data->page_size & (data->page_size - 1)) == 0); for (data->page_shift_op = 0; ((data->page_size >> data->page_shift_op) & 0x1) ==0 && data->page_shift_op < 64; ++data->page_shift_op ); assert(data->page_shift_op < 64); ci_debug_printf(1, "Shared mem %s created\nMax shared memory: %u (of the %u requested), max entry size: %u, maximum entries: %u\n", name, (unsigned int)data->shared_mem_size, (unsigned int)cache->mem_size, (unsigned int)data->entry_size, data->entries); cache->cache_data = data; ci_command_register_action("shared_cache_attach_cmd", CHILD_START_CMD, data, command_attach_shared_mem); return 1; } int rw_lock_page(struct shared_cache_data *cache_data, int pos) { ci_proc_mutex_lock(&cache_data->mutex[pos >> cache_data->page_shift_op]); return 1; } int rd_lock_page(struct shared_cache_data *cache_data, int pos) { ci_proc_mutex_lock(&cache_data->mutex[pos >> cache_data->page_shift_op]); return 1; } void unlock_page(struct shared_cache_data *cache_data, int pos) { ci_proc_mutex_unlock(&cache_data->mutex[pos >> cache_data->page_shift_op]); } time_t ci_internal_time() { return time(NULL); } const void *ci_shared_cache_search(struct ci_cache *cache, const void *key, void **val, void *user_data, void *(*dup_from_cache)(const void *stored_val, size_t stored_val_size, void *user_data)) { time_t current_time; const void *cache_key, *cache_val; struct shared_cache_data *cache_data = cache->cache_data; unsigned int hash = ci_hash_compute(cache_data->max_hash, key, cache->key_ops->size(key)); *val = NULL; if (hash >= cache_data->entries) hash = cache_data->entries -1; if (!rd_lock_page(cache_data, hash)) return NULL; unsigned int page = (hash >> cache_data->page_shift_op); ++cache_data->stats->page[page].searches; unsigned int pos; int done; for (pos = hash, done = 0, cache_key = NULL; !cache_key && !done && ((pos >> cache_data->page_shift_op) == page); ++pos) { struct shared_cache_slot *slot = cache_data->slots + (pos * cache_data->entry_size); cache_key = (const void *)slot->bytes; cache_val = (const void *)(&slot->bytes[slot->key_size + 1]); if (slot->hash != hash) { cache_key = NULL; done = 1; } else if (cache->key_ops->compare(cache_key, key) == 0) { current_time = ci_internal_time(); if (slot->expires < current_time) cache_key = NULL; else if (slot->value_size) { if (dup_from_cache) *val = (*dup_from_cache)(cache_val, slot->value_size, user_data); else { if ((*val = ci_buffer_alloc(slot->value_size))) memcpy(*val, cache_val, slot->value_size); } } } else cache_key = NULL; } if (cache_key) ++cache_data->stats->page[page].hits; unlock_page(cache_data, hash); return cache_key; } int ci_shared_cache_update(struct ci_cache *cache, const void *key, const void *val, size_t val_size, void *(*copy_to_cache)(void *buf, const void *val, size_t buf_size)) { time_t expire_time, current_time; void *cache_key, *cache_val; size_t key_size; int ret, can_updated; struct shared_cache_data *cache_data = cache->cache_data; key_size = cache->key_ops->size(key); if ((key_size + val_size + sizeof(struct shared_cache_slot)) > cache_data->entry_size) { /*Does not fit to a cache_data slot.*/ return 0; } unsigned int hash = ci_hash_compute(cache_data->max_hash, key, key_size); if (hash >= cache_data->entries) hash = cache_data->entries -1; current_time = ci_internal_time(); expire_time = current_time + cache->ttl; if (!rw_lock_page(cache_data, hash)) return 0; /*not able to obtain a rw lock*/ unsigned int page = (hash >> cache_data->page_shift_op); ++cache_data->stats->page[page].updates; unsigned int pos; int done; for (pos = hash, ret = 0, done = 0; ret == 0 && !done && ((hash >> cache_data->page_shift_op) == (pos >> cache_data->page_shift_op)); ++pos) { struct shared_cache_slot *slot = cache_data->slots + (pos * cache_data->entry_size); cache_key = (void *)slot->bytes; can_updated = 0; if (slot->hash < hash){ can_updated = 1; }else if (cache->key_ops->compare(cache_key, key) == 0) { /*we are updating key with a new value*/ can_updated = 1; } else if (slot->expires < current_time + cache->ttl) { can_updated = 1; } else if (pos == hash && slot->expires < (current_time + (cache->ttl / 2))) { /*entries on pos==hash which are near to expire*/ can_updated = 1; } else if (pos != hash && slot->hash == pos){ /*entry is not expired, and it is not on a continues block we can use */ done = 1; } if (can_updated) { slot->hash = pos; slot->expires = expire_time; slot->key_size = key_size; slot->value_size = val_size; memcpy(cache_key, key, key_size); cache_val = (void *)(&slot->bytes[slot->key_size + 1]); if (copy_to_cache) copy_to_cache(cache_val, val, slot->value_size); else memcpy(cache_val, val, slot->value_size); ret = 1; ++cache_data->stats->page[page].update_hits; } else ret = 0; } unlock_page(cache_data, hash); return ret; } void ci_shared_cache_destroy(struct ci_cache *cache) { int i, users; uint64_t updates, update_hits, searches, hits; struct shared_cache_data *data = cache->cache_data; ci_proc_mutex_lock(&data->cache_mutex); users = --data->stats->cache_users; ci_proc_mutex_unlock(&data->cache_mutex); if (users == 0) { updates = update_hits = searches = hits = 0; for (i = 0; i < CACHE_PAGES; ++i) { updates += data->stats->page[i].updates; update_hits += data->stats->page[i].update_hits; searches += data->stats->page[i].searches; hits += data->stats->page[i].hits; } ci_debug_printf(3, "Last user, the cache will be destroyed\n"); ci_debug_printf(3, "Cache updates: %" PRIu64 ", update hits:%" PRIu64 ", searches: %" PRIu64 ", hits: %" PRIu64 "\n", updates, update_hits, searches, hits ); ci_shared_mem_destroy(&data->id); ci_proc_mutex_destroy(&data->cache_mutex); for (i = 0; i < CACHE_PAGES; ++i) { ci_proc_mutex_destroy(&data->mutex[i]); } } else ci_shared_mem_detach(&data->id); } c_icap-0.4.2/modules/perl_handler.c0000664000175000017500000000756112567550776014166 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include "service.h" #include "module.h" #include "header.h" #include "body.h" #include "debug.h" #include "EXTERN.h" #include "perl.h" #include "XSUB.h" struct perl_data { PerlInterpreter *perl; }; int init_perl_handler(struct ci_server_conf *server_conf); ci_service_module_t *load_perl_module(char *service_file); CI_DECLARE_DATA service_handler_module_t module = { "perl_handler", ".pl,.pm,.plx", init_perl_handler, NULL, /*post_init .... */ NULL, /*release handler */ load_perl_module, NULL }; int perl_init_service(ci_service_xdata_t *srv_xdata, struct ci_server_conf *server_conf); void perl_close_service(); void *perl_init_request_data(ci_request_t *); void perl_release_request_data(void *data); int perl_check_preview_handler(char *preview_data, int preview_data_len, ci_request_t *); int perl_end_of_data_handler(ci_request_t *); int perl_service_io(char *rbuf, int *rlen, char *wbuf, int *wlen, int iseof, ci_request_t *req); int init_perl_handler(struct ci_server_conf *server_conf) { return 0; } ci_service_module_t *load_perl_module(char *service_file) { ci_service_module_t *service = NULL; struct perl_data *perl_data; char *argv[2]; argv[0] = NULL; argv[1] = service_file; service = malloc(sizeof(ci_service_module_t)); perl_data = malloc(sizeof(struct perl_data)); perl_data->perl = perl_alloc(); /*Maybe it is better to allocate a perl interpreter per request */ perl_construct(perl_data->perl); perl_parse(perl_data->perl, NULL, 2, argv, NULL); perl_run(perl_data->perl); service->mod_data = perl_data; service->mod_init_service = perl_init_service; service->mod_post_init_service = NULL; service->mod_close_service = perl_close_service; service->mod_init_request_data = perl_init_request_data; service->mod_release_request_data = perl_release_request_data; service->mod_check_preview_handler = perl_check_preview_handler; service->mod_end_of_data_handler = perl_end_of_data_handler; service->mod_service_io = perl_service_io; service->mod_name = strdup("perl_test"); service->mod_type = ICAP_REQMOD | ICAP_RESPMOD; ci_debug_printf(1, "OK service %s loaded\n", service_file); return service; } int perl_init_service(ci_service_xdata_t *srv_xdata, struct ci_server_conf *server_conf) { return 0; } void perl_close_service() { } void *perl_init_request_data(ci_request_t *req) { return NULL; } void perl_release_request_data(void *data) { } int perl_check_preview_handler(char *preview_data, int preview_data_len, ci_request_t *req) { return EC_500; } int perl_end_of_data_handler(ci_request_t *req) { return 0; } int perl_service_io(char *rbuf, int *rlen, char *wbuf, int *wlen, int iseof, ci_request_t *req) { *rlen = 0; *wlen = 0; return CI_OK; } c_icap-0.4.2/modules/dnsbl_tables.c0000664000175000017500000001516112567550776014156 00000000000000#include "common.h" #include "c-icap.h" #include "module.h" #include "lookup_table.h" #include "net_io.h" #include "cache.h" #include "debug.h" #include "common.h" int init_dnsbl_tables(struct ci_server_conf *server_conf); void release_dnsbl_tables(); CI_DECLARE_MOD_DATA common_module_t module = { "dnsbl_tables", init_dnsbl_tables, NULL, release_dnsbl_tables, NULL, }; void *dnsbl_table_open(struct ci_lookup_table *table); void dnsbl_table_close(struct ci_lookup_table *table); void *dnsbl_table_search(struct ci_lookup_table *table, void *key, void ***vals); void dnsbl_table_release_result(struct ci_lookup_table *table_data,void **val); struct ci_lookup_table_type dnsbl_table_type={ dnsbl_table_open, dnsbl_table_close, dnsbl_table_search, dnsbl_table_release_result, NULL, "dnsbl" }; int init_dnsbl_tables(struct ci_server_conf *server_conf) { return (ci_lookup_table_type_register(&dnsbl_table_type) != NULL); } void release_dnsbl_tables() { ci_lookup_table_type_unregister(&dnsbl_table_type); } /***********************************************************/ /* bdb_table_type inmplementation */ struct dnsbl_data { char check_domain[CI_MAXHOSTNAMELEN+1]; ci_cache_t *cache; }; void *dnsbl_table_open(struct ci_lookup_table *table) { struct dnsbl_data *dnsbl_data; char tname[CI_MAXHOSTNAMELEN]; ci_dyn_array_t *args = NULL; ci_array_item_t *arg = NULL; char *use_cache = "local"; int cache_ttl = 60; size_t cache_size = 1*1024*1024; long int val; int i; if (strlen(table->path) >= CI_MAXHOSTNAMELEN ) { ci_debug_printf(1, "dnsbl_table_open: too long domain name: %s\n", table->path); return NULL; } if (table->key_ops != &ci_str_ops || table->val_ops!= &ci_str_ops) { ci_debug_printf(1, "dnsbl_table_open: Only searching with strings and returning strings supported\n"); return NULL; } dnsbl_data = malloc(sizeof(struct dnsbl_data)); if (!dnsbl_data) { ci_debug_printf(1, "dnsbl_table_open: error allocating memory (dnsbl_data)!\n"); return NULL; } strncpy(dnsbl_data->check_domain, table->path, CI_MAXHOSTNAMELEN); dnsbl_data->check_domain[CI_MAXHOSTNAMELEN] = '\0'; if (table->args) { if ((args = ci_parse_key_value_list(table->args, ','))) { for (i = 0; (arg = ci_dyn_array_get_item(args, i)) != NULL; ++i) { ci_debug_printf(5, "Table argument %s:%s\n", arg->name, (char *)arg->value); if(strcasecmp(arg->name, "cache") == 0) { if (strcasecmp(arg->value, "no") == 0) use_cache = NULL; else use_cache = (char *)arg->value; } else if (strcasecmp(arg->name, "cache-ttl") == 0) { val = strtol((char *)arg->value, NULL, 10); if (val > 0) cache_ttl = val; else ci_debug_printf(1, "WARNING: wrong cache-ttl value: %ld, using default\n", val); } else if (strcasecmp(arg->name, "cache-size") == 0) { val = ci_atol_ext((char *)arg->value, NULL); if (val > 0) cache_size = (size_t)val; else ci_debug_printf(1, "WARNING: wrong cache-size value: %ld, using default\n", val); } } } } if (use_cache) { snprintf(tname, sizeof(tname), "dnsbl:%s", table->path); tname[sizeof(tname) - 1] = '\0'; dnsbl_data->cache = ci_cache_build(tname, use_cache, cache_size, 1024, cache_ttl, &ci_str_ops); } else dnsbl_data->cache = NULL; table->data = dnsbl_data; /*Must released before exit, we have pointes pointing on args array items*/ if (args) ci_dyn_array_destroy(args); return table->data; } void dnsbl_table_close(struct ci_lookup_table *table) { struct dnsbl_data *dnsbl_data = table->data; table->data = NULL; if (dnsbl_data->cache) ci_cache_destroy(dnsbl_data->cache); free(dnsbl_data); } static ci_vector_t *resolv_hostname(char *hostname); void *dnsbl_table_search(struct ci_lookup_table *table, void *key, void ***vals) { char dnsname[CI_MAXHOSTNAMELEN + 1]; char *server; ci_str_vector_t *v; size_t v_size; struct dnsbl_data *dnsbl_data = table->data; if(table->key_ops != &ci_str_ops) { ci_debug_printf(1,"Only keys of type string allowed in this type of table:\n"); return NULL; } server = (char *)key; if (dnsbl_data->cache && ci_cache_search(dnsbl_data->cache, server, (void **)&v, NULL, &ci_cache_read_vector_val)) { ci_debug_printf(6,"dnsbl_table_search: cache hit for %s value %p\n", server, v); if (!v) { *vals = NULL; return NULL; } *vals = (void **)ci_vector_cast_to_voidvoid(v); return key; } snprintf(dnsname, CI_MAXHOSTNAMELEN, "%s.%s", server, dnsbl_data->check_domain); dnsname[CI_MAXHOSTNAMELEN] = '\0'; v = resolv_hostname(dnsname); if (dnsbl_data->cache) { v_size = v != NULL ? ci_cache_store_vector_size(v) : 0; ci_cache_update(dnsbl_data->cache, server, v, v_size, ci_cache_store_vector_val); } if (!v) return NULL; *vals = (void **)ci_vector_cast_to_voidvoid(v); return key; } void dnsbl_table_release_result(struct ci_lookup_table *table,void **val) { ci_str_vector_t *v = ci_vector_cast_from_voidvoid((const void **)val); ci_str_vector_destroy(v); } /**************************/ /* Utility functions */ /*Return the list of ip address for a given hostname*/ static ci_vector_t *resolv_hostname(char *hostname) { ci_str_vector_t *vect = NULL; int ret; struct addrinfo hints, *res, *cur; ci_sockaddr_t addr; char buf[256]; memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = 0; if ((ret = getaddrinfo(hostname, NULL, &hints, &res)) != 0) { ci_debug_printf(5, "Error geting addrinfo:%s\n", gai_strerror(ret)); return NULL; } if (res) vect = ci_str_vector_create(1024); if (vect) { for(cur = res; cur != NULL; cur = cur->ai_next){ memcpy(&(addr.sockaddr), cur->ai_addr, CI_SOCKADDR_SIZE); ci_fill_sockaddr(&addr); if (ci_sockaddr_t_to_ip(&addr, buf, sizeof(buf))) (void)ci_str_vector_add(vect, buf); } freeaddrinfo(res); } return vect; } c_icap-0.4.2/modules/memcached.c0000664000175000017500000004070112567550776013426 00000000000000/* * Copyright (C) 2011 Christos Tsantilas * email: christos@chtsanti.net * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "common.h" #include "array.h" #include "cache.h" #include "ci_threads.h" #include "debug.h" #include "md5.h" #include "mem.h" #include "module.h" #include /* Set it to 1 if you want to use c-icap memory pools and custom c-icap memory allocators. Currently libmemcached looks that does not handle well foreign mem allocators, so for nos it is disabled. */ #define USE_CI_BUFFERS 0 #if defined(LIBMEMCACHED_VERSION_HEX) #if LIBMEMCACHED_VERSION_HEX > 0x01000000 #include #else #include #endif /* LIBMEMCACHED_VERSION_HEX > 0x01000000*/ #else /* And older version of libmemcached*/ #include #endif #include int USE_MD5_SUM_KEYS = 1; int mc_cfg_servers_set(const char *directive, const char **argv, void *setdata); /*Configuration Table .....*/ static struct ci_conf_entry mc_conf_variables[] = { {"servers", NULL, mc_cfg_servers_set, NULL}, {"use_md5_keys", &USE_MD5_SUM_KEYS, ci_cfg_onoff, NULL}, {NULL, NULL, NULL, NULL} }; static int mc_module_init(struct ci_server_conf *server_conf); static int mc_module_post_init(struct ci_server_conf *server_conf); static void mc_module_release(); CI_DECLARE_MOD_DATA common_module_t module = { "memcached", mc_module_init, mc_module_post_init, mc_module_release, mc_conf_variables, }; #define MC_DOMAINLEN 32 #define MC_MAXKEYLEN 250 #define HOSTNAME_LEN 256 typedef struct mc_server { char hostname[HOSTNAME_LEN]; int port; } mc_server_t; /*Vector of mc_server_t elements*/ static ci_list_t *servers_list = NULL; /*A general mutex used in various configuration steps*/ static ci_thread_mutex_t mc_mtx; struct mc_cache_data { char domain[MC_DOMAINLEN + 1]; }; /*The list of mc caches. Objects of type mc_cache_data.*/ static ci_list_t *mc_caches_list = NULL; static struct ci_cache_type mc_cache; memcached_st *MC = NULL; memcached_pool_st *MC_POOL = NULL; #if USE_CI_BUFFERS #if defined(LIBMEMCACHED_VERSION_HEX) void *mc_mem_malloc(const memcached_st *ptr, const size_t size, void *context); void mc_mem_free(const memcached_st *ptr, void *mem, void *context); void *mc_mem_realloc(const memcached_st *ptr, void *mem, const size_t size, void *context); void *mc_mem_calloc(const memcached_st *ptr, size_t nelem, const size_t elsize, void *context); #else void *mc_mem_malloc(memcached_st *ptr, const size_t size); void mc_mem_free(memcached_st *ptr, void *mem); void *mc_mem_realloc(memcached_st *ptr, void *mem, const size_t size); void *mc_mem_calloc(memcached_st *ptr, size_t nelem, const size_t elsize); #endif #endif static int computekey(char *mckey, const char *key, const char *search_domain); int mc_module_init(struct ci_server_conf *server_conf) { if (ci_thread_mutex_init(&mc_mtx) != 0) { ci_debug_printf(1, "Can not intialize mutex!\n"); return 0; } /*mc_caches_list should store pointers to memcached caches data*/ if ((mc_caches_list = ci_list_create(1024, 0)) == NULL) { ci_debug_printf(1, "Can not allocate memory for list storing mc domains!\n"); return 0; } ci_cache_type_register(&mc_cache); ci_debug_printf(3, "Memcached cache sucessfully initialized!\n"); return 1; } int mc_module_post_init(struct ci_server_conf *server_conf) { #if USE_CI_BUFFERS memcached_return rc; #endif const mc_server_t *srv; const char *default_servers[] = { "127.0.0.1", NULL }; if (servers_list == NULL) { mc_cfg_servers_set("server", default_servers, NULL); if (servers_list == NULL) return 0; } #if USE_CI_BUFFERS MC = (memcached_st *)mc_mem_calloc(NULL, 1, sizeof(memcached_st) #if defined(LIBMEMCACHED_VERSION_HEX) ,(void *)0x1 #endif ); #else MC= calloc(1, sizeof(memcached_st)); #endif MC = memcached_create(MC); if (MC == NULL) { ci_debug_printf(1, "Failed to create memcached instance\n"); return 0; } ci_debug_printf(1, "memcached instance created\n"); #if USE_CI_BUFFERS rc = memcached_set_memory_allocators(MC, mc_mem_malloc, mc_mem_free, mc_mem_realloc, mc_mem_calloc #if defined(LIBMEMCACHED_VERSION_HEX) , (void *)0x1 #endif ); if (rc != MEMCACHED_SUCCESS) { ci_debug_printf(1, "Failed to set ci-icap membuf memory allocators\n"); memcached_free(MC); MC = NULL; return 0; } #endif memcached_behavior_set(MC, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1); for (srv = (const mc_server_t *)ci_list_first(servers_list); srv != NULL ; srv = (const mc_server_t *)ci_list_next(servers_list)) { if (srv->hostname[0] == '/') { if (memcached_server_add_unix_socket(MC, srv->hostname) != MEMCACHED_SUCCESS) { ci_debug_printf(1, "Failed to add socket path to the server pool\n"); memcached_free(MC); MC = NULL; return 0; } } else if (memcached_server_add(MC, srv->hostname, srv->port) != MEMCACHED_SUCCESS) { ci_debug_printf(1, "Failed to add localhost to the server pool\n"); memcached_free(MC); MC = NULL; return 0; } } MC_POOL = memcached_pool_create(MC, 5, 500); if (MC_POOL == NULL) { ci_debug_printf(1, "Failed to create connection pool\n"); memcached_free(MC); MC = NULL; return 0; } return 1; } void mc_module_release() { memcached_pool_destroy(MC_POOL); memcached_free(MC); ci_list_destroy(servers_list); ci_list_destroy(mc_caches_list); servers_list = NULL; } /*******************************************/ /* memcached cache implementation */ static int mc_cache_init(struct ci_cache *cache, const char *name); static const void *mc_cache_search(struct ci_cache *cache, const void *key, void **val, void *data, void *(*dup_from_cache)(const void *stored_val, size_t stored_val_size, void *data)); static int mc_cache_update(struct ci_cache *cache, const void *key, const void *val, size_t val_size, void *(*copy_to_cache)(void *buf, const void *val, size_t buf_size)); static void mc_cache_destroy(struct ci_cache *cache); static struct ci_cache_type mc_cache = { mc_cache_init, mc_cache_search, mc_cache_update, mc_cache_destroy, "memcached" }; int mc_cache_cmp(const void *obj, const void *user_data, size_t user_data_size) { struct mc_cache_data *mcObj = (struct mc_cache_data *)obj; const char *domain = (const char *)user_data; return strcmp(mcObj->domain, domain); } int mc_cache_init(struct ci_cache *cache, const char *domain) { int i; char useDomain[MC_DOMAINLEN + 1]; strncpy(useDomain, domain, MC_DOMAINLEN); useDomain[MC_DOMAINLEN] = '\0'; i = 0; ci_thread_mutex_lock(&mc_mtx); while(i < 1000 && ci_list_search2(mc_caches_list, useDomain, mc_cache_cmp)) { snprintf(useDomain, MC_DOMAINLEN, "%.*s~%d", MC_DOMAINLEN - 2 - (i < 10 ? 1 : (i < 100 ? 2 : 3)), domain, i); i++; } ci_thread_mutex_unlock(&mc_mtx); if (i > 999) /*????*/ return 0; struct mc_cache_data *mc_data = malloc(sizeof(struct mc_cache_data)); strncpy(mc_data->domain, useDomain, MC_DOMAINLEN); mc_data->domain[MC_DOMAINLEN] = '\0'; cache->cache_data = mc_data; ci_thread_mutex_lock(&mc_mtx); ci_list_push_back(mc_caches_list, mc_data); ci_thread_mutex_unlock(&mc_mtx); ci_debug_printf(3, "memcached cache for domain: '%s' created\n", useDomain); return 1; } void mc_cache_destroy(struct ci_cache *cache) { ci_thread_mutex_lock(&mc_mtx); ci_list_remove(mc_caches_list, cache->cache_data); ci_thread_mutex_unlock(&mc_mtx); free(cache->cache_data); } const void *mc_cache_search(struct ci_cache *cache, const void *key, void **val, void *data, void *(*dup_from_cache)(const void *stored_val, size_t stored_val_size, void *data)) { memcached_return rc; memcached_st *mlocal; uint32_t flags; char mckey[MC_MAXKEYLEN+1]; int mckeylen = 0; void *value; size_t value_len; int found = 0; struct mc_cache_data *mc_data = (struct mc_cache_data *)cache->cache_data; mckeylen = computekey(mckey, key, mc_data->domain); if (mckeylen == 0) return NULL; mlocal = memcached_pool_pop(MC_POOL, true, &rc); if (!mlocal) { ci_debug_printf(1, "Error getting memcached_st object from pool: %s\n", memcached_strerror(MC, rc)); return NULL; } value = memcached_get(mlocal, mckey, mckeylen, &value_len, &flags, &rc); if ( rc != MEMCACHED_SUCCESS) { ci_debug_printf(5, "Failed to retrieve %s object from cache: %s\n", mckey, memcached_strerror(mlocal, rc)); } else { ci_debug_printf(5, "The %s object retrieved from cache has size %d\n", mckey, (int)value_len); found = 1; } if ((rc = memcached_pool_push(MC_POOL, mlocal)) != MEMCACHED_SUCCESS) { ci_debug_printf(1, "Failed to release memcached_st object (%s)!\n", memcached_strerror(MC, rc)); } if (!found) return NULL; if (dup_from_cache && value) { *val = dup_from_cache(value, value_len, data); ci_buffer_free(value); value = NULL; } else { #if USE_CI_BUFFERS *val = value; #else if (value_len) { *val = ci_buffer_alloc(value_len); if (!*val) { free(value); return NULL; } memcpy(*val, value, value_len); free(value); } else *val = NULL; #endif } return key; } int mc_cache_update(struct ci_cache *cache, const void *key, const void *val, size_t val_size, void *(*copy_to_cache)(void *buf, const void *val, size_t buf_size)) { void *value = NULL; memcached_return rc; char mckey[MC_MAXKEYLEN+1]; int mckeylen = 0; struct mc_cache_data *mc_data = (struct mc_cache_data *)cache->cache_data; memcached_st *mlocal; mckeylen = computekey(mckey, key, mc_data->domain); if (mckeylen == 0) return 0; if (copy_to_cache && val_size) { if ((value = ci_buffer_alloc(val_size)) == NULL) return 0; /*debug message?*/ if (!copy_to_cache(value, val, val_size)) return 0; /*debug message?*/ } mlocal = memcached_pool_pop(MC_POOL, true, &rc); if (!mlocal) { ci_debug_printf(1, "Error getting memcached_st object from pool: %s\n", memcached_strerror(MC, rc)); return 0; } rc = memcached_set(mlocal, mckey, mckeylen, value != NULL ? (const char *)value : (const char *)val, val_size, cache->ttl, (uint32_t)0); if (value) ci_buffer_free(value); if (rc != MEMCACHED_SUCCESS) ci_debug_printf(5, "failed to set key: %s in memcached: %s\n", mckey, memcached_strerror(mlocal, rc)); if (memcached_pool_push(MC_POOL, mlocal) != MEMCACHED_SUCCESS) { ci_debug_printf(1, "Failed to release memcached_st object:%s\n", memcached_strerror(MC, rc)); } ci_debug_printf(5, "mc_cache_update: successfully update key '%s'\n", mckey); return 1; } int mc_cache_delete(const char *key, const char *search_domain) { memcached_return rc; memcached_st *mlocal = memcached_pool_pop(MC_POOL, true, &rc); if (!mlocal) { ci_debug_printf(1, "Error getting memcached_st object from pool: %s\n", memcached_strerror(MC, rc)); return 0; } char mckey[MC_MAXKEYLEN+1]; int mckeylen = 0; mckeylen = computekey(mckey,key,search_domain); if (mckeylen == 0) return 0; rc = memcached_delete(mlocal, mckey, mckeylen, (time_t)0); if (rc != MEMCACHED_SUCCESS) ci_debug_printf(5, "failed to set key: %s in memcached: %s\n", mckey, memcached_strerror(mlocal, rc)); return 1; } int mc_cfg_servers_set(const char *directive, const char **argv, void *setdata) { int argc; char *s; mc_server_t srv; if (!servers_list) { servers_list = ci_list_create(4096, sizeof(mc_server_t)); if (!servers_list) { ci_debug_printf(1, "Error allocating memory for mc_servers list!\n"); return 0; } } for(argc = 0; argv[argc] != NULL; argc++) { strncpy(srv.hostname, argv[argc], HOSTNAME_LEN); srv.hostname[HOSTNAME_LEN - 1] = '\0'; if (srv.hostname[0] != '/' && (s = strchr(srv.hostname, ':')) != NULL) { s = '\0'; s++; srv.port = atoi(s); if (!srv.port) srv.port = 11211; } else srv.port = 11211; ci_debug_printf(2, "Setup memcached server %s:%d\n", srv.hostname, srv.port); } ci_list_push_back(servers_list, &srv); return argc; } #if USE_CI_BUFFERS /*Memory managment functions*/ #if defined(LIBMEMCACHED_VERSION_HEX) void *mc_mem_malloc(const memcached_st *ptr, const size_t size, void *context) #else void *mc_mem_malloc(memcached_st *ptr, const size_t size) #endif { void *p= ci_buffer_alloc(size); ci_debug_printf(5, "mc_mem_malloc: %p of size %u\n", p, (unsigned int)size); return p; } #if defined(LIBMEMCACHED_VERSION_HEX) void mc_mem_free(const memcached_st *ptr, void *mem, void *context) #else void mc_mem_free(memcached_st *ptr, void *mem) #endif { #if defined(LIBMEMCACHED_VERSION_HEX) ci_debug_printf(5, "mc_mem_free: %p/%p\n", mem, context); #else ci_debug_printf(5, "mc_mem_free: %p\n", mem); #endif if (mem) ci_buffer_free(mem); } #if defined(LIBMEMCACHED_VERSION_HEX) void *mc_mem_realloc(const memcached_st *ptr, void *mem, const size_t size, void *context) #else void *mc_mem_realloc(memcached_st *ptr, void *mem, const size_t size) #endif { void *p = ci_buffer_realloc(mem, size); ci_debug_printf(5, "mc_mem_realloc: %p of size %u\n", p, (unsigned int)size); return p; } #if defined(LIBMEMCACHED_VERSION_HEX) void *mc_mem_calloc(const memcached_st *ptr, size_t nelem, const size_t elsize, void *context) #else void *mc_mem_calloc(memcached_st *ptr, size_t nelem, const size_t elsize) #endif { void *p; p = ci_buffer_alloc(nelem*elsize); if (!p) return NULL; memset(p, 0, nelem*elsize); ci_debug_printf(5, "mc_mem_calloc: %p of size %u\n", p, (unsigned int)(nelem*elsize)); return p; } #endif int computekey(char *mckey, const char *key, const char *search_domain) { ci_MD5_CTX md5; unsigned char digest[16]; int mckeylen; /*we need to use keys in the form "search_domain:key" We can not use keys bigger than MC_MAXKEYLEN */ if (strlen(key)+strlen(search_domain)+1 < MC_MAXKEYLEN) { mckeylen = sprintf(mckey, "v%s:%s", search_domain, key); } else if (USE_MD5_SUM_KEYS) { ci_MD5Init(&md5); ci_MD5Update(&md5, (const unsigned char *)key, strlen(key)); ci_MD5Final(digest, &md5); mckeylen = sprintf(mckey, "v%s:%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", search_domain, digest[0], digest[1], digest[2], digest[3], digest[4], digest[5], digest[6], digest[7], digest[8], digest[9], digest[10], digest[11], digest[12], digest[13], digest[14], digest[15]); } else { mckeylen = 0; } return mckeylen; } c_icap-0.4.2/modules/ldap_module.c0000664000175000017500000004646312567550776014020 00000000000000#include "common.h" #include #include "c-icap.h" #include "module.h" #include "mem.h" #include "lookup_table.h" #include "cache.h" #include "debug.h" #include #define MAX_LDAP_FILTER_SIZE 1024 #define MAX_DATA_SIZE 32768 #define MAX_COLS 1024 #define DATA_START (MAX_COLS*sizeof(void *)) #define DATA_SIZE (MAX_DATA_SIZE-DATA_START) int init_ldap_pools(); void release_ldap_pools(); int init_ldap_module(struct ci_server_conf *server_conf); void release_ldap_module(); CI_DECLARE_MOD_DATA common_module_t module = { "ldap_module", init_ldap_module, NULL, release_ldap_module, NULL, }; void *ldap_table_open(struct ci_lookup_table *table); void ldap_table_close(struct ci_lookup_table *table); void *ldap_table_search(struct ci_lookup_table *table, void *key, void ***vals); void ldap_table_release_result(struct ci_lookup_table *table_data,void **val); const void *ldap_table_get_row(struct ci_lookup_table *table, const void *key, const char *columns[], void ***vals); struct ci_lookup_table_type ldap_table_type={ ldap_table_open, ldap_table_close, ldap_table_search, ldap_table_release_result, NULL, "ldap" }; int init_ldap_module(struct ci_server_conf *server_conf) { init_ldap_pools(); return (ci_lookup_table_type_register(&ldap_table_type) != NULL); } void release_ldap_module() { release_ldap_pools(); ci_lookup_table_type_unregister(&ldap_table_type); } /***********************************************************/ /* ldap_connections_pool inmplementation */ struct ldap_connection { LDAP *ldap; int hits; struct ldap_connection *next; }; struct ldap_connections_pool { char ldap_uri[1024]; char server[CI_MAXHOSTNAMELEN+1]; int port; int ldapversion; char user[256]; char password[256]; int connections; #ifdef LDAP_MAX_CONNECTIONS int max_connections; #endif ci_thread_mutex_t mutex; #ifdef LDAP_MAX_CONNECTIONS ci_thread_cond_t pool_cond; #endif struct ldap_connection *inactive; struct ldap_connection *used; struct ldap_connections_pool *next; }; struct ldap_connections_pool *ldap_pools = NULL; ci_thread_mutex_t ldap_connections_pool_mtx; void ldap_pool_destroy(struct ldap_connections_pool *pool); int init_ldap_pools() { ldap_pools = NULL; ci_thread_mutex_init(&ldap_connections_pool_mtx); return 1; } void release_ldap_pools() { struct ldap_connections_pool *pool; while((pool=ldap_pools) != NULL) { ldap_pools = ldap_pools->next; ldap_pool_destroy(pool); } ci_thread_mutex_destroy(&ldap_connections_pool_mtx); } /*The folowing two functions are not thread safe! It is only used in ldap_pool_create which locks the required mutexes*/ void add_ldap_pool(struct ldap_connections_pool *pool) {/*NOT thread safe!*/ struct ldap_connections_pool *p; pool->next = NULL; if (!ldap_pools){ ldap_pools = pool; return; } p = ldap_pools; while(p->next != NULL) p = p->next; p->next = pool; } struct ldap_connections_pool * search_ldap_pools(char *server, int port, char *user, char *password) {/*NOT thread safe!*/ struct ldap_connections_pool *p; p = ldap_pools; while(p) { if(strcmp(p->server,server) == 0 && p->port == port && strcmp(p->user, user) == 0 && strcmp(p->password, password) == 0 ) return p; p = p->next; } return NULL; } struct ldap_connections_pool *ldap_pool_create(char *server, int port, char *user, char *password) { struct ldap_connections_pool *pool; ci_thread_mutex_lock(&ldap_connections_pool_mtx); pool = search_ldap_pools(server, port, (user != NULL? user : ""), (password != NULL? password : "")); if(pool) { ci_thread_mutex_unlock(&ldap_connections_pool_mtx); return pool; } pool = malloc(sizeof(struct ldap_connections_pool)); if(!pool) { ci_thread_mutex_unlock(&ldap_connections_pool_mtx); return NULL; } strncpy(pool->server, server, CI_MAXHOSTNAMELEN); pool->server[CI_MAXHOSTNAMELEN]='\0'; pool->port = port; pool->ldapversion = LDAP_VERSION3; pool->next = NULL; if(user) { strncpy(pool->user,user,256); pool->user[255] = '\0'; } else pool->user[0] = '\0'; if(password) { strncpy(pool->password,password,256); pool->password[255] = '\0'; } else pool->password[0] = '\0'; pool->connections = 0; pool->inactive = NULL; pool->used = NULL; snprintf(pool->ldap_uri,1024,"%s://%s:%d","ldap",pool->server,pool->port); pool->ldap_uri[1023] = '\0'; ci_thread_mutex_init(&pool->mutex); #ifdef LDAP_MAX_CONNECTIONS pool->max_connections = 0; ci_thread_cond_init(&pool->pool_cond); #endif add_ldap_pool(pool); ci_thread_mutex_unlock(&ldap_connections_pool_mtx); return pool; } /*The following function is not thread safe! Should called only when c-icap shutdown*/ void ldap_pool_destroy(struct ldap_connections_pool *pool) { struct ldap_connection *conn,*prev; if(pool->used) { ci_debug_printf(1,"Not released ldap connections for pool %s.This is BUG!\n", pool->ldap_uri); } conn = pool->inactive; while(conn) { ldap_unbind_ext_s(conn->ldap, NULL, NULL); prev = conn; conn = conn->next; free(prev); } pool->inactive = NULL; ci_thread_mutex_destroy(&pool->mutex); #ifdef LDAP_MAX_CONNECTIONS ci_thread_cond_destroy(&pool->pool_cond); #endif free(pool); } LDAP *ldap_connection_open(struct ldap_connections_pool *pool) { struct ldap_connection *conn; struct berval ldap_passwd, *servercred; int ret; char *ldap_user; if (ci_thread_mutex_lock(&pool->mutex)!=0) return NULL; #ifdef LDAP_MAX_CONNECTIONS do { #endif if (pool->inactive) { conn = pool->inactive; pool->inactive = pool->inactive->next; conn->next = pool->used; pool->used = conn; conn->hits++; ci_thread_mutex_unlock(&pool->mutex); return conn->ldap; } #ifdef LDAP_MAX_CONNECTIONS if (pool->connections >= pool->max_connections) { /*wait for an ldap connection to be released. The condwait will unlock pool->mutex */ if (ci_thread_cond_wait(&(pool->pool_cond), &(pool->mutex)) != 0) { ci_thread_mutex_unlock(&(pool->mutex)); return NULL; } } } while(pool->connections >= pool->max_connections); #else ci_thread_mutex_unlock(&pool->mutex); #endif conn=malloc(sizeof(struct ldap_connection)); if (!conn) { #ifdef LDAP_MAX_CONNECTIONS ci_thread_mutex_unlock(&pool->mutex); #endif return NULL; } conn->hits = 1; ret = ldap_initialize(&conn->ldap, pool->ldap_uri); if (!conn->ldap){ #ifdef LDAP_MAX_CONNECTIONS ci_thread_mutex_unlock(&pool->mutex); #endif ci_debug_printf(1, "Error allocating memory for ldap connection: %s!\n", ldap_err2string(ret)); free(conn); return NULL; } ldap_set_option(conn->ldap, LDAP_OPT_PROTOCOL_VERSION, &(pool->ldapversion)); if (pool->user[0] != '\0') ldap_user = pool->user; else ldap_user = NULL; if (pool->password[0] != '\0') { ldap_passwd.bv_val = pool->password; ldap_passwd.bv_len = strlen(pool->password); } else { ldap_passwd.bv_val = NULL; ldap_passwd.bv_len = 0; } ret = ldap_sasl_bind_s( conn->ldap, ldap_user, LDAP_SASL_SIMPLE, &ldap_passwd, NULL, NULL, &servercred ); if (ret != LDAP_SUCCESS){ ci_debug_printf(1, "Error bind to ldap server: %s!\n",ldap_err2string(ret)); #ifdef LDAP_MAX_CONNECTIONS ci_thread_mutex_unlock(&pool->mutex); #endif ldap_unbind_ext_s(conn->ldap, NULL, NULL); free(conn); return NULL; } if(servercred) { ber_bvfree(servercred); } #ifdef LDAP_MAX_CONNECTIONS /*we are already locked*/ #else if (ci_thread_mutex_lock(&pool->mutex)!= 0) { ci_debug_printf(1, "Error locking mutex while opening ldap connection!\n"); ldap_unbind_ext_s(conn->ldap, NULL, NULL); free(conn); return NULL; } #endif pool->connections++; conn->next = pool->used; pool->used = conn; ci_thread_mutex_unlock(&pool->mutex); return conn->ldap; } int ldap_connection_release(struct ldap_connections_pool *pool, LDAP *ldap, int close_connection) { struct ldap_connection *cur,*prev; if (ci_thread_mutex_lock(&pool->mutex)!=0) return 0; for (prev = NULL, cur = pool->used; cur != NULL; prev = cur, cur = cur->next) { if (cur->ldap == ldap) { if(cur == pool->used) pool->used = pool->used->next; else prev->next = cur->next; break; } } if (!cur) { ci_debug_printf(0, "Not ldap connection in used list! THIS IS A BUG! please contact authors\n!"); close_connection = 1; } if (close_connection) { pool->connections--; ldap_unbind_ext_s(ldap, NULL, NULL); if (cur) free(cur); } else { cur->next = pool->inactive; pool->inactive = cur; } ci_thread_mutex_unlock(&pool->mutex); return 1; } /******************************************************/ /* ldap table implementation */ struct ldap_table_data { struct ldap_connections_pool *pool; char *str; char *base; char *server; int port; char *user; char *password; char **attrs; char *filter; char *name; ci_cache_t *cache; }; int parse_ldap_str(struct ldap_table_data *fields) { char *s, *e; int array_size, i; /*we are expecting a path in the form //[username:password@]ldapserver?base?attr1,attr2?filter*/ if(!fields->str) return 0; i = 0; s = fields->str; while(*s == '/'){ /*Ignore "//" at the beginning*/ s++; i++; } if (i != 2) return 0; /*Extract username/password if exists*/ if ((e=strrchr(s, '@')) != NULL) { fields->user = s; *e = '\0'; s = e + 1; if ((e=strchr(fields->user, ':')) != NULL) { *e = '\0'; fields->password = e + 1; ci_str_trim(fields->password); } ci_str_trim(fields->user); /* here we have parsed the user*/ } fields->server = s; /*The s points to the "server" field now*/ while(*s != '?' && *s != '/' && *s != '\0') s++; if (*s == '\0') return 0; *s = '\0'; ci_str_trim(fields->server); s++; fields->base = s; /*The s points to the "base" field now*/ while(*s != '?' && *s != '\0') s++; if (*s == '\0') return 0; *s = '\0'; ci_str_trim(fields->base); s++; e = s; /*Count the args*/ array_size = 1; while (*e != '?' && *e != '\0'){ if (*e == ',') array_size = array_size+1; e++; } if (*e == '\0') return 0; array_size = array_size+1; fields->attrs = (char **) malloc(array_size*sizeof(char *)); if (fields->attrs == NULL) return 0; fields->attrs[0] = s; i = 1; while (i < array_size-1){ while (*s != ',') s++; *s = '\0'; s++; fields->attrs[i] = s; /*Every pointer of the array points to an "arg", the last points NULL*/ i++; } while (*s != '?') s++; *s = '\0'; fields->attrs[i] = NULL; for(i=0; fields->attrs[i] != NULL; i++) ci_str_trim(fields->attrs[i]); s++; fields->filter = s; /*The s points to the "filter" field now*/ ci_str_trim(fields->filter); return 1; } void *ldap_table_open(struct ci_lookup_table *table) { int i; char *path; char tname[1024]; struct ldap_table_data *ldapdata; ci_dyn_array_t *args = NULL; ci_array_item_t *arg = NULL; char *use_cache = "local"; int cache_ttl = 60; size_t cache_size = 1*1024*1024; size_t cache_item_size = 2048; long int val; path = strdup(table->path); if (!path) { ci_debug_printf(1, "ldap_table_open: error allocating memory!\n"); return NULL; } ldapdata = malloc(sizeof(struct ldap_table_data)); if(!ldapdata) { free(path); ci_debug_printf(1, "ldap_table_open: error allocating memory (ldapdata)!\n"); return NULL; } ldapdata->str = path; ldapdata->pool = NULL; ldapdata->base = NULL; ldapdata->server = NULL; ldapdata->port = 389; ldapdata->user = NULL; ldapdata->password = NULL; ldapdata->attrs = NULL; ldapdata->filter = NULL; ldapdata->name = NULL; if(!parse_ldap_str(ldapdata)) { free(ldapdata->str); free(ldapdata); ci_debug_printf(1, "ldap_table_open: parse path string error!\n"); return NULL; } if (table->args) { if ((args = ci_parse_key_value_list(table->args, ','))) { for (i = 0; (arg = ci_dyn_array_get_item(args, i)) != NULL; ++i) { ci_debug_printf(5, "Table argument %s:%s\n", arg->name, (char *)arg->value); if(strcasecmp(arg->name, "name") == 0) { ldapdata->name = strdup((char *)arg->value); } else if(strcasecmp(arg->name, "cache") == 0) { if (strcasecmp((char *)arg->value, "no") == 0) use_cache = NULL; else use_cache = (char *)arg->value; } else if (strcasecmp(arg->name, "cache-ttl") == 0) { val = strtol((char *)arg->value, NULL, 10); if (val > 0) cache_ttl = val; else ci_debug_printf(1, "WARNING: wrong cache-ttl value: %ld, using default\n", val); } else if (strcasecmp(arg->name, "cache-size") == 0) { val = ci_atol_ext((char *)arg->value, NULL); if (val > 0) cache_size = (size_t)val; else ci_debug_printf(1, "WARNING: wrong cache-size value: %ld, using default\n", val); } else if (strcasecmp(arg->name, "cache-item-size") == 0) { val = ci_atol_ext((char *)arg->value, NULL); if (val > 0) cache_item_size = (size_t)val; else ci_debug_printf(1, "WARNING: wrong cache-item-size value: %ld, using default\n", val); } } } } ldapdata->pool = ldap_pool_create(ldapdata->server, ldapdata->port, ldapdata->user, ldapdata->password); if (use_cache) { snprintf(tname, sizeof(tname), "ldap:%s", ldapdata->name ? ldapdata->name : ldapdata->str); tname[sizeof(tname) - 1] = '\0'; ldapdata->cache = ci_cache_build(tname, use_cache, cache_size, cache_item_size, cache_ttl, &ci_str_ops); if(!ldapdata->cache) { ci_debug_printf(1, "ldap_table_open: can not create cache! cache is disabled"); } } else ldapdata->cache = NULL; table->data = ldapdata; /*Must released before exit, we have pointes pointing on args array items*/ if (args) ci_dyn_array_destroy(args); return table->data; } void ldap_table_close(struct ci_lookup_table *table) { struct ldap_table_data *ldapdata; ldapdata = (struct ldap_table_data *)table->data; table->data = NULL; //release ldapdata if(ldapdata) { free(ldapdata->str); if (ldapdata->name) free(ldapdata->name); if(ldapdata->cache) ci_cache_destroy(ldapdata->cache); free(ldapdata); } } int create_filter(char *filter,int size, char *frmt,char *key) { char *s,*o, *k; int i; s = frmt; o = filter; i = 0; size --; while (i < size && *s != '\0') { if (*s == '%' && *(s+1) == 's') { k = key; while (i < size && *k != '\0' ) { *o=*k; o++; k++; i++; } s+=2; continue; } *o = *s; o++; s++; i++; } filter[i] = '\0'; ci_debug_printf(5,"Table ldap search filterar is \"%s\"\n", filter); return 1; } void *ldap_table_search(struct ci_lookup_table *table, void *key, void ***vals) { struct ldap_table_data *data = (struct ldap_table_data *)table->data; LDAPMessage *msg, *entry; BerElement *aber; LDAP *ld; struct berval **attrs; void *return_value=NULL; char *attrname; int ret = 0, failures, i; ci_str_vector_t *vect = NULL; size_t v_size; char filter[MAX_LDAP_FILTER_SIZE]; char buf[2048]; *vals = NULL; failures = 0; return_value = NULL; if(data->cache && ci_cache_search(data->cache, key, (void **)&vect, NULL, &ci_cache_read_vector_val)) { ci_debug_printf(4, "Retrieving from cache....\n"); if (!vect) /*Negative hit*/ return NULL; *vals = (void **)ci_vector_cast_to_voidvoid(vect); return key; } create_filter(filter, MAX_LDAP_FILTER_SIZE, data->filter,key); while ((ld = ldap_connection_open(data->pool)) && failures < 5) { ret = ldap_search_ext_s(ld, data->base, /*base*/ LDAP_SCOPE_SUBTREE, /*scope*/ filter, /*filter*/ data->attrs, /*attrs*/ 0, /*attrsonly*/ NULL, /*serverctrls*/ NULL, /*clientctrls*/ NULL, /*timeout*/ -1, /*sizelimit*/ &msg /*res*/ ); ci_debug_printf(4, "Contacting LDAP server: %s\n", ldap_err2string(ret)); if(ret == LDAP_SUCCESS) { entry = ldap_first_entry(ld, msg); while(entry != NULL) { aber = NULL; attrname = ldap_first_attribute(ld, entry, &aber); while(attrname != NULL) { if (vect == NULL) { vect = ci_str_vector_create(MAX_DATA_SIZE); if (!vect) return NULL; } ci_debug_printf(8, "Retrieve attribute:%s. Values: ", attrname); attrs = ldap_get_values_len(ld, entry, attrname); for(i = 0; attrs[i] != NULL ; ++i) { //OpenLdap nowhere documents that the result is NULL terminated. // copy to an intermediate buffer and terminate it before store to vector v_size = sizeof(buf) <= attrs[i]->bv_len + 1 ? sizeof(buf) : attrs[i]->bv_len; memcpy(buf, attrs[i]->bv_val, v_size); buf[v_size] = '\0'; (void)ci_str_vector_add(vect, buf); ci_debug_printf(8, "%s,", buf); } ci_debug_printf(8, "\n"); ldap_value_free_len(attrs); attrname = ldap_next_attribute(ld, entry, aber); } if(aber) ber_free(aber, 0); if(!return_value) return_value = key; entry = ldap_next_entry(ld, entry); } ldap_msgfree(msg); ldap_connection_release(data->pool, ld, 0); if(data->cache) { v_size = vect != NULL ? ci_cache_store_vector_size(vect) : 0; ci_debug_printf(4, "adding to cache\n"); if (!ci_cache_update(data->cache, key, vect, v_size, ci_cache_store_vector_val)) ci_debug_printf(4, "adding to cache failed!\n"); } if (!vect) return NULL; *vals = (void **)ci_vector_cast_to_voidvoid(vect); return return_value; } ldap_connection_release(data->pool, ld, 1); if (ret != LDAP_SERVER_DOWN) { ci_debug_printf(1, "Error contacting LDAP server: %s\n", ldap_err2string(ret)); return NULL; } failures++; } ci_debug_printf(1, "Error LDAP server is down: %s\n", ldap_err2string(ret)); return NULL; } void ldap_table_release_result(struct ci_lookup_table *table,void **val) { ci_str_vector_t *v = ci_vector_cast_from_voidvoid((const void **)val); ci_str_vector_destroy(v); } c_icap-0.4.2/os/0000775000175000017500000000000012601747560010367 500000000000000c_icap-0.4.2/os/unix/0000775000175000017500000000000012601747560011352 500000000000000c_icap-0.4.2/os/unix/threads.c0000664000175000017500000001155112567550777013110 00000000000000/* * Copyright (C) 2004-2012 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "ci_threads.h" typedef struct mutex_itm mutex_itm_t; enum MTX_TYPE { MTX_MUTEX #ifdef USE_PTHREADS_RWLOCK , MTX_RWLOCK #endif }; struct mutex_itm { union { pthread_mutex_t *mutex; #ifdef USE_PTHREADS_RWLOCK pthread_rwlock_t *rwlock; #endif } mtx; int type; mutex_itm_t *next; }; pthread_mutex_t mutexes_lock = PTHREAD_MUTEX_INITIALIZER; static mutex_itm_t *mutexes = NULL; static mutex_itm_t *last = NULL; static int init_child_mutexes_scheduled = 0; static void init_child_mutexes() { mutex_itm_t *m; pthread_mutex_init(&mutexes_lock, NULL); for (m = mutexes; m != NULL; m = m->next) { switch (m->type) { case MTX_MUTEX: pthread_mutex_init(m->mtx.mutex, NULL); break; #ifdef USE_PTHREADS_RWLOCK case MTX_RWLOCK: pthread_rwlock_init(m->mtx.rwlock, NULL); break; #endif default: /*????????*/ break; } } } static mutex_itm_t *add_mutex(void *pmutex, int type) { mutex_itm_t *m = malloc(sizeof(mutex_itm_t)); if (!m) return NULL; switch (type) { case MTX_MUTEX: m->mtx.mutex = (pthread_mutex_t *)pmutex; break; #ifdef USE_PTHREADS_RWLOCK case MTX_RWLOCK: m->mtx.rwlock = (pthread_rwlock_t *)pmutex; break; #endif default: free(m); return NULL; } m->type = type; m->next = NULL; pthread_mutex_lock(&mutexes_lock); if (mutexes == NULL) { mutexes = m; last = m; } else { last->next = m; last = last->next; } if (!init_child_mutexes_scheduled) { pthread_atfork(NULL, NULL, init_child_mutexes); init_child_mutexes_scheduled = 1; } pthread_mutex_unlock(&mutexes_lock); return m; } static void del_mutex(void *pmutex) { mutex_itm_t *m,*p = NULL; pthread_mutex_lock(&mutexes_lock); for (m = mutexes; m != NULL; m = m->next) { if (m->mtx.mutex == pmutex) { if (p == NULL) /*first item*/ mutexes = mutexes->next; else p->next = m->next; free(m); pthread_mutex_unlock(&mutexes_lock); return; } p = m; } pthread_mutex_unlock(&mutexes_lock); } int ci_thread_mutex_init(ci_thread_mutex_t *pmutex) { int ret; ret = pthread_mutex_init(pmutex,NULL); if (ret != 0) return ret; add_mutex(pmutex, MTX_MUTEX); //assert result!=NULL? return ret; } int ci_thread_mutex_destroy(ci_thread_mutex_t *pmutex) { del_mutex(pmutex); return pthread_mutex_destroy(pmutex); } #ifdef USE_PTHREADS_RWLOCK int ci_thread_rwlock_init(ci_thread_rwlock_t *rwlock) { int ret; ret = pthread_rwlock_init(rwlock,NULL); if (ret != 0) return ret; add_mutex(rwlock, MTX_RWLOCK); //assert result!=NULL? return ret; } int ci_thread_rwlock_destroy(ci_thread_rwlock_t *rwlock) { del_mutex(rwlock); return pthread_rwlock_destroy(rwlock); } #else /*We can implement a better solution here using a mutex and a cond object to simulate rwlocks (TODO) */ int ci_thread_rwlock_init(ci_thread_rwlock_t * rwlock) { return ci_thread_mutex_init(rwlock, NULL); } int ci_thread_rwlock_destroy(ci_thread_rwlock_t * rwlock) { return ci_thread_mutex_destroy(rwlock); } int ci_thread_rwlock_rdlock(ci_thread_rwlock_t * rwlock) { return ci_thread_mutex_lock(rwlock); } int ci_thread_rwlock_wrlock(ci_thread_rwlock_t * rwlock) { return ci_thread_mutex_lock(rwlock); } int ci_thread_rwlock_unlock(ci_thread_rwlock_t * rwlock) { return ci_thread_mutex_unlock(rwlock); } #endif int ci_thread_cond_init(ci_thread_cond_t *pcond) { return pthread_cond_init(pcond,NULL); } int ci_thread_cond_destroy(ci_thread_cond_t *pcond) { return pthread_cond_destroy(pcond); } int ci_thread_create(ci_thread_t *pthread_id, void *(*pfunc)(void *), void *parg) { return pthread_create(pthread_id, NULL, pfunc, parg); } int ci_thread_join(ci_thread_t thread_id) { return pthread_join(thread_id,NULL); } c_icap-0.4.2/os/unix/dlib.c0000664000175000017500000000434612567550777012374 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include "debug.h" #include "dlib.h" #ifdef HAVE_DLFCN_H void *ci_module_load(const char *module_file, const char *default_path) { char path[CI_MAX_PATH]; void *handle; int len; if (module_file[0] != '/') { len = strlen(default_path) + strlen(module_file) + 1; /*plus the '/' delimiter */ if (len >= CI_MAX_PATH) { ci_debug_printf(1, "Path name len of %s+%s is greater than " "MAXPATH:%d, not loading\n", default_path, module_file, CI_MAX_PATH); return NULL; } strcpy(path, default_path); strcat(path, "/"); strcat(path, module_file); } else strncpy(path, module_file, CI_MAX_PATH - 1); path[CI_MAX_PATH - 1] = '\0'; handle = dlopen(path, RTLD_NOW | RTLD_GLOBAL); if (!handle) { char *error_str = dlerror (); ci_debug_printf(1, "Error loading module %s:%s\n", module_file, error_str); return NULL; } return handle; } void *ci_module_sym(void *handle, const char *symbol) { return dlsym(handle, symbol); } int ci_module_unload(void *handle, const char *name) { int ret; ret = dlclose(handle); if (ret == 1) { ci_debug_printf(1, "Error unloading module:%s\n", name); return 0; } return 1; } #endif c_icap-0.4.2/os/unix/proc_utils.c0000664000175000017500000001054512567550777013643 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include "debug.h" #include #include #include #include #include int store_pid(char *pidfile) { int fd, bytes; pid_t pid; char strPid[30]; /*30 must be enough for storing pids on a string */ pid = getpid(); if ((fd = open(pidfile, O_CREAT | O_TRUNC | O_WRONLY, 0644)) < 0) { ci_debug_printf(1, "Cannot open the pid file: %s\n", pidfile); return 0; } snprintf(strPid, 29, "%d", pid); strPid[29] = '\0'; bytes = write(fd, strPid, strlen(strPid)); close(fd); return 1; } int clear_pid(char *pidfile) { if ( 0 != remove(pidfile)) { ci_debug_printf(1, "Cannot delete the pid file: %s Error:%d\n", pidfile, errno); return 0; } return 1; } int is_icap_running(char *pidfile) { int fd, bytes, ret; pid_t pid; char strPid[30]; /*30 must be enough for storing pids on a string */ pid = getpid(); if ((fd = open(pidfile, O_RDONLY, 0644)) < 0) { return 0; } bytes = read(fd, strPid, sizeof(strPid)); close(fd); if (bytes < 0) return 0; if (bytes < sizeof(strPid) - 1) strPid[bytes] = '\0'; else strPid[sizeof(strPid) - 1] = '\0'; /*Maybe check for errors? */ pid = strtol(strPid, NULL, 10); if (pid <= 0) /*garbage */ return 0; ret = kill(pid, 0); if (ret < 0) return 0; return 1; } int set_running_permissions(char *user, char *group) { unsigned int uid, gid; char *pend; struct passwd *pwd; struct group *grp; if (group) { /*Configuration request to change ours group id */ errno = 0; gid = strtol(group, &pend, 10); if (pend != '\0' || gid < 0 || errno != 0) { /*string "group" does not contains a clear number */ if ((grp = getgrnam(group)) == NULL) { ci_debug_printf(1, "There is no group %s in password file!\n", group); return 0; } gid = grp->gr_gid; } else if (getgrgid(gid) == NULL) { ci_debug_printf(1, "There is no group with id=%d in password file!\n", gid); return 0; } if (setgid(gid) != 0) { ci_debug_printf(1, "setgid to %d failed!!!!\n", gid); perror("Wtat is this; "); return 0; } } if (user) { /*Gonfiguration request to change ours user id */ errno = 0; uid = strtol(user, &pend, 10); if (pend != '\0' || uid < 0 || errno != 0) { /*string "user" does not contain a clear number */ if ((pwd = getpwnam(user)) == NULL) { ci_debug_printf(1, "There is no user %s in password file!\n", user); return 0; } uid = pwd->pw_uid; } else if (getpwuid(uid) == NULL) { ci_debug_printf(1, "There is no user with id=%d in password file!\n", uid); return 0; } if (setuid(uid) != 0) { ci_debug_printf(1, "setuid to %d failed!!!!\n", uid); return 0; } } return 1; } c_icap-0.4.2/os/unix/proc_mutex.c0000664000175000017500000002031012575757113013624 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include "debug.h" #include "proc_mutex.h" #include #include #include #if defined(USE_SYSV_IPC_MUTEX) #define SEMKEY 888888L /*A key but what key;The IPC_PRIVATE must used instead ..... */ #define PERMS 0600 /*static int current_semkey=SEMKEY; */ static struct sembuf op_lock[2] = { {0, 0, 0}, /*wait for sem to become 0 */ {0, 1, SEM_UNDO} /*then increment sem by 1 */ }; static struct sembuf op_unlock[1] = { {0, -1, (IPC_NOWAIT | SEM_UNDO)} /*decrement sem by 1 */ }; #ifndef HAVE_UNION_SEMUN union semun { int val; /* Value for SETVAL */ struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */ unsigned short *array; /* Array for GETALL, SETALL */ struct seminfo *__buf; /* Buffer for IPC_INFO (Linux specific) */ }; #endif static int sysv_proc_mutex_init(ci_proc_mutex_t * mutex, const char *name) { union semun arg; if ((mutex->sysv.id = semget(IPC_PRIVATE, 1, IPC_CREAT | PERMS)) < 0) { ci_debug_printf(1, "Error creating mutex\n"); return 0; } arg.val = 0; if ((semctl(mutex->sysv.id, 0, SETVAL, arg)) < 0) { ci_debug_printf(1, "Error setting default value for mutex, errno:%d\n", errno); return 0; } strncpy(mutex->name, name, CI_PROC_MUTEX_NAME_SIZE); mutex->name[CI_PROC_MUTEX_NAME_SIZE - 1] = '\0'; return 1; } static int sysv_proc_mutex_destroy(ci_proc_mutex_t * mutex) { if (semctl(mutex->sysv.id, 0, IPC_RMID, 0) < 0) { ci_debug_printf(1, "Error removing mutex\n"); return 0; } return 1; } static int sysv_proc_mutex_lock(ci_proc_mutex_t * mutex) { if (semop(mutex->sysv.id, (struct sembuf *) &op_lock, 2) < 0) { return 0; } return 1; } static int sysv_proc_mutex_unlock(ci_proc_mutex_t * mutex) { if (semop(mutex->sysv.id, (struct sembuf *) &op_unlock, 1) < 0) { return 0; } return 1; } static int sysv_proc_mutex_print_info(ci_proc_mutex_t * mutex, char *buf, size_t buf_size) { return snprintf(buf, buf_size, "sysv:%s/%d", mutex->name, mutex->sysv.id); } static ci_proc_mutex_scheme_t sysv_mutex_scheme = { sysv_proc_mutex_init, sysv_proc_mutex_destroy, sysv_proc_mutex_lock, sysv_proc_mutex_unlock, sysv_proc_mutex_print_info, "sysv" }; #endif #if defined(USE_POSIX_SEMAPHORES) #define CI_PROC_MUTEX_NAME_TMPL "/c-icap-sem." static int posix_proc_mutex_init(ci_proc_mutex_t * mutex, const char *name) { int i = 0; mutex->posix.sem = SEM_FAILED; for(i = 0; i < 1024; ++i) { errno = 0; snprintf(mutex->name, CI_PROC_MUTEX_NAME_SIZE, "%s%s.%d", CI_PROC_MUTEX_NAME_TMPL, name, i); if ((mutex->posix.sem = sem_open(mutex->name, O_CREAT|O_EXCL, S_IREAD|S_IWRITE|S_IRGRP, 1)) != SEM_FAILED) { return 1; } if (errno != EEXIST) break; } if (errno == EEXIST) { ci_debug_printf(1, "Error allocation posix proc mutex, to many c-icap mutexes are open!\n"); } else { ci_debug_printf(1, "Error allocation posix proc mutex, errno: %d\n", errno); } return 0; } static int posix_proc_mutex_destroy(ci_proc_mutex_t * mutex) { if (sem_unlink(mutex->name) < 0) { return 0; } return 1; } static int posix_proc_mutex_lock(ci_proc_mutex_t * mutex) { if (sem_wait(mutex->posix.sem)) { ci_debug_printf(1, "Failed to get lock of posix mutex\n"); return 0; } return 1; } static int posix_proc_mutex_unlock(ci_proc_mutex_t * mutex) { if (sem_post(mutex->posix.sem)) { ci_debug_printf(1, "Failed to unlock of posix mutex\n"); return 0; } return 1; } static int posix_proc_mutex_print_info(ci_proc_mutex_t * mutex, char *buf, size_t buf_size) { return snprintf(buf, buf_size, "posix:%s", mutex->name); } static ci_proc_mutex_scheme_t posix_mutex_scheme = { posix_proc_mutex_init, posix_proc_mutex_destroy, posix_proc_mutex_lock, posix_proc_mutex_unlock, posix_proc_mutex_print_info, "posix" }; #endif #if defined (USE_POSIX_FILE_LOCK) #define CI_MUTEX_FILE_TEMPLATE "/tmp/icap_lock" /*NOTE: mkstemp does not exists for some platforms */ static int file_proc_mutex_init(ci_proc_mutex_t * mutex, const char *name) { strcpy(mutex->name, CI_MUTEX_FILE_TEMPLATE); snprintf(mutex->name, CI_PROC_MUTEX_NAME_SIZE, "%s_%s.XXXXXX", CI_MUTEX_FILE_TEMPLATE, name); if ((mutex->file.fd = mkstemp(mutex->name)) < 0) return 0; return 1; } static int file_proc_mutex_destroy(ci_proc_mutex_t * mutex) { close(mutex->file.fd); if (unlink(mutex->name) != 0) return 0; return 1; } static int file_proc_mutex_lock(ci_proc_mutex_t * mutex) { struct flock fl; fl.l_type = F_WRLCK; fl.l_whence = SEEK_SET; fl.l_start = 0; fl.l_len = 0; if (fcntl(mutex->file.fd, F_SETLKW, &fl) < 0) return 0; return 1; } static int file_proc_mutex_unlock(ci_proc_mutex_t * mutex) { struct flock fl; fl.l_type = F_UNLCK; fl.l_whence = SEEK_SET; fl.l_start = 0; fl.l_len = 0; if (fcntl(mutex->file.fd, F_SETLK, &fl) < 0) return 0; return 1; } static int file_proc_mutex_print_info(ci_proc_mutex_t * mutex, char *buf, size_t buf_size) { return snprintf(buf, buf_size, "file:%s", mutex->name); } static ci_proc_mutex_scheme_t file_mutex_scheme = { file_proc_mutex_init, file_proc_mutex_destroy, file_proc_mutex_lock, file_proc_mutex_unlock, file_proc_mutex_print_info, "file" }; #endif #if defined(USE_POSIX_FILE_LOCK) const ci_proc_mutex_scheme_t *default_mutex_scheme = &file_mutex_scheme; #elif defined(USE_SYSV_IPC_MUTEX) const ci_proc_mutex_scheme_t *default_mutex_scheme = &sysv_mutex_scheme; #elif defined(USE_POSIX_SEMAPHORES) const ci_proc_mutex_scheme_t *default_mutex_scheme = &posix_mutex_scheme; #else const ci_proc_mutex_scheme_t *default_mutex_scheme = NULL; #endif const ci_proc_mutex_scheme_t *ci_proc_mutex_default_scheme() { return default_mutex_scheme; } int ci_proc_mutex_set_scheme(const char *scheme) { #if defined(USE_SYSV_IPC_MUTEX) if (strcasecmp(scheme, "sysv") == 0) default_mutex_scheme = &sysv_mutex_scheme; else #endif #if defined(USE_POSIX_SEMAPHORES) if (strcasecmp(scheme, "posix") == 0) default_mutex_scheme = &posix_mutex_scheme; else #endif #if defined(USE_POSIX_FILE_LOCK) if (strcasecmp(scheme, "file") == 0) default_mutex_scheme = &file_mutex_scheme; else #endif { ci_debug_printf(1, "Unknown interprocess locking scheme: '%s'", scheme); return 0; } return 1; } int ci_proc_mutex_init(ci_proc_mutex_t *mutex, const char *name) { if (default_mutex_scheme) { mutex->scheme = default_mutex_scheme; return default_mutex_scheme->proc_mutex_init(mutex, name); } return 0; } int ci_proc_mutex_destroy(ci_proc_mutex_t *mutex) { if (mutex->scheme) return mutex->scheme->proc_mutex_destroy(mutex); return 0; } int ci_proc_mutex_lock(ci_proc_mutex_t *mutex) { if (mutex->scheme) return mutex->scheme->proc_mutex_lock(mutex); return 0; } int ci_proc_mutex_unlock(ci_proc_mutex_t *mutex) { if (mutex->scheme) return mutex->scheme->proc_mutex_unlock(mutex); return 0; } c_icap-0.4.2/os/unix/shared_mem.c0000664000175000017500000001511112567550777013556 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include "debug.h" #include "shared_mem.h" #include #if defined(USE_SYSV_IPC) #include #include #endif #if defined(USE_POSIX_MAPPED_FILES) #include #endif #include #include #define PERMS 0600 #if defined(USE_SYSV_IPC) void *sysv_shared_mem_create(ci_shared_mem_id_t * id, const char *name, int size) { if ((id->sysv.id = shmget(IPC_PRIVATE, size, PERMS | IPC_CREAT)) < 0) { return NULL; } if ((id->mem = shmat(id->sysv.id, NULL, 0)) == (void *) -1) { return NULL; } id->size = size; snprintf(id->name, CI_SHARED_MEM_NAME_SIZE, "%s", name); return id->mem; } void *sysv_shared_mem_attach(ci_shared_mem_id_t * id) { if ((id->mem = shmat(id->sysv.id, NULL, 0)) == (void *) -1) { return NULL; } return id->mem; } int sysv_shared_mem_detach(ci_shared_mem_id_t * id) { if (shmdt(id->mem) < 0) { return 0; } return 1; } int sysv_shared_mem_destroy(ci_shared_mem_id_t * id) { if (shmdt(id->mem) < 0) return 0; if (shmctl(id->sysv.id, IPC_RMID, NULL) < 0) return 0; return 1; } int sysv_shared_mem_print_info(ci_shared_mem_id_t *id, char *buf, size_t buf_size) { return snprintf(buf, buf_size, "sysv:%s/%d %ld kbs", id->name, id->sysv.id, (long)(id->size/1024)); } const ci_shared_mem_scheme_t sysv_scheme = { sysv_shared_mem_create, sysv_shared_mem_attach, sysv_shared_mem_detach, sysv_shared_mem_destroy, sysv_shared_mem_print_info, "sysv" }; #endif #if defined(USE_POSIX_MAPPED_FILES) void *mmap_shared_mem_create(ci_shared_mem_id_t * id, const char *name, int size) { if ((id->mem = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0)) == MAP_FAILED) return NULL; id->size = size; snprintf(id->name, CI_SHARED_MEM_NAME_SIZE, "%s", name); return id->mem; } void *mmap_shared_mem_attach(ci_shared_mem_id_t * id) { return (void *) (id->mem); } int mmap_shared_mem_detach(ci_shared_mem_id_t * id) { return 1; } int mmap_shared_mem_destroy(ci_shared_mem_id_t * id) { munmap(id->mem, id->size); return 1; } int mmap_shared_mem_print_info(ci_shared_mem_id_t *id, char *buf, size_t buf_size) { return snprintf(buf, buf_size, "mmap:%s/%p %ld kbs", id->name, id->mem, (long)(id->size/1024)); } const ci_shared_mem_scheme_t mmap_scheme = { mmap_shared_mem_create, mmap_shared_mem_attach, mmap_shared_mem_detach, mmap_shared_mem_destroy, mmap_shared_mem_print_info, "mmap" }; #endif #if defined (USE_POSIX_SHARED_MEM) #define CI_SHARED_MEM_NAME_TMPL "/c-icap-shared" void *posix_shared_mem_create(ci_shared_mem_id_t * id, const char *name, int size) { int i; id->size = size; for (i = 0; i < 1024; ++i) { errno = 0; snprintf(id->name, CI_SHARED_MEM_NAME_SIZE, "%s-%s.%d", CI_SHARED_MEM_NAME_TMPL, name, i); id->posix.fd = shm_open(id->name, O_RDWR | O_CREAT | O_EXCL, S_IREAD | S_IWRITE); (void)ftruncate(id->posix.fd, id->size); if (id->posix.fd >= 0) { id->mem = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, id->posix.fd, 0); if (id->mem == MAP_FAILED) { ci_debug_printf(1, "Posix mem: Failed to created shared memory!\n"); return NULL; } return id->mem; } } return NULL; } void *posix_shared_mem_attach(ci_shared_mem_id_t * id) { return (id->mem); } int posix_shared_mem_detach(ci_shared_mem_id_t * id) { munmap(id->mem, id->size); /* close(id->posix.fd); Is this needed?*/ id->mem = NULL; return 1; } int posix_shared_mem_destroy(ci_shared_mem_id_t * id) { munmap(id->mem, id->size); close(id->posix.fd); id->mem = NULL; shm_unlink(id->name); return 1; } int posix_shared_mem_print_info(ci_shared_mem_id_t *id, char *buf, size_t buf_size) { return snprintf(buf, buf_size, "posix:%s %ld kbs", id->name, (long)(id->size/1024)); } const ci_shared_mem_scheme_t posix_scheme = { posix_shared_mem_create, posix_shared_mem_attach, posix_shared_mem_detach, posix_shared_mem_destroy, posix_shared_mem_print_info, "posix" }; #endif #if defined(USE_POSIX_SHARED_MEM) const ci_shared_mem_scheme_t *default_scheme = &posix_scheme; #elif defined(USE_POSIX_MAPPED_FILES) const ci_shared_mem_scheme_t *default_scheme = &mmap_scheme; #elif defined(USE_SYSV_IPC) const ci_shared_mem_scheme_t *default_scheme = &sysv_scheme; #else const ci_shared_mem_scheme_t *default_scheme = NULL; #endif int ci_shared_mem_set_scheme(const char *name) { #if defined(USE_POSIX_SHARED_MEM) if (strcasecmp(name, "posix") == 0) default_scheme = &posix_scheme; else #endif #if defined(USE_POSIX_MAPPED_FILES) if (strcasecmp(name, "mmap") == 0) default_scheme = &mmap_scheme; else #endif #if defined(USE_SYSV_IPC) if (strcasecmp(name, "sysv") == 0) default_scheme = &sysv_scheme; else #endif { ci_debug_printf(1, "Shared mem scheme '%s' does not supported by c-icap\n", name); return 0; } return 1; } void *ci_shared_mem_create(ci_shared_mem_id_t * id, const char *name, int size) { if (!default_scheme) return NULL; id->scheme = default_scheme; return default_scheme->shared_mem_create(id, name, size); } void *ci_shared_mem_attach(ci_shared_mem_id_t * id) { assert(id && id->scheme); return id->scheme->shared_mem_attach(id); } int ci_shared_mem_detach(ci_shared_mem_id_t * id) { assert(id && id->scheme); return id->scheme->shared_mem_detach(id); } int ci_shared_mem_destroy(ci_shared_mem_id_t * id) { assert(id && id->scheme); return id->scheme->shared_mem_destroy(id); } c_icap-0.4.2/os/unix/net_io.c0000664000175000017500000002275712567550777012745 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include #include #include #include #include #include "debug.h" #include "net_io.h" const char *ci_sockaddr_t_to_host(ci_sockaddr_t * addr, char *hname, int maxhostlen) { getnameinfo((const struct sockaddr *)&(addr->sockaddr), addr->ci_sin_family == AF_INET6 ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in), hname, maxhostlen - 1, NULL, 0, 0); return (const char *) hname; } #ifdef USE_IPV6 int icap_init_server_ipv6(char *address, int port, int *protocol_family, int secs_to_linger) { int fd; struct sockaddr_in6 addr; fd = socket(AF_INET6, SOCK_STREAM, 0); if (fd == -1) { ci_debug_printf(1, "Error opening ipv6 socket ....\n"); return CI_SOCKET_ERROR; } icap_socket_opts(fd, secs_to_linger); memset(&addr, 0, sizeof(addr)); addr.sin6_family = AF_INET6; addr.sin6_port = htons(port); if(address == NULL) // ListenAddress is not set in configuration file. Bind to all interfaces addr.sin6_addr = in6addr_any; else { if(inet_pton(AF_INET6, address, (void *) &addr.sin6_addr) != 1) { ci_debug_printf(1, "Error converting ipv6 address to the network byte order \n"); close(fd); return CI_SOCKET_ERROR; } } if (bind(fd, (struct sockaddr *) &addr, sizeof(addr))) { ci_debug_printf(1, "Error bind at ipv6 address \n");; close(fd); return CI_SOCKET_ERROR; } if (listen(fd, 512)) { ci_debug_printf(1, "Error listening to ipv6 address.....\n"); close(fd); return CI_SOCKET_ERROR; } *protocol_family = AF_INET6; return fd; } #endif int icap_init_server(char *address, int port, int *protocol_family, int secs_to_linger) { int fd; struct sockaddr_in addr; #ifdef USE_IPV6 if ((fd = icap_init_server_ipv6(address, port, protocol_family, secs_to_linger)) != CI_SOCKET_ERROR) return fd; ci_debug_printf(1, "WARNING! Error binding to an ipv6 address. Trying ipv4...\n"); #endif fd = socket(AF_INET, SOCK_STREAM, 0); if (fd == -1) { ci_debug_printf(1, "Error opening socket ....\n"); return CI_SOCKET_ERROR; } icap_socket_opts(fd, secs_to_linger); memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(port); if(address == NULL) // ListenAddress is not set in configuration file addr.sin_addr.s_addr = INADDR_ANY; else if(inet_pton(AF_INET, address, (void *) &addr.sin_addr.s_addr) != 1) { ci_debug_printf(1, "Error converting ipv4 address to the network byte order \n"); close(fd); return CI_SOCKET_ERROR; } if (bind(fd, (struct sockaddr *) &addr, sizeof(addr))) { ci_debug_printf(1, "Error binding \n");; return CI_SOCKET_ERROR; } if (listen(fd, 512)) { ci_debug_printf(1, "Error listening .....\n"); return CI_SOCKET_ERROR; } *protocol_family = AF_INET; return fd; } int icap_socket_opts(ci_socket fd, int secs_to_linger) { struct linger li; int value; /* if (fcntl(fd, F_SETFD, 1) == -1) { ci_debug_printf(1,"can't set close-on-exec on server socket!"); } */ value = 1; if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &value, sizeof(value)) == -1) { ci_debug_printf(1, "setsockopt: unable to set SO_REUSEADDR\n"); } value = 1; if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value)) == -1) { ci_debug_printf(1, "setsockopt: unable to set TCP_NODELAY\n"); } li.l_onoff = 1; li.l_linger = secs_to_linger; /*MAX_SECS_TO_LINGER; */ if (setsockopt(fd, SOL_SOCKET, SO_LINGER, (char *) &li, sizeof(struct linger)) < 0) { ci_debug_printf(1, "setsockopt: unable to set SO_LINGER \n"); } return 1; } int ci_netio_init(int fd) { fcntl(fd, F_SETFL, O_NONBLOCK); //Setting newfd descriptor to nonblocking state.... return 1; } /* int ci_wait_for_data(ci_socket fd,int secs,int what_wait){ fd_set fds,*rfds,*wfds; struct timeval tv; int ret; if(secs>=0){ tv.tv_sec=secs; tv.tv_usec=0; } FD_ZERO(&fds); FD_SET(fd,&fds); if(what_wait==wait_for_read){ rfds=&fds; wfds=NULL; } else{ wfds=&fds; rfds=NULL; } if((ret=select(fd+1,rfds,wfds,NULL,(secs>=0?&tv:NULL)))>0) return 1; if(ret<0){ ci_debug_printf(1,"Fatal error while waiting for new data....\n"); } return 0; } */ int ci_wait_for_data(int fd, int secs, int what_wait) { fd_set rfds, wfds, *preadfds, *pwritefds; struct timeval tv; int ret = 0; if (secs >= 0) { tv.tv_sec = secs; tv.tv_usec = 0; } preadfds = NULL; pwritefds = NULL; if (what_wait & wait_for_read) { FD_ZERO(&rfds); FD_SET(fd, &rfds); preadfds = &rfds; } if (what_wait & wait_for_write) { FD_ZERO(&wfds); FD_SET(fd, &wfds); pwritefds = &wfds; } errno = 0; if ((ret = select(fd + 1, preadfds, pwritefds, NULL, (secs >= 0 ? &tv : NULL))) > 0) { ret = 0; if (preadfds && FD_ISSET(fd, preadfds)) ret = wait_for_read; if (pwritefds && FD_ISSET(fd, pwritefds)) ret = ret | wait_for_write; return ret; } if (ret < 0 && errno != EINTR) { ci_debug_printf(5, "Fatal error while waiting for new data (errno=%d....\n", errno); return -1; } return 0; } int ci_read(int fd, void *buf, size_t count, int timeout) { int bytes = 0; do { bytes = read(fd, buf, count); } while (bytes == -1 && errno == EINTR); if (bytes == -1 && errno == EAGAIN) { if (!ci_wait_for_data(fd, timeout, wait_for_read)) { return bytes; } do { bytes = read(fd, buf, count); } while (bytes == -1 && errno == EINTR); } if (bytes == 0) { return -1; } return bytes; } int ci_write(int fd, const void *buf, size_t count, int timeout) { int bytes = 0; int remains = count; char *b = (char *) buf; while (remains > 0) { //write until count bytes written do { bytes = write(fd, b, remains); } while (bytes == -1 && errno == EINTR); if (bytes == -1 && errno == EAGAIN) { if (!ci_wait_for_data(fd, timeout, wait_for_write)) { return bytes; } do { bytes = write(fd, b, remains); } while (bytes == -1 && errno == EINTR); } if (bytes < 0) return bytes; b = b + bytes; //points to remaining bytes...... remains = remains - bytes; } //Ok...... return count; } int ci_read_nonblock(int fd, void *buf, size_t count) { int bytes = 0; do { bytes = read(fd, buf, count); } while (bytes == -1 && errno == EINTR); if (bytes < 0 && errno == EAGAIN) return 0; return bytes; } int ci_write_nonblock(int fd, const void *buf, size_t count) { int bytes = 0; do { bytes = write(fd, buf, count); } while (bytes == -1 && errno == EINTR); if (bytes < 0 && errno == EAGAIN) return 0; return bytes; } int ci_linger_close(int fd, int timeout) { char buf[10]; int ret; ci_debug_printf(8, "Waiting to close connection\n"); if (shutdown(fd, SHUT_WR) != 0) { close(fd); return 1; } while (ci_wait_for_data(fd, timeout, wait_for_read) && (ret = ci_read_nonblock(fd, buf, 10)) > 0) ci_debug_printf(10, "OK I linger %d bytes.....\n", ret); close(fd); ci_debug_printf(8, "Connection closed ...\n"); return 1; } int ci_hard_close(int fd) { close(fd); return 1; } /* int readline(int fd,char *buf){ int i=0,readed=0; char c,oc=0; while((readed=icap_read(fd,&c,1))>0 && c!='\n' && i0 && c!='\n'); } return i; } */ c_icap-0.4.2/os/unix/utilfunc.c0000664000175000017500000000420612567550777013306 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include #include "util.h" #include static const char *days[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; void ci_strtime(char *buf) { struct tm br_tm; time_t tm; time(&tm); asctime_r(localtime_r(&tm, &br_tm), buf); buf[STR_TIME_SIZE - 1] = '\0'; buf[strlen(buf) - 1] = '\0'; } void ci_strtime_rfc822(char *buf) { struct tm br_tm; time_t tm; time(&tm); gmtime_r(&tm, &br_tm); snprintf(buf, STR_TIME_SIZE, "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", days[br_tm.tm_wday], br_tm.tm_mday, months[br_tm.tm_mon], br_tm.tm_year + 1900, br_tm.tm_hour, br_tm.tm_min, br_tm.tm_sec); buf[STR_TIME_SIZE - 1] = '\0'; } int ci_mktemp_file(char *dir, char *template, char *filename) { snprintf(filename, CI_FILENAME_LEN, "%s%s",dir,template); filename[CI_FILENAME_LEN-1] = '\0'; return mkstemp(filename); } int ci_usleep(unsigned long usec) { struct timespec us, ur; us.tv_sec = 0; us.tv_nsec = usec * 1000; nanosleep(&us, &ur); return 0; } c_icap-0.4.2/os/win32/0000775000175000017500000000000012601747560011331 500000000000000c_icap-0.4.2/os/win32/threads.c0000664000175000017500000000634412567550777013073 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "ci_threads.h" int ci_thread_mutex_init(ci_thread_mutex_t * pmutex) { InitializeCriticalSection(pmutex); return 0; } int ci_thread_mutex_destroy(ci_thread_mutex_t * pmutex) { DeleteCriticalSection(pmutex); return 0; } int ci_thread_mutex_lock(ci_thread_mutex_t * pmutex) { EnterCriticalSection(pmutex); return 0; } int ci_thread_mutex_unlock(ci_thread_mutex_t * pmutex) { LeaveCriticalSection(pmutex); return 0; } int ci_thread_cond_init(ci_thread_cond_t * pcond) { *pcond = CreateEvent(NULL, FALSE, FALSE, NULL); return 0; } int ci_thread_cond_destroy(ci_thread_cond_t * pcond) { CloseHandle(*pcond); *pcond = NULL; return 0; } int ci_thread_cond_wait(ci_thread_cond_t * pcond, ci_thread_mutex_t * pmutex) { ci_thread_mutex_unlock(pmutex); WaitForSingleObject(*pcond, INFINITE); ci_thread_mutex_lock(pmutex); return 0; } int ci_thread_cond_broadcast(ci_thread_cond_t * pcond) { SetEvent(*pcond); /*This do not work with autoreset events. But now the ci_thread_cond_broadcast not used by the c-icap server. SS: This is wrong used by worker thread to kill childs..... */ return 0; } int ci_thread_cond_signal(ci_thread_cond_t * pcond) { SetEvent(*pcond); return 0; } int ci_thread_create(ci_thread_t * pthread_id, void *(*pfunc) (void *), void *parg) { *pthread_id = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) pfunc, parg, 0, NULL); return 0; } int ci_thread_join(ci_thread_t thread_id) { if (WaitForSingleObject(thread_id, INFINITE) == WAIT_FAILED) { return -1; } return 0; } /*Needs some work to implement a better solution here. At Vista there are a number of related functions, but for Windows 2000/XP?? */ int ci_thread_rwlock_init(ci_thread_rwlock_t * rwlock) { InitializeCriticalSection(rwlock); return 0; } int ci_thread_rwlock_destroy(ci_thread_rwlock_t * rwlock) { DeleteCriticalSection(rwlock); return 0; } int ci_thread_rwlock_rdlock(ci_thread_rwlock_t * rwlock) { EnterCriticalSection(rwlock); return 0; } int ci_thread_rwlock_wrlock(ci_thread_rwlock_t * rwlock) { EnterCriticalSection(rwlock); return 0; } int ci_thread_rwlock_unlock(ci_thread_rwlock_t * rwlock) { LeaveCriticalSection(rwlock); return 0; } c_icap-0.4.2/os/win32/makefile.w320000664000175000017500000000106512567550777013402 00000000000000!include UTILS_OBJS=shared_mem.obj proc_mutex.obj net_io.obj threads.obj utilfunc.obj all: dll_entry.obj utils.lib .c.obj: $(cc) -I..\..\include -I..\..\ $(cdebug) $(cflags) $(cvarsdll) -I. -DCI_BUILD_LIB -DUNICODE $*.c # Previous line is the correct if we include utils.lib in c_icap.dll # $(cc) -I..\..\include -I..\..\ $(cdebug) $(cflags) $(cvarsmt) -I. -DUNICODE $*.c utils.lib: $(UTILS_OBJS) echo "Do not make the lib so nothing to do....." # $(link) /LIB $(linkdebug) -out:$*.lib $** $(EXTRA_LIBS) clean: del *.obj *.exe *.lib c_icap-0.4.2/os/win32/proc_mutex.c0000664000175000017500000000306312567550777013621 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "c-icap.h" #include #include "debug.h" #include "proc_mutex.h" #include int ci_proc_mutex_init(ci_proc_mutex_t * mutex, const char *name) { snprintf(mutex->name, CI_PROC_MUTEX_NAME_SIZE, "Local\%s", name); /*TODO: use named mutex*/ if ((mutex->id = CreateMutex(NULL, FALSE, NULL)) == NULL) { ci_debug_printf(1, "Error creating mutex:%d\n", GetLastError()); return 0; } return 1; } int ci_proc_mutex_destroy(ci_proc_mutex_t * mutex) { CloseHandle(mutex->id); return 1; } int ci_proc_mutex_lock(ci_proc_mutex_t * mutex) { WaitForSingleObject(mutex->id, INFINITE); return 1; } int ci_proc_mutex_unlock(ci_proc_mutex_t * mutex) { ReleaseMutex(mutex->id); return 1; } c_icap-0.4.2/os/win32/shared_mem.c0000664000175000017500000000664712567550777013553 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include #include "c-icap.h" #include "debug.h" #include "shared_mem.h" void *ci_shared_mem_create(ci_shared_mem_id_t * id, const char *name, int size) { HANDLE hMapFile; LPVOID lpMapAddress; SECURITY_ATTRIBUTES saAttr; saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); saAttr.bInheritHandle = TRUE; saAttr.lpSecurityDescriptor = NULL; hMapFile = CreateFileMapping(INVALID_HANDLE_VALUE, // current file handle NULL, // default security PAGE_READWRITE, // read/write permission 0, // First 32 bit of size (Not used) size, // Second 32 bit of size NULL); // name of mapping object if (hMapFile == NULL) { ci_debug_printf(1, "Could not create file mapping object:(error:%d)\n", GetLastError()); return NULL; } lpMapAddress = MapViewOfFile(hMapFile, // handle to mapping object FILE_MAP_ALL_ACCESS, // read/write permission 0, // max. object size 0, // size of hFile 0); // map entire file if (lpMapAddress == NULL) { ci_debug_printf(1, "Could not map view of file.(error:%d)\n", GetLastError()); CloseHandle(hMapFile); return NULL; } strncpy(id->name, name, CI_SHARED_MEM_NAME_SIZE); id->size = size; id->id = hMapFile; id->mem = lpMapAddress; return lpMapAddress; } void *ci_shared_mem_attach(ci_shared_mem_id_t * id) { LPVOID lpMapAddress; lpMapAddress = MapViewOfFile(id->id, // handle to mapping object FILE_MAP_ALL_ACCESS, // read/write permission 0, // max. object size 0, // size of hFile 0); // map entire file if (lpMapAddress == NULL) { ci_debug_printf(1, "Could not map view of file.(error:%d)\n", GetLastError()); CloseHandle(id->id); return NULL; } id->mem = lpMapAddress; return lpMapAddress; } int ci_shared_mem_detach(ci_shared_mem_id_t * id) { CloseHandle(id->id); UnmapViewOfFile(id->mem); return 1; } int ci_shared_mem_destroy(ci_shared_mem_id_t * id) { CloseHandle(id->id); UnmapViewOfFile(id->mem); return 1; } c_icap-0.4.2/os/win32/net_io.c0000664000175000017500000002004312567550777012706 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "c-icap.h" #include #include "debug.h" #include "net_io.h" #include "cfg_param.h" int icap_socket_opts(ci_socket fd, int secs_to_linger); const char *ci_sockaddr_t_to_host(ci_sockaddr_t * addr, char *hname, int maxhostlen) { /* getnameinfo(&(addr->sockaddr), CI_SOCKADDR_SIZE,hname,maxhostlen-1,NULL,0,0); return (const char *)hname; */ return NULL; } int windows_init() { WORD wVersionRequested; WSADATA wsaData; int err; wVersionRequested = MAKEWORD(2, 2); err = WSAStartup(wVersionRequested, &wsaData); if (err != 0) { return 0; } if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2) { WSACleanup(); return 0; } return 1; } ci_socket icap_init_server(int port, int *protocol_family, int secs_to_linger) { ci_socket s; int er; struct sockaddr_in addr; if (!windows_init()) { ci_debug_printf(1, "Error initialize windows sockets...\n"); } s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (s == INVALID_SOCKET) { er = WSAGetLastError(); ci_debug_printf(1, "Error opening socket ....%d\n", er); return CI_SOCKET_ERROR; } icap_socket_opts(s, secs_to_linger); addr.sin_family = AF_INET; addr.sin_port = htons(port); addr.sin_addr.s_addr = INADDR_ANY; if (bind(s, (struct sockaddr *) &addr, sizeof(addr))) { ci_debug_printf(1, "Error bind \n");; return CI_SOCKET_ERROR; } if (listen(s, 512)) { ci_debug_printf(1, "Error listen .....\n"); return CI_SOCKET_ERROR; } *protocol_family = AF_INET; return s; } int icap_socket_opts(ci_socket s, int secs_to_linger) { struct linger li; BOOL value; /* value = TRUE; if(setsockopt(s, SOL_SOCKET, SO_CONDITIONAL_ACCEPT, (const char *)&value, sizeof(value)) == -1){ ci_debug_printf(1,"setsockopt: unable to set SO_CONDITIONAL_ACCEPT\n"); } */ value = TRUE; if (setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (const char *) &value, sizeof(value)) == -1) { ci_debug_printf(1, "setsockopt: unable to set SO_REUSEADDR\n"); } value = TRUE; if (setsockopt (s, IPPROTO_TCP, TCP_NODELAY, (const char *) &value, sizeof(value)) == -1) { ci_debug_printf(1, "setsockopt: unable to set TCP_NODELAY\n"); } li.l_onoff = 1; li.l_linger = secs_to_linger; if (setsockopt(s, SOL_SOCKET, SO_LINGER, (const char *) &li, sizeof(struct linger)) < 0) { ci_debug_printf(1, "setsockopt: unable to set SO_LINGER \n"); } return 1; } int ci_netio_init(ci_socket s) { u_long val; val = 1; ioctlsocket(s, FIONBIO, &val); return 1; } /* int ci_wait_for_data(ci_socket fd,int secs,int what_wait){ fd_set fds,*rfds,*wfds; struct timeval tv; int ret; if(secs>=0){ tv.tv_sec=secs; tv.tv_usec=0; } FD_ZERO(&fds); FD_SET(fd,&fds); if(what_wait==wait_for_read){ rfds=&fds; wfds=NULL; } else{ wfds=&fds; rfds=NULL; } if((ret=select(fd+1,rfds,wfds,NULL,(secs>=0?&tv:NULL)))>0) return 1; if(ret<0){ ci_debug_printf(1,"Fatal error while waiting for new data....\n"); } return 0; } */ int ci_wait_for_data(int fd, int secs, int what_wait) { fd_set rfds, wfds, *preadfds, *pwritefds; struct timeval tv; int ret = 0; if (secs >= 0) { tv.tv_sec = secs; tv.tv_usec = 0; } preadfds = NULL; pwritefds = NULL; if (what_wait & wait_for_read) { FD_ZERO(&rfds); FD_SET(fd, &rfds); preadfds = &rfds; } if (what_wait & wait_for_write) { FD_ZERO(&wfds); FD_SET(fd, &wfds); pwritefds = &wfds; } if ((ret = select(fd + 1, preadfds, pwritefds, NULL, (secs >= 0 ? &tv : NULL))) > 0) { ret = 0; if (preadfds && FD_ISSET(fd, preadfds)) ret = wait_for_read; if (pwritefds && FD_ISSET(fd, pwritefds)) ret = ret | wait_for_write; return ret; } if (ret < 0) { ci_debug_printf(5, "Fatal error while waiting for new data....\n"); return -1; } return 0; } int ci_read(ci_socket fd, void *buf, size_t count, int timeout) { int bytes = 0, err = 0; do { bytes = recv(fd, buf, count, 0); } while (bytes == SOCKET_ERROR && (err = WSAGetLastError()) == WSAEINTR); if (bytes == SOCKET_ERROR && err == WSAEWOULDBLOCK) { if (!ci_wait_for_data(fd, timeout, wait_for_read)) { return bytes; } do { bytes = recv(fd, buf, count, 0); } while (bytes == SOCKET_ERROR && (err = WSAGetLastError()) == WSAEINTR); } if (bytes == 0) { ci_debug_printf(1, "What the helll!!!! No data to read, TIMEOUT:%d, errno:%d\n", timeout, errno); return -1; } return bytes; } int ci_write(ci_socket fd, const void *buf, size_t count, int timeout) { int bytes = 0; int err = 0; int remains = count; char *b = (char *) buf; while (remains > 0) { //write until count bytes written do { bytes = send(fd, b, remains, 0); } while (bytes == SOCKET_ERROR && (err = WSAGetLastError()) == WSAEINTR); printf("OK writing %d bytes %s\n", bytes, b); if (bytes == SOCKET_ERROR && err == WSAEWOULDBLOCK) { if (!ci_wait_for_data(fd, timeout, wait_for_write)) { return bytes; } do { bytes = send(fd, b, remains, 0); } while (bytes == SOCKET_ERROR && (err = WSAGetLastError()) == WSAEINTR); } if (bytes < 0) return bytes; b = b + bytes; //points to remaining bytes...... remains = remains - bytes; } //Ok...... return count; } int ci_read_nonblock(ci_socket fd, void *buf, size_t count) { int bytes = 0; do { bytes = recv(fd, buf, count, 0); } while (bytes == SOCKET_ERROR && WSAGetLastError() == WSAEINTR); return bytes; } int ci_write_nonblock(ci_socket fd, const void *buf, size_t count) { int bytes = 0; do { bytes = send(fd, buf, count, 0); } while (bytes == SOCKET_ERROR && WSAGetLastError() == WSAEINTR); return bytes; } int ci_linger_close(ci_socket fd, int timeout) { char buf[10]; int ret; ci_debug_printf(1, "Waiting to close connection\n"); if (shutdown(fd, SD_SEND) != 0) { closesocket(fd); return 1; } while (ci_wait_for_data(fd, timeout, wait_for_read) && (ret = ci_read_nonblock(fd, buf, 10)) > 0) ci_debug_printf(1, "OK I linger %d bytes.....\n", ret); closesocket(fd); ci_debug_printf(1, "Connection closed ...\n"); return 1; } int ci_hard_close(ci_socket fd) { closesocket(fd); return 1; } c_icap-0.4.2/os/win32/dll_entry.c0000664000175000017500000000024512567550777013427 00000000000000 #include BOOL WINAPI _DllMainCRTStartup(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) { return (TRUE); } c_icap-0.4.2/os/win32/utilfunc.c0000664000175000017500000001125412567550777013266 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "c-icap.h" #include #include #include #include #include #include #include "util.h" int strncasecmp(const char *s1, const char *s2, size_t n) { int r = 0; while (n && ((s1 == s2) || !(r = ((int) (tolower(*((unsigned char *) s1)))) - tolower(*((unsigned char *) s2)))) && (--n, ++s2, *s1++)); return r; } int strcasecmp(const char *s1, const char *s2) { int r = 0; while (((s1 == s2) || !(r = ((int) (tolower(*((unsigned char *) s1)))) - tolower(*((unsigned char *) s2)))) && (++s2, *s1++)); return r; } /* The following functions are safe because the localtime and gmtime are thread safe in Win32 */ struct tm* localtime_r(const time_t *t, struct tm *tm) { if (!t || !tm) return NULL; memcpy(tm, localtime(t), sizeof(struct tm)); return tm; } struct tm* gmtime_r(const time_t *t, struct tm *tm) { if (!t || !tm) return NULL; memcpy(tm, gmtime(t), sizeof(struct tm)); return tm; } static const char *days[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; static const char *months[] = { "", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; void ci_strtime(char *buf) { SYSTEMTIME tm; GetLocalTime(&tm); buf[0] = '\0'; snprintf(buf, STR_TIME_SIZE, "%s %s %d %d:%d:%d %d", days[tm.wDayOfWeek], months[tm.wMonth], tm.wDay, tm.wHour, tm.wMinute, tm.wSecond, tm.wYear); buf[STR_TIME_SIZE - 1] = '\0'; } void ci_strtime_rfc822(char *buf) { SYSTEMTIME tm; GetLocalTime(&tm); /*Here we need GMT time not localtime! */ buf[0] = '\0'; snprintf(buf, STR_TIME_SIZE, "%s, %0.2d %s %d %0.2d:%0.2d:%0.2d GMT", days[tm.wDayOfWeek], tm.wDay, months[tm.wMonth], tm.wYear, tm.wHour, tm.wMinute, tm.wSecond); buf[STR_TIME_SIZE - 1] = '\0'; } int ci_mktemp_file(char *dir, char *template, char *filename) { int fd; GetTempFileName(dir, template, 1, filename); fd = open(filename, O_RDWR | O_CREAT | O_BINARY, S_IREAD | S_IWRITE); return fd; } #ifndef offsetof #define offsetof(type,field) ((int) ( (char *)&((type *)0)->field)) #endif /* */ /* static const unsigned char at_data[] = { 'S', 'u', 'n', 'M', 'o', 'n', 'T', 'u', 'e', 'W', 'e', 'd', 'T', 'h', 'u', 'F', 'r', 'i', 'S', 'a', 't', 'J', 'a', 'n', 'F', 'e', 'b', 'M', 'a', 'r', 'A', 'p', 'r', 'M', 'a', 'y', 'J', 'u', 'n', 'J', 'u', 'l', 'A', 'u', 'g', 'S', 'e', 'p', 'O', 'c', 't', 'N', 'o', 'v', 'D', 'e', 'c', '?', '?', '?', ' ', '?', '?', '?', ' ', '0', offsetof(struct tm, tm_mday), ' ', '0', offsetof(struct tm, tm_hour), ':', '0', offsetof(struct tm, tm_min), ':', '0', offsetof(struct tm, tm_sec), ' ', '?', '?', '?', '?', '\n', 0 }; */ /* char *asctime_r(const struct tm *ptm, char *buffer) { int tmp; assert(ptm); assert(buffer); memcpy(buffer, at_data + 3*(7 + 12), sizeof(at_data) - 3*(7 + 12)); if (((unsigned int)(ptm->tm_wday)) <= 6) { memcpy(buffer, at_data + 3 * ptm->tm_wday, 3); } if (((unsigned int)(ptm->tm_mon)) <= 11) { memcpy(buffer + 4, at_data + 3*7 + 3 * ptm->tm_mon, 3); } buffer += 19; tmp = ptm->tm_year + 1900; if (((unsigned int) tmp) < 10000) { buffer += 4; do { *buffer = '0' + (tmp % 10); tmp /= 10; } while (*--buffer == '?'); } do { --buffer; tmp = *((int *)(((const char *) ptm) + (int) *buffer)); if (((unsigned int) tmp) >= 100) { buffer[-1] = *buffer = '?'; } else { *buffer = '0' + (tmp % 10); buffer[-1] += (tmp/10); } } while ((buffer -= 2)[-2] == '0'); if (*++buffer == '0') { *buffer = ' '; } return buffer - 8; } */ c_icap-0.4.2/stats.c0000664000175000017500000002262712567550776011215 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "stats.h" #include struct stat_entry_list STAT_INT64 = {NULL, 0, 0}; struct stat_entry_list STAT_KBS = {NULL, 0, 0}; struct stat_groups_list STAT_GROUPS = {NULL, 0, 0};; struct stat_area *STATS = NULL; #define STEP 128 int ci_stat_memblock_size(void) { return _CI_ALIGN(sizeof(struct stat_memblock))+STAT_INT64.entries_num*sizeof(uint64_t)+STAT_KBS.entries_num*sizeof(kbs_t); } int stat_entry_by_name(struct stat_entry_list *list, const char *label); int stat_entry_add(struct stat_entry_list *list,const char *label, int type, int gid) { struct stat_entry *l; int indx; if (!list) return -1; indx = stat_entry_by_name(list, label); if (indx >=0 ) return indx; if (list->size == list->entries_num) { if (list->size==0) { list->entries = malloc(STEP*sizeof(struct stat_entry)); if (!list->entries) return -1; } else { l = realloc(list->entries, (list->size+STEP)*sizeof(struct stat_entry)); if (!l) return -1; list->entries = l; } list->size += STEP; } list->entries[list->entries_num].label = strdup(label); list->entries[list->entries_num].type = type; list->entries[list->entries_num].gid = gid; indx = list->entries_num; list->entries_num++; return indx; } void stat_entry_release_list(struct stat_entry_list *list) { int i; if (!list->entries) return; for (i=0;ientries_num;i++) free(list->entries[i].label); free(list->entries); list->entries = NULL; list->size = 0; list->entries_num = 0; } int stat_entry_by_name(struct stat_entry_list *list, const char *label) { int i; if (!list->entries) return -1; for (i=0; ientries_num; i++) if (strcmp(label, list->entries[i].label) == 0) return i; return -1; } int stat_group_add(char *group) { char **group_list; int gid =0; for (gid = 0; gid < STAT_GROUPS.entries_num; gid++) { if (strcmp(STAT_GROUPS.groups[gid], group) == 0) return gid; } if (STAT_GROUPS.size == 0) { STAT_GROUPS.groups = malloc(STEP * sizeof(char *)); if (!STAT_GROUPS.groups) return -1; STAT_GROUPS.size = STEP; } else if (STAT_GROUPS.size == STAT_GROUPS.entries_num) { group_list = realloc(STAT_GROUPS.groups, (STAT_GROUPS.size+STEP)*sizeof(char *)); if (!group_list) return -1; STAT_GROUPS.groups = group_list; STAT_GROUPS.size += STEP; } STAT_GROUPS.groups[STAT_GROUPS.entries_num] = strdup(group); gid = STAT_GROUPS.entries_num; STAT_GROUPS.entries_num++; return gid; } int ci_stat_entry_register(char *label, int type, char *group) { int gid; gid = stat_group_add(group); if (gid < 0) return -1; if (type == STAT_INT64_T) { return stat_entry_add(&STAT_INT64, label, type, gid); } else if(type == STAT_KBS_T) { return stat_entry_add(&STAT_KBS, label, type, gid); } return -1; } void ci_stat_entry_release_lists() { stat_entry_release_list(&STAT_INT64); stat_entry_release_list(&STAT_KBS); } void ci_stat_attach_mem(void *mem_block,int size,void (*release_mem)(void *)) { if (STATS) return; STATS = ci_stat_area_construct(mem_block, size, release_mem); } void ci_stat_release() { if (!STATS) return; ci_stat_area_destroy(STATS); STATS = NULL; } void ci_stat_uint64_inc(int ID, int count) { if (!STATS || !STATS->mem_block) return; if (ID<0 || ID>=STATS->mem_block->counters64_size) return; ci_thread_mutex_lock(&STATS->mtx); STATS->mem_block->counters64[ID] += count; ci_thread_mutex_unlock(&STATS->mtx); } void ci_stat_kbs_inc(int ID, int count) { if (!STATS->mem_block) return; if (ID<0 || ID>=STATS->mem_block->counterskbs_size) return; ci_thread_mutex_lock(&STATS->mtx); STATS->mem_block->counterskbs[ID].bytes += count; STATS->mem_block->counterskbs[ID].kb += (STATS->mem_block->counterskbs[ID].bytes >> 10); STATS->mem_block->counterskbs[ID].bytes &= 0x3FF; ci_thread_mutex_unlock(&STATS->mtx); } /*********************************************** Low level functions */ struct stat_area *ci_stat_area_construct(void *mem_block, int size, void (*release_mem)(void *)) { struct stat_area *area = NULL; if (size < ci_stat_memblock_size() ) return NULL; area = malloc(sizeof(struct stat_area)); if (!area) return NULL; assert(((struct stat_memblock *)mem_block)->sig == MEMBLOCK_SIG); ci_thread_mutex_init(&(area->mtx)); area->mem_block = mem_block; area->release_mem = release_mem; area->mem_block->counters64 = mem_block + _CI_ALIGN(sizeof(struct stat_memblock)); area->mem_block->counterskbs = mem_block + _CI_ALIGN(sizeof(struct stat_memblock)) + STAT_INT64.entries_num*sizeof(uint64_t); area->mem_block->counters64_size = STAT_INT64.entries_num; area->mem_block->counterskbs_size = STAT_KBS.entries_num; ci_stat_area_reset(area); return area; } void ci_stat_area_reset(struct stat_area *area) { int i; ci_thread_mutex_lock(&(area->mtx)); for (i=0; imem_block->counters64_size; i++) area->mem_block->counters64[i] = 0; for (i=0; imem_block->counterskbs_size; i++) { area->mem_block->counterskbs[i].kb = 0; area->mem_block->counterskbs[i].bytes = 0; } ci_thread_mutex_unlock(&(area->mtx)); } void ci_stat_area_destroy(struct stat_area *area) { ci_thread_mutex_destroy(&(area->mtx)); if (area->release_mem) area->release_mem(area->mem_block); free(area); } /*Does not realy needed*/ void ci_stat_area_uint64_inc(struct stat_area *area,int ID, int count) { if (!area->mem_block) return; if (ID<0 || ID>=area->mem_block->counters64_size) return; ci_thread_mutex_lock(&area->mtx); area->mem_block->counters64[ID] += count; ci_thread_mutex_unlock(&area->mtx); } /*Does not realy needed*/ void ci_stat_area_kbs_inc(struct stat_area *area,int ID, int count) { if (!area->mem_block) return; if (ID<0 || ID>=area->mem_block->counterskbs_size) return; ci_thread_mutex_lock(&area->mtx); area->mem_block->counterskbs[ID].bytes += count; area->mem_block->counterskbs[ID].kb += (area->mem_block->counterskbs[ID].bytes >> 10); area->mem_block->counterskbs[ID].bytes &= 0x3FF; ci_thread_mutex_unlock(&area->mtx); } /*Make a memblock area from continues memory block*/ void stat_memblock_fix(struct stat_memblock *mem_block) { assert(mem_block->sig == MEMBLOCK_SIG); mem_block->counters64_size = STAT_INT64.entries_num; mem_block->counterskbs_size = STAT_KBS.entries_num; mem_block->counters64 = (void *)mem_block + _CI_ALIGN(sizeof(struct stat_memblock)); mem_block->counterskbs = (void *)mem_block + _CI_ALIGN(sizeof(struct stat_memblock)) + mem_block->counters64_size*sizeof(uint64_t); } /*Reconstruct a memblock which is located to a continues memory block*/ void stat_memblock_reconstruct(struct stat_memblock *mem_block) { assert(mem_block->sig == MEMBLOCK_SIG); mem_block->counters64 = (void *)mem_block + _CI_ALIGN(sizeof(struct stat_memblock)); mem_block->counterskbs = (void *)mem_block + _CI_ALIGN(sizeof(struct stat_memblock)) + mem_block->counters64_size*sizeof(uint64_t); } void ci_stat_memblock_reset(struct stat_memblock *block) { int i; for (i=0; icounters64_size; i++) block->counters64[i] = 0; for (i=0; icounterskbs_size; i++) { block->counterskbs[i].kb = 0; block->counterskbs[i].bytes = 0; } } void ci_stat_memblock_merge(struct stat_memblock *dest_block, struct stat_memblock *mem_block) { int i; if (!dest_block || !mem_block) return; for (i=0; icounters64_size && icounters64_size; i++) dest_block->counters64[i] += mem_block->counters64[i]; for (i=0; icounterskbs_size && icounterskbs_size; i++) { dest_block->counterskbs[i].kb += mem_block->counterskbs[i].kb; dest_block->counterskbs[i].bytes += mem_block->counterskbs[i].bytes; dest_block->counterskbs[i].kb += (dest_block->counterskbs[i].bytes >> 10); dest_block->counterskbs[i].bytes &= 0x3FF; } } void ci_stat_area_merge(struct stat_area *dest, struct stat_area *src) { if (!dest->mem_block || !src->mem_block) return; ci_stat_memblock_merge(dest->mem_block, src->mem_block); } c_icap-0.4.2/c-icap-libicapapi-config.in0000664000175000017500000000133212567550777014724 00000000000000#!/bin/sh prefix=@prefix@ PKGLIBDIR=@PKGLIBDIR@/ LIBDIR=@LIBDIR@/ CONFIGDIR=@SYSCONFDIR@/ DATADIR=@PKGDATADIR@/ #LOGDIR= SOCKDIR=@SOCKDIR@ INCDIR=@INCLUDEDIR@ INCDIR2=@PKGINCLUDEDIR@ VERSION=@PACKAGE_VERSION@ CFLAGS="@CFLAGS@" LIBS="-L$LIBDIR @EXT_PROGRAMS_LIBADD@" LDFLAGS="" usage() { cat <|<|=} value1 ... # The content length of body data if the related information # included in http headers. # The parameter can take the value <, > or = to specify that # the acl will match if content length is less, greater or # equal to acl values. # acl time value1 .... # It checks agains current time. The values format is: # [DAY[,DAY,[..]]][/][HH:MM-HH:MM] # The DAY can be one of the following: # S - Sunday # M - Monday # T - Tuesday # W - Wednesday # H - Thursday # F - Friday # A - Saturday # acl http_client_ip ip1[/netmask1] ... # The HTTP client ip address, if it is available. # Default: # None set # Examples: # acl OPTIONS type OPTIONS # acl RESPMOD type RESPMOD # acl REQMOD type REQMOD # acl ALLREQUESTS type OPTIONS RESPMOD REQMOD # acl XHEAD icap_header{X-Test} /value/ # acl ECHO service echo # acl localnet src 192.168.1.0/255.255.255.0 # acl localhost src 127.0.0.1/255.255.255.255 # acl all src 0.0.0.0/0.0.0.0 # acl BigObjects content_length{>} 5000000 # acl WorkingHours time M,T,W,H,F/8:00-18:00 # acl FreeHour time Sunday,Saturday/8:00-23:59 M,T,W,H,F/18:01-23:59 M,T,W,H,F/0:00-7.59 # TAG: icap_access # Format: icap_access allow|deny [!]acl1 ... # Description: # Allowing or denying ICAP access based on defined access lists # Default: # None set # Example: # icap_access deny XHEAD # #Allow OPTIONS method for all: # icap_access allow localnet OPTIONS # #Require authentication for all users from local network: # icap_access allow AUTH localnet # icap_access deny all # TAG: client_access # Format: client_access allow|deny acl1 [acl2] [...] # Description: # Allowing or denying connections on c-icap based on # defined access lists. Only the acl types src, srvip and port # can be used. # Default: # None set # Example: # client_access allow all # TAG: LogFormat # Format: LogFormat Name Format # Description: # Name is a name for this log format. # Format is a string with embedded % format codes. % format codes # has the following form: # % [-] [width] [{argument}] formatcode # if - is specified then the output is left aligned # if width specified then the field is exactly width size # some formatcodes support arguments given as {argument} # # Format codes: # %a: Remote IP-Address # %la: Local IP Address # %lp: Local port # %>a: Http Client IP Address. Only supported if the proxy # client supports the "X-Client-IP" header # %ho: Modified Http request header. Supports header name # as argument. If no argument given the first line returned # %huo: Modified Http request url # %ih: Icap request header. Supports header name # as argument. If no argument given the first line returned # % /*For struct tm declaration ....*/ #define HAVE_MALLOC_H 1 #define HAVE_MEMORY_H 1 #define HAVE_STDLIB_H 1 #define HAVE_STRING_H 1 #define HAVE_SYS_STAT_H 1 #define HAVE_SYS_TYPES_H 1 /*Some functions definitions */ #define snprintf _snprintf #define strtoll strtol /* Name of package */ #define PACKAGE "c_icap" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "" /* Define to the full name of this package. */ #define PACKAGE_NAME "" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "" /* Define to the version of this package. */ #define PACKAGE_VERSION "" /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 /* Version number of package */ #define VERSION "1.0" /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ /* Define to `unsigned' if does not define. */ /* #undef size_t */ c_icap-0.4.2/utils/0000775000175000017500000000000012601747560011106 500000000000000c_icap-0.4.2/utils/c-icap-mkbdb.c0000664000175000017500000002366512567550777013434 00000000000000#include "common.h" #include #include #include #include #include #include #include "c-icap.h" #include "lookup_table.h" #include "cfg_param.h" #include "debug.h" #include DB_ENV *env_db=NULL; DB *db=NULL; const ci_type_ops_t *key_ops = &ci_str_ops; const ci_type_ops_t *val_ops = &ci_str_ops; #define MAXLINE 65535 char *txtfile = NULL; char *dbfile = NULL; int DUMP_MODE = 0; ci_mem_allocator_t *allocator = NULL; int cfg_set_type(const char *directive, const char **argv, void *setdata); static struct ci_options_entry options[] = { {"-d", "debug_level", &CI_DEBUG_LEVEL, ci_cfg_set_int, "The debug level"}, {"-i", "file.txt", &txtfile, ci_cfg_set_str, "The file contains the data (required)"}, {"-o", "file.db", &dbfile, ci_cfg_set_str, "The database to be created"}, {"-t", "string|int|ip",NULL, cfg_set_type, "The type of the key"}, {"-v", "string|int|ip", NULL, cfg_set_type, "The type of values"}, {"--dump", NULL, &DUMP_MODE, ci_cfg_enable, "Do not update the database just dump it to the screen"}, {NULL, NULL, NULL, NULL} }; int open_db(char *path) { char *s,home[CI_MAX_PATH]; int ret; strncpy(home, path,CI_MAX_PATH); home[CI_MAX_PATH-1] = '\0'; s=strrchr(home,'/'); if(s) *s = '\0'; else /*no path in filename?*/ home[0]='\0'; /* * Create an environment and initialize it for additional error * reporting. */ if ((ret = db_env_create(&env_db, 0)) != 0) { return 0; } ci_debug_printf(5, "bdb_table_open: Environment created OK.\n"); env_db->set_data_dir(env_db, home); ci_debug_printf(5, "bdb_table_open: Data dir set to %s.\n", home); /* Open the environment */ if ((ret = env_db->open(env_db, home, DB_CREATE | DB_INIT_LOCK | DB_INIT_MPOOL /*| DB_SYSTEM_MEM*/, 0)) != 0){ ci_debug_printf(1, "bdb_table_open: Environment open failed: %s\n", db_strerror(ret)); env_db->close(env_db, 0); return 0; } ci_debug_printf(5, "bdb_table_open: DB environment setup OK.\n"); if ((ret = db_create(&db, env_db, 0)) != 0) { ci_debug_printf(1, "db_create: %s\n", db_strerror(ret)); return 0; } if ((ret = db->open( db, NULL, path, NULL, DB_BTREE, DB_CREATE /*| DB_TRUNCATE*/, 0664)) != 0) { ci_debug_printf(1, "open db %s: %s\n", path, db_strerror(ret)); db->close(db, 0); return 0; } ci_debug_printf(5, "bdb_table_open: file %s created OK.\n",path); return 1; } void close_db() { db->close(db,0); env_db->close(env_db,0); } int dump_db() { DBC *dbc; DBT db_key, db_data; int ret, i; void *store; void **store_index; printf("Going to dump database!\n"); if(key_ops != &ci_str_ops ||val_ops != &ci_str_ops) { ci_debug_printf(1, "can not dump not string databases\n"); return 0; } if ((ret = db->cursor(db, NULL, &dbc, 0)) != 0) { ci_debug_printf(1, "error creating cursor\n"); return 0; } memset(&db_data, 0, sizeof(db_data)); memset(&db_key, 0, sizeof(db_key)); if ((ret = dbc->c_get(dbc, &db_key, &db_data, DB_SET_RANGE)) != 0){ ci_debug_printf(1, "error getting first element of DB : %s\n", db_strerror(ret)); dbc->c_close(dbc); return 0; } do { printf("%s :", (char *)db_key.data ); if (db_data.data) { store = db_data.data; store_index = store; for(i=0; store_index[i]!=0; i++) { store_index[i]+=(long int)store; } for(i=0; store_index[i]!=0; i++) { printf("%s |", (char *)store_index[i]); } } printf("\n"); ret = dbc->c_get(dbc, &db_key, &db_data, DB_NEXT); } while (ret==0); dbc->c_close(dbc); return 1; } int record_extract(char *line, void **key, int *keysize, void **val, int *valsize) { char *s, *v, *e; void *avalue; void *store, *store_value; void **store_index; int i, row_cols = 0, avalue_size, store_value_size; *key = NULL; *val = NULL; *keysize = 0; *valsize = 0; if (!(s=index(line,':'))) { row_cols = 1; } else { row_cols = 2; while((s=index(s,','))) row_cols++,s++; } /*eat spaces .....*/ s=line; while(*s==' ' || *s == '\t') s++; v=s; if (*s == '#') /*it is a comment*/ return 1; if (*s == '\0') /*it is a blank line*/ return 1; if( row_cols==1 ) e=s+strlen(s); else e=index(s,':'); s=e+1; /*Now points to the end (*s='\0') or after the ':' */ e--; while(*e==' ' || *e=='\t' || *e=='\n') e--; *(e+1)='\0'; (*key) = key_ops->dup(v, allocator); (*keysize)=key_ops->size(*key); if(row_cols > 1) { if(row_cols > 128) /*More than 128 cols?*/ return -1; /*We are going to store the data part of the db as folows: [indx1,indx2,indx3,NULL,val1.....,val2...] indx*: are of type void* and has size of sizeof(void*). val* are the values */ /*Allocate a enough mem for storing the values*/ (*val) = allocator->alloc(allocator, 65535); /*We need row_cols elements for storing pointers to values + 1 element for NULL termination ellement*/ store = (*val); store_index = (*val); store_value = (*val) + row_cols*sizeof(void *); store_value_size = 65535 - row_cols*sizeof(void *); (*valsize) = row_cols*sizeof(void *); for (i=0; *s!='\0' && i< row_cols-1; i++) { /*we have vals*/ while(*s==' ' || *s =='\t') s++; /*find the start of the string*/ v = s; e=s; while(*e!=',' && *e!='\0') e++; if (*e=='\0') s = e; else s = e + 1; e--; while(*e == ' ' || *e == '\t' || *e=='\n') e--; *(e+1)='\0'; avalue = val_ops->dup(v, allocator); avalue_size = val_ops->size(avalue); if((*valsize)+avalue_size >= store_value_size) { allocator->free(allocator,avalue); store_index[i] = 0; return -1; } memcpy(store_value, avalue, avalue_size); /*Put on the index the position of the current */ store_index[i] = (void *)(store_value - store); void *apos = store + (long int)store_index[i]; printf("\t\t- Storing val:%s at pos:%p(%s:%d)\n", (char *)avalue, store_index[i], (char *)(apos),avalue_size); store_value += avalue_size; (*valsize) += avalue_size; allocator->free(allocator,avalue); avalue = NULL; } store_index[i]=0; } else { *val = NULL;; *valsize = 0; } return 1; } void store_db(void *key, int keysize, void *val, int valsize) { DBT db_key, db_data; int ret; memset(&db_key, 0, sizeof(db_key)); memset(&db_data, 0, sizeof(db_data)); db_key.data = key; db_key.size = keysize; db_data.data = val; db_data.size = valsize; ret = db->put(db, NULL, &db_key, &db_data, 0); if(ret!=0) ci_debug_printf(1, "db_create: %s (key size:%d, val size:%d)\n", db_strerror(ret), keysize, valsize); } int cfg_set_type(const char *directive, const char **argv, void *setdata) { const ci_type_ops_t *ops = &ci_str_ops; if(argv[0] == NULL) { ci_debug_printf(1, "error not argument for %s argument\n", argv[0]); return 0; } if(0 == strcmp(argv[0], "string")) { ops = &ci_str_ops; } else if(0 == strcmp(argv[0], "int")) { ci_debug_printf(1, "%s: not implemented type %s\n", directive, argv[0]); return 0; } else if(0 == strcmp(argv[0], "ip")) { ci_debug_printf(1, "%s: not implemented type %s\n", directive, argv[0]); return 0; } if(0 == strcmp(directive, "-t")) { key_ops = ops; } else if(0 == strcmp(directive, "-v")) { val_ops = ops; } return 1; } void log_errors(void *unused, const char *format, ...) { va_list ap; va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); } void vlog_errors(void *unused, const char *format, va_list ap) { vfprintf(stderr, format, ap); } int main(int argc, char **argv) { FILE *f = NULL; char outfile[CI_MAX_PATH]; char line[MAXLINE]; int len; void *key, *val; int keysize,valsize; CI_DEBUG_LEVEL = 1; ci_cfg_lib_init(); if (!ci_args_apply(argc, argv, options) || (!txtfile && !DUMP_MODE)) { ci_args_usage(argv[0], options); exit(-1); } #if ! defined(_WIN32) __log_error = (void (*)(void *, const char *,...)) log_errors; /*set c-icap library log function */ #else __vlog_error = vlog_errors; /*set c-icap library log function for win32..... */ #endif if(!(allocator = ci_create_os_allocator())) { ci_debug_printf(1, "Error allocating mem allocator!\n"); return -1; } if (DUMP_MODE && !dbfile) { ci_debug_printf(1, "\nError: You need to specify the database to dump ('-o file.db')\n\n"); ci_args_usage(argv[0], options); exit(-1); } if(!dbfile) { strncpy(outfile, txtfile, CI_MAX_PATH); outfile[CI_MAX_PATH-1] = '\0'; len=strlen(outfile); if(len > CI_MAX_PATH-5) { ci_debug_printf(1,"The filename %s is too long\n", outfile); exit(0); } strcat(outfile,".db"); } else { strncpy(outfile, dbfile, CI_MAX_PATH); outfile[CI_MAX_PATH-1] = '\0'; } if (!open_db(outfile)) { ci_debug_printf(1, "Error opening bdb file %s\n", outfile); if (f) fclose(f); return -1; } if( DUMP_MODE ){ dump_db(); } else { if ((f = fopen(txtfile, "r+")) == NULL) { ci_debug_printf(1, "Error opening file: %s\n", txtfile); return -1; } while(fgets(line,MAXLINE,f)) { line[MAXLINE-1]='\0'; if(!record_extract(line, &key, &keysize, &val, &valsize)) { ci_debug_printf(1, "Error parsing line : %s\n", line); break; } else if (key) /*if it is not comment or blank line */ store_db(key, keysize, val, valsize); } fclose(f); } close_db(); ci_mem_allocator_destroy(allocator); return 0; } c_icap-0.4.2/utils/c-icap-client.c0000664000175000017500000002724712567550777013633 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include #include #include #include #include #include #include #include "request.h" #include "simple_api.h" #include "net_io.h" #include "cfg_param.h" #include "debug.h" /*Must declared ....*/ int CONN_TIMEOUT = 300; void printhead(void *d, const char *head, const char *value) { if (!head || !*head) { ci_debug_printf(1, "\t%s\n", value); } else { ci_debug_printf(1, "\t%s: %s\n", head, value); } } void print_headers(ci_request_t * req) { int type; ci_headers_list_t *headers; ci_debug_printf(1, "\nICAP HEADERS:\n"); ci_headers_iterate(req->response_header, NULL, printhead); ci_debug_printf(1, "\n"); if ((headers = ci_http_response_headers(req)) == NULL) { headers = ci_http_request_headers(req); type = ICAP_REQMOD; } else type = ICAP_RESPMOD; if (headers) { ci_debug_printf(1, "%s HEADERS:\n", ci_method_string(type)); ci_headers_iterate(headers, NULL, printhead); ci_debug_printf(1, "\n"); } } void build_respmod_headers(int fd, ci_headers_list_t *headers) { struct stat filestat; int filesize; char lbuf[512]; // struct tm ltime; time_t ltimet; ci_headers_add(headers, "HTTP/1.0 200 OK"); fstat(fd, &filestat); filesize = filestat.st_size; strcpy(lbuf, "Date: "); time(<imet); ctime_r(<imet, lbuf + strlen(lbuf)); lbuf[strlen(lbuf) - 1] = '\0'; ci_headers_add(headers, lbuf); strcpy(lbuf, "Last-Modified: "); ctime_r(<imet, lbuf + strlen(lbuf)); lbuf[strlen(lbuf) - 1] = '\0'; ci_headers_add(headers, lbuf); sprintf(lbuf, "Content-Length: %d", filesize); ci_headers_add(headers, lbuf); } void build_reqmod_headers(char *url, const char *method, int fd, ci_headers_list_t *headers) { struct stat filestat; int filesize; char lbuf[1024]; time_t ltimet; snprintf(lbuf,1024, "%s %s HTTP/1.0", method, url); lbuf[1023] = '\0'; ci_headers_add(headers, lbuf); strcpy(lbuf, "Date: "); time(<imet); ctime_r(<imet, lbuf + strlen(lbuf)); lbuf[strlen(lbuf) - 1] = '\0'; if (fd > 0) { fstat(fd, &filestat); filesize = filestat.st_size; strcpy(lbuf, "Last-Modified: "); ctime_r(<imet, lbuf + strlen(lbuf)); lbuf[strlen(lbuf) - 1] = '\0'; ci_headers_add(headers, lbuf); sprintf(lbuf, "Content-Length: %d", filesize); ci_headers_add(headers, lbuf); } ci_headers_add(headers, lbuf); ci_headers_add(headers, "User-Agent: C-ICAP-Client/x.xx"); } int fileread(void *fd, char *buf, int len) { int ret; ret = read(*(int *) fd, buf, len); return ret; } int filewrite(void *fd, char *buf, int len) { int ret; ret = write(*(int *) fd, buf, len); return ret; } void copy_data(int fd_in, int fd_out, ci_off_t copy_from) { char buf[4095]; size_t len; lseek(fd_in, copy_from, SEEK_SET); while((len = read(fd_in, buf ,sizeof(buf))) > 0) write(fd_out, buf, len); } int add_xheader(const char *directive, const char **argv, void *setdata) { ci_headers_list_t **xh = (ci_headers_list_t **)setdata; const char *h; if (argv == NULL || argv[0] == NULL) { ci_debug_printf(1, "Missing arguments in directive:%s\n", directive); return 0; } h = argv[0]; if (!strchr(h, ':')) { printf("The header :%s should have the form \"header: value\" \n", h); return 0; } if (*xh == NULL) *xh = ci_headers_create(); ci_headers_add(*xh, h); return 1; } char *icap_server = "localhost"; int port = 1344; int preview_size = -1; char *service = "echo"; char *input_file = NULL; char *output_file = NULL; char *request_url = NULL; char *resp_url = NULL; char *method_str = "GET"; int send_headers = 1; int send_preview = 1; int allow204 = 1; int allow206 = 0; int verbose = 0; ci_headers_list_t *xheaders = NULL; ci_headers_list_t *http_xheaders = NULL; ci_headers_list_t *http_resp_xheaders = NULL; static struct ci_options_entry options[] = { {"-i", "icap_servername", &icap_server, ci_cfg_set_str, "The icap server name"}, {"-p", "port", &port, ci_cfg_set_int, "The server port"}, {"-s", "service", &service, ci_cfg_set_str, "The service name"}, {"-f", "filename", &input_file, ci_cfg_set_str, "Send this file to the icap server.\nDefault is to send an options request"}, {"-o", "filename", &output_file, ci_cfg_set_str, "Save output to this file.\nDefault is to send to stdout"}, {"-method", "method", &method_str, ci_cfg_set_str,"Use 'method' as method of the request modification"}, {"-req","url",&request_url,ci_cfg_set_str,"Send a request modification instead of response modification"}, {"-resp","url",&resp_url,ci_cfg_set_str,"Send a responce modification request with request url the 'url'"}, {"-d", "level", &CI_DEBUG_LEVEL, ci_cfg_set_int, "debug level info to stdout"}, {"-noreshdr", NULL, &send_headers, ci_cfg_disable, "Do not send reshdr headers"}, {"-nopreview", NULL, &send_preview, ci_cfg_disable, "Do not send preview data"}, {"-no204", NULL, &allow204, ci_cfg_disable, "Do not allow204 outside preview"}, {"-206", NULL, &allow206, ci_cfg_enable, "Support allow206"}, {"-x", "xheader", &xheaders, add_xheader, "Include xheader in icap request headers"}, {"-hx", "xheader", &http_xheaders, add_xheader, "Include xheader in http request headers"}, {"-rhx", "xheader", &http_resp_xheaders, add_xheader, "Include xheader in http response headers"}, {"-w", "preview", &preview_size, ci_cfg_set_int, "Sets the maximum preview data size"}, {"-v", NULL, &verbose, ci_cfg_enable, "Print response headers"}, {NULL, NULL, NULL, NULL} }; void log_errors(ci_request_t * req, const char *format, ...) { va_list ap; va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); } void vlog_errors(ci_request_t * req, const char *format, va_list ap) { vfprintf(stderr, format, ap); } int main(int argc, char **argv) { int fd_in = 0, fd_out = 0; int ret; char ip[CI_IPLEN]; ci_connection_t *conn; ci_request_t *req; ci_headers_list_t *req_headers = NULL; ci_headers_list_t *resp_headers = NULL; CI_DEBUG_LEVEL = 1; /*Default debug level is 1 */ ci_cfg_lib_init(); if (!ci_args_apply(argc, argv, options)) { ci_args_usage(argv[0], options); exit(-1); } #if ! defined(_WIN32) __log_error = (void (*)(void *, const char *,...)) log_errors; /*set c-icap library log function */ #else __vlog_error = vlog_errors; /*set c-icap library log function for win32..... */ #endif if (!(conn = ci_client_connect_to(icap_server, port, 0))) { ci_debug_printf(1, "Failed to connect to icap server.....\n"); exit(-1); } req = ci_client_request(conn, icap_server, service); if (xheaders) ci_icap_append_xheaders(req, xheaders); ci_client_get_server_options(req, CONN_TIMEOUT); ci_debug_printf(10, "OK done with options!\n"); ci_conn_remote_ip(conn, ip); ci_debug_printf(1, "ICAP server:%s, ip:%s, port:%d\n\n", icap_server, ip, port); if (!send_preview) { req->preview = -1; } else if (preview_size >= 0 && preview_size < req->preview) { req->preview = preview_size; } /*If service does not support allow 204 disable it*/ if (!req->allow204) allow204 = 0; if (!input_file && !request_url && !resp_url) { ci_debug_printf(1, "OPTIONS:\n"); ci_debug_printf(1, "\tAllow 204: %s\n\tPreview: %d\n\tKeep alive: %s\n", (req->allow204 ? "Yes" : "No"), req->preview, (req->keepalive ? "Yes" : "No") ); print_headers(req); } else { if (input_file && (fd_in = open(input_file, O_RDONLY)) < 0) { ci_debug_printf(1, "Error opening file %s\n", input_file); exit(-1); } if (output_file) { if ((fd_out = open(output_file, O_CREAT | O_RDWR | O_EXCL, S_IRWXU | S_IRGRP)) < 0) { ci_debug_printf(1, "Error opening output file %s\n", output_file); exit(-1); } } else { fd_out = fileno(stdout); } ci_client_request_reuse(req); ci_debug_printf(10, "Preview:%d keepalive:%d,allow204:%d\n", req->preview, req->keepalive, req->allow204); ci_debug_printf(10, "OK allocating request going to send request\n"); req->type = ICAP_RESPMOD; if (allow204) req->allow204 = 1; if (allow206) req->allow206 = 1; if (xheaders) ci_icap_append_xheaders(req, xheaders); if (request_url) { req_headers = ci_headers_create(); build_reqmod_headers(request_url, method_str, fd_in, req_headers); req->type = ICAP_REQMOD; } else if (send_headers) { resp_headers = ci_headers_create(); build_respmod_headers(fd_in, resp_headers); if (resp_url) { req_headers = ci_headers_create(); build_reqmod_headers(resp_url, method_str, 0, req_headers); } } if(req_headers && http_xheaders) ci_headers_addheaders(req_headers, http_xheaders); if (resp_headers && http_resp_xheaders) ci_headers_addheaders(resp_headers, http_resp_xheaders); ret = ci_client_icapfilter(req, CONN_TIMEOUT, req_headers, resp_headers, (fd_in > 0 ? (&fd_in): NULL), (int (*)(void *, char *, int)) fileread, &fd_out, (int (*)(void *, char *, int)) filewrite); if (ret == 206) { ci_debug_printf(1, "Partial modification (Allow 206 response): " "use %ld from the original body data\n", req->i206_use_original_body); copy_data(fd_in, fd_out, req->i206_use_original_body); } close(fd_in); close(fd_out); if (ret == 204) { ci_debug_printf(1, "No modification needed (Allow 204 response)\n"); if (output_file) unlink(output_file); } if (verbose) print_headers(req); ci_debug_printf(2, "Done\n"); } ci_connection_destroy(conn); return 0; } c_icap-0.4.2/utils/Makefile.am0000664000175000017500000000164012567550777013100 00000000000000 CONFIGDIR=@sysconfdir@ PKGLIBDIR=@pkglibdir@ MODULESDIR=$(pkglibdir)/ SERVICESDIR=$(pkglibdir)/ #CONFIGDIR=$(sysconfdir)/ LOGDIR=$(localstatedir)/log/ SOCKDIR=/var/run/c-icap bin_PROGRAMS = c-icap-client c-icap-stretch if USEBDB bin_PROGRAMS += c-icap-mkbdb endif #other ..... c_icap_client_SOURCES = c-icap-client.c c_icap_client_CFLAGS= -I../include/ c_icap_client_LDADD= ../libicapapi.la @THREADS_LDADD@ @DL_ADD_FLAG@ c_icap_client_LDFLAGS = -rdynamic -rpath @libdir@ @THREADS_LDFLAGS@ c_icap_mkbdb_SOURCES = c-icap-mkbdb.c c_icap_mkbdb_CFLAGS= -I../include/ @BDB_ADD_FLAG@ c_icap_mkbdb_LDADD= ../libicapapi.la @THREADS_LDADD@ @DL_ADD_FLAG@ @BDB_ADD_LDADD@ c_icap_mkbdb_LDFLAGS = -rdynamic -rpath @libdir@ @THREADS_LDFLAGS@ c_icap_stretch_SOURCES = c-icap-stretch.c c_icap_stretch_CFLAGS= -I../include/ c_icap_stretch_LDADD = ../libicapapi.la @THREADS_LDADD@ @DL_ADD_FLAG@ c_icap_stretch_LDFLAGS= @THREADS_LDFLAGS@ c_icap-0.4.2/utils/Makefile.in0000664000175000017500000007200512601747525013100 00000000000000# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ bin_PROGRAMS = c-icap-client$(EXEEXT) c-icap-stretch$(EXEEXT) \ $(am__EXEEXT_1) @USEBDB_TRUE@am__append_1 = c-icap-mkbdb subdir = utils DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/autoconf.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @USEBDB_TRUE@am__EXEEXT_1 = c-icap-mkbdb$(EXEEXT) am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am_c_icap_client_OBJECTS = c_icap_client-c-icap-client.$(OBJEXT) c_icap_client_OBJECTS = $(am_c_icap_client_OBJECTS) c_icap_client_DEPENDENCIES = ../libicapapi.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = c_icap_client_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(c_icap_client_CFLAGS) \ $(CFLAGS) $(c_icap_client_LDFLAGS) $(LDFLAGS) -o $@ am_c_icap_mkbdb_OBJECTS = c_icap_mkbdb-c-icap-mkbdb.$(OBJEXT) c_icap_mkbdb_OBJECTS = $(am_c_icap_mkbdb_OBJECTS) c_icap_mkbdb_DEPENDENCIES = ../libicapapi.la c_icap_mkbdb_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(c_icap_mkbdb_CFLAGS) \ $(CFLAGS) $(c_icap_mkbdb_LDFLAGS) $(LDFLAGS) -o $@ am_c_icap_stretch_OBJECTS = c_icap_stretch-c-icap-stretch.$(OBJEXT) c_icap_stretch_OBJECTS = $(am_c_icap_stretch_OBJECTS) c_icap_stretch_DEPENDENCIES = ../libicapapi.la c_icap_stretch_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(c_icap_stretch_CFLAGS) $(CFLAGS) $(c_icap_stretch_LDFLAGS) \ $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(c_icap_client_SOURCES) $(c_icap_mkbdb_SOURCES) \ $(c_icap_stretch_SOURCES) DIST_SOURCES = $(c_icap_client_SOURCES) $(c_icap_mkbdb_SOURCES) \ $(c_icap_stretch_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BDB_ADD_FLAG = @BDB_ADD_FLAG@ BDB_ADD_LDADD = @BDB_ADD_LDADD@ BZLIB_ADD_FLAG = @BZLIB_ADD_FLAG@ BZLIB_ADD_LDADD = @BZLIB_ADD_LDADD@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CICAPLIB_VERSION = @CICAPLIB_VERSION@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ C_ICAP_HEX_VERSION = @C_ICAP_HEX_VERSION@ DEFINE_INT64 = @DEFINE_INT64@ DEFINE_INT8 = @DEFINE_INT8@ DEFINE_OFF_T = @DEFINE_OFF_T@ DEFINE_SIZE_OFF_T = @DEFINE_SIZE_OFF_T@ DEFINE_SIZE_T = @DEFINE_SIZE_T@ DEFINE_SIZE_VOID_P = @DEFINE_SIZE_VOID_P@ DEFINE_UINT64 = @DEFINE_UINT64@ DEFINE_UINT8 = @DEFINE_UINT8@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_ADD_FLAG = @DL_ADD_FLAG@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTTYPES_H = @INTTYPES_H@ INVISIBILITY_CFLAG = @INVISIBILITY_CFLAG@ LD = @LD@ LDAP_ADD_FLAG = @LDAP_ADD_FLAG@ LDAP_ADD_LDADD = @LDAP_ADD_LDADD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MEMCACHED_CFLAGS = @MEMCACHED_CFLAGS@ MEMCACHED_LDFLAGS = @MEMCACHED_LDFLAGS@ MKDIR_P = @MKDIR_P@ MODULES_CFLAGS = @MODULES_CFLAGS@ MODULES_LIBADD = @MODULES_LIBADD@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_ADD_FLAG = @PCRE_ADD_FLAG@ PCRE_ADD_LDADD = @PCRE_ADD_LDADD@ POSIX_FILE_LOCK = @POSIX_FILE_LOCK@ POSIX_MAPPED_FILES = @POSIX_MAPPED_FILES@ POSIX_SEMAPHORES = @POSIX_SEMAPHORES@ POSIX_SHARED_MEM = @POSIX_SHARED_MEM@ PTHREADS_RWLOCK = @PTHREADS_RWLOCK@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SYSV_IPC = @SYSV_IPC@ SYS_TYPES_H = @SYS_TYPES_H@ THREADS_LDADD = @THREADS_LDADD@ THREADS_LDFLAGS = @THREADS_LDFLAGS@ USE_COMPAT = @USE_COMPAT@ USE_IPV6 = @USE_IPV6@ USE_REGEX = @USE_REGEX@ VERSION = @VERSION@ VISIBILITY_ATTR = @VISIBILITY_ATTR@ ZLIB_ADD_FLAG = @ZLIB_ADD_FLAG@ ZLIB_ADD_LDADD = @ZLIB_ADD_LDADD@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_bin = @doxygen_bin@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ has_doxygen = @has_doxygen@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ perlccflags = @perlccflags@ perlcore = @perlcore@ perlldflags = @perlldflags@ perllib = @perllib@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ CONFIGDIR = @sysconfdir@ PKGLIBDIR = @pkglibdir@ MODULESDIR = $(pkglibdir)/ SERVICESDIR = $(pkglibdir)/ #CONFIGDIR=$(sysconfdir)/ LOGDIR = $(localstatedir)/log/ SOCKDIR = /var/run/c-icap #other ..... c_icap_client_SOURCES = c-icap-client.c c_icap_client_CFLAGS = -I../include/ c_icap_client_LDADD = ../libicapapi.la @THREADS_LDADD@ @DL_ADD_FLAG@ c_icap_client_LDFLAGS = -rdynamic -rpath @libdir@ @THREADS_LDFLAGS@ c_icap_mkbdb_SOURCES = c-icap-mkbdb.c c_icap_mkbdb_CFLAGS = -I../include/ @BDB_ADD_FLAG@ c_icap_mkbdb_LDADD = ../libicapapi.la @THREADS_LDADD@ @DL_ADD_FLAG@ @BDB_ADD_LDADD@ c_icap_mkbdb_LDFLAGS = -rdynamic -rpath @libdir@ @THREADS_LDFLAGS@ c_icap_stretch_SOURCES = c-icap-stretch.c c_icap_stretch_CFLAGS = -I../include/ c_icap_stretch_LDADD = ../libicapapi.la @THREADS_LDADD@ @DL_ADD_FLAG@ c_icap_stretch_LDFLAGS = @THREADS_LDFLAGS@ all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu utils/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu utils/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list c-icap-client$(EXEEXT): $(c_icap_client_OBJECTS) $(c_icap_client_DEPENDENCIES) $(EXTRA_c_icap_client_DEPENDENCIES) @rm -f c-icap-client$(EXEEXT) $(AM_V_CCLD)$(c_icap_client_LINK) $(c_icap_client_OBJECTS) $(c_icap_client_LDADD) $(LIBS) c-icap-mkbdb$(EXEEXT): $(c_icap_mkbdb_OBJECTS) $(c_icap_mkbdb_DEPENDENCIES) $(EXTRA_c_icap_mkbdb_DEPENDENCIES) @rm -f c-icap-mkbdb$(EXEEXT) $(AM_V_CCLD)$(c_icap_mkbdb_LINK) $(c_icap_mkbdb_OBJECTS) $(c_icap_mkbdb_LDADD) $(LIBS) c-icap-stretch$(EXEEXT): $(c_icap_stretch_OBJECTS) $(c_icap_stretch_DEPENDENCIES) $(EXTRA_c_icap_stretch_DEPENDENCIES) @rm -f c-icap-stretch$(EXEEXT) $(AM_V_CCLD)$(c_icap_stretch_LINK) $(c_icap_stretch_OBJECTS) $(c_icap_stretch_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_icap_client-c-icap-client.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_icap_mkbdb-c-icap-mkbdb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_icap_stretch-c-icap-stretch.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< c_icap_client-c-icap-client.o: c-icap-client.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_client_CFLAGS) $(CFLAGS) -MT c_icap_client-c-icap-client.o -MD -MP -MF $(DEPDIR)/c_icap_client-c-icap-client.Tpo -c -o c_icap_client-c-icap-client.o `test -f 'c-icap-client.c' || echo '$(srcdir)/'`c-icap-client.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap_client-c-icap-client.Tpo $(DEPDIR)/c_icap_client-c-icap-client.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='c-icap-client.c' object='c_icap_client-c-icap-client.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_client_CFLAGS) $(CFLAGS) -c -o c_icap_client-c-icap-client.o `test -f 'c-icap-client.c' || echo '$(srcdir)/'`c-icap-client.c c_icap_client-c-icap-client.obj: c-icap-client.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_client_CFLAGS) $(CFLAGS) -MT c_icap_client-c-icap-client.obj -MD -MP -MF $(DEPDIR)/c_icap_client-c-icap-client.Tpo -c -o c_icap_client-c-icap-client.obj `if test -f 'c-icap-client.c'; then $(CYGPATH_W) 'c-icap-client.c'; else $(CYGPATH_W) '$(srcdir)/c-icap-client.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap_client-c-icap-client.Tpo $(DEPDIR)/c_icap_client-c-icap-client.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='c-icap-client.c' object='c_icap_client-c-icap-client.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_client_CFLAGS) $(CFLAGS) -c -o c_icap_client-c-icap-client.obj `if test -f 'c-icap-client.c'; then $(CYGPATH_W) 'c-icap-client.c'; else $(CYGPATH_W) '$(srcdir)/c-icap-client.c'; fi` c_icap_mkbdb-c-icap-mkbdb.o: c-icap-mkbdb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_mkbdb_CFLAGS) $(CFLAGS) -MT c_icap_mkbdb-c-icap-mkbdb.o -MD -MP -MF $(DEPDIR)/c_icap_mkbdb-c-icap-mkbdb.Tpo -c -o c_icap_mkbdb-c-icap-mkbdb.o `test -f 'c-icap-mkbdb.c' || echo '$(srcdir)/'`c-icap-mkbdb.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap_mkbdb-c-icap-mkbdb.Tpo $(DEPDIR)/c_icap_mkbdb-c-icap-mkbdb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='c-icap-mkbdb.c' object='c_icap_mkbdb-c-icap-mkbdb.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_mkbdb_CFLAGS) $(CFLAGS) -c -o c_icap_mkbdb-c-icap-mkbdb.o `test -f 'c-icap-mkbdb.c' || echo '$(srcdir)/'`c-icap-mkbdb.c c_icap_mkbdb-c-icap-mkbdb.obj: c-icap-mkbdb.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_mkbdb_CFLAGS) $(CFLAGS) -MT c_icap_mkbdb-c-icap-mkbdb.obj -MD -MP -MF $(DEPDIR)/c_icap_mkbdb-c-icap-mkbdb.Tpo -c -o c_icap_mkbdb-c-icap-mkbdb.obj `if test -f 'c-icap-mkbdb.c'; then $(CYGPATH_W) 'c-icap-mkbdb.c'; else $(CYGPATH_W) '$(srcdir)/c-icap-mkbdb.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap_mkbdb-c-icap-mkbdb.Tpo $(DEPDIR)/c_icap_mkbdb-c-icap-mkbdb.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='c-icap-mkbdb.c' object='c_icap_mkbdb-c-icap-mkbdb.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_mkbdb_CFLAGS) $(CFLAGS) -c -o c_icap_mkbdb-c-icap-mkbdb.obj `if test -f 'c-icap-mkbdb.c'; then $(CYGPATH_W) 'c-icap-mkbdb.c'; else $(CYGPATH_W) '$(srcdir)/c-icap-mkbdb.c'; fi` c_icap_stretch-c-icap-stretch.o: c-icap-stretch.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_stretch_CFLAGS) $(CFLAGS) -MT c_icap_stretch-c-icap-stretch.o -MD -MP -MF $(DEPDIR)/c_icap_stretch-c-icap-stretch.Tpo -c -o c_icap_stretch-c-icap-stretch.o `test -f 'c-icap-stretch.c' || echo '$(srcdir)/'`c-icap-stretch.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap_stretch-c-icap-stretch.Tpo $(DEPDIR)/c_icap_stretch-c-icap-stretch.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='c-icap-stretch.c' object='c_icap_stretch-c-icap-stretch.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_stretch_CFLAGS) $(CFLAGS) -c -o c_icap_stretch-c-icap-stretch.o `test -f 'c-icap-stretch.c' || echo '$(srcdir)/'`c-icap-stretch.c c_icap_stretch-c-icap-stretch.obj: c-icap-stretch.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_stretch_CFLAGS) $(CFLAGS) -MT c_icap_stretch-c-icap-stretch.obj -MD -MP -MF $(DEPDIR)/c_icap_stretch-c-icap-stretch.Tpo -c -o c_icap_stretch-c-icap-stretch.obj `if test -f 'c-icap-stretch.c'; then $(CYGPATH_W) 'c-icap-stretch.c'; else $(CYGPATH_W) '$(srcdir)/c-icap-stretch.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap_stretch-c-icap-stretch.Tpo $(DEPDIR)/c_icap_stretch-c-icap-stretch.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='c-icap-stretch.c' object='c_icap_stretch-c-icap-stretch.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_stretch_CFLAGS) $(CFLAGS) -c -o c_icap_stretch-c-icap-stretch.obj `if test -f 'c-icap-stretch.c'; then $(CYGPATH_W) 'c-icap-stretch.c'; else $(CYGPATH_W) '$(srcdir)/c-icap-stretch.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS # 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: c_icap-0.4.2/utils/c-icap-stretch.c0000664000175000017500000005144412567550777014025 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "request.h" #include "ci_threads.h" #include "simple_api.h" #include "net_io.h" #include "cfg_param.h" #include "debug.h" /*GLOBALS ........*/ int CONN_TIMEOUT = 30; char *servername = "localhost"; int PORT = 1344; char *service = "echo"; int threadsnum = 10; int MAX_REQUESTS = 100; int DoReqmod = 0; int DoTransparent = 0; #define MAX_URLS 32768 char *URLS[MAX_URLS]; int URLS_COUNT=0; time_t START_TIME = 0; int FILES_NUMBER = 0; char **FILES; ci_thread_t *threads; ci_thread_mutex_t filemtx; int file_indx = 0; int requests_stats = 0; int failed_requests_stats = 0; int soft_failed_requests_stats = 0; int in_bytes_stats = 0; int out_bytes_stats = 0; int req_errors_rw = 0; int req_errors_r = 0; int _THE_END = 0; char **xclient_headers = NULL; int xclient_headers_num =0; ci_headers_list_t *xheaders = NULL; ci_headers_list_t *http_xheaders = NULL; ci_headers_list_t *http_resp_xheaders = NULL; ci_thread_mutex_t statsmtx; void print_stats() { time_t rtime; time(&rtime); printf("Statistics:\n\t Files used :%d\n\t Number of threads :%d\n\t" " Requests served :%d\n\t Requests failed :%d\n\t Requests soft failed :%d\n\t" " Incoming bytes :%d\n\t Outgoing bytes :%d\n" " \t Write Errors :%d\n", FILES_NUMBER, threadsnum, requests_stats, failed_requests_stats, soft_failed_requests_stats, in_bytes_stats, out_bytes_stats, req_errors_rw); rtime = rtime - START_TIME; printf("Running for %u seconds\n", (unsigned int) rtime); } static void sigint_handler(int sig) { int i = 0; /* */ signal(SIGINT, SIG_IGN); signal(SIGCHLD, SIG_IGN); if (sig == SIGTERM) { printf("SIGTERM signal received for main server.\n"); printf("Going to term children....\n"); } else if (sig == SIGINT) { printf("SIGINT signal received for icap-stretch.\n"); } else { printf("Signal %d received. Exiting ....\n", sig); } _THE_END = 1; for (i = 0; i < threadsnum; i++) { if (threads[i]) ci_thread_join(threads[i]); //What if a child is blocked?????? } ci_thread_mutex_destroy(&filemtx); print_stats(); exit(0); } void str_trim(char *str) { char *s, *e; if (!str) return; s = str; e = NULL; while (*s == ' '){ e = s; while (*e != '\0'){ *e = *(e+1); e++; } } /*if (e) e--; else */ e = str+strlen(str); while(*(--e) == ' ' && e >= str) *e = '\0'; } int load_urls(char *filename) { FILE *f; #define URL_SIZE 1024 char line[URL_SIZE+1]; URLS_COUNT = 0; memset(URLS, 0, sizeof(char)*MAX_URLS); if ((f = fopen(filename, "r")) == NULL) { printf("Error opening magic file: %s\n", filename); return 0; } while (fgets(line,URL_SIZE,f)!= NULL && URLS_COUNT != MAX_URLS) { line[strlen(line)-1] = '\0'; str_trim(line); if (line[0] != '#' && line[0] != '\0') { URLS[URLS_COUNT] = strdup(line); URLS_COUNT++; } } fclose(f); return 1; } char *xclient_header() { if (!xclient_headers_num) return NULL; int indx = (int) ((((double) rand()) / (double) RAND_MAX) * (double)xclient_headers_num); return xclient_headers[indx]; } void build_headers(int fd, ci_headers_list_t *headers) { struct stat filestat; int filesize; char lbuf[512]; time_t ltimet; ci_headers_add(headers, "200 OK HTTP/1.1"); ci_headers_add(headers, "Filetype: Unknown"); ci_headers_add(headers, "User: chtsanti"); fstat(fd, &filestat); filesize = filestat.st_size; strcpy(lbuf, "Date: "); time(<imet); ctime_r(<imet, lbuf + strlen(lbuf)); lbuf[strlen(lbuf) - 1] = '\0'; ci_headers_add(headers, lbuf); strcpy(lbuf, "Last-Modified: "); ctime_r(<imet, lbuf + strlen(lbuf)); lbuf[strlen(lbuf) - 1] = '\0'; ci_headers_add(headers, lbuf); sprintf(lbuf, "Content-Length: %d", filesize); ci_headers_add(headers, lbuf); if (http_resp_xheaders) ci_headers_addheaders(headers, http_resp_xheaders); } void build_request_headers(const char *url, const char *method, ci_headers_list_t *headers) { char lbuf[1024]; time_t ltimet; snprintf(lbuf,1024, "%s %s HTTP/1.0", method, url); lbuf[1023] = '\0'; ci_headers_add(headers, lbuf); strcpy(lbuf, "Date: "); time(<imet); ctime_r(<imet, lbuf + strlen(lbuf)); lbuf[strlen(lbuf) - 1] = '\0'; ci_headers_add(headers, lbuf); ci_headers_add(headers, "User-Agent: C-ICAP-Client/x.xx"); if(http_xheaders) ci_headers_addheaders(headers, http_xheaders); } int fileread(void *fd, char *buf, int len) { int ret; ret = read(*(int *) fd, buf, len); return ret; } int filewrite(void *fd, char *buf, int len) { return len; } int do_req(ci_request_t *req, char *url, int *keepalive, int transparent) { int ret; char lbuf[1024]; char host[512]; char path[512]; char *s; time_t ltimet; ci_headers_list_t *headers; int fd_out = 0; headers = ci_headers_create(); if (transparent) { if ((s = strchr(url, '/'))!= NULL) { strncpy(host, url, 512 > (s-url) ? (s-url): 512); host[512 > (s-url) ? (s-url): 511] = '\0'; strncpy(path, s, 512); path[511] = '\0'; } else { strncpy(host, url, 512); host[511] = '\0'; strcpy(path, "/index.html"); } snprintf(lbuf,1024, "GET %s HTTP/1.0", path); lbuf[1023] = '\0'; } else { if (strstr(url, "://")) snprintf(lbuf,1024, "GET %s HTTP/1.0", url); else snprintf(lbuf,1024, "GET http://%s HTTP/1.0", url); lbuf[1023] = '\0'; } ci_headers_add(headers, lbuf); snprintf(lbuf,1024, "Host: %s", host); lbuf[1023] = '\0'; ci_headers_add(headers, lbuf); strcpy(lbuf, "Date: "); time(<imet); ctime_r(<imet, lbuf + strlen(lbuf)); lbuf[strlen(lbuf) - 1] = '\0'; ci_headers_add(headers, lbuf); ci_headers_add(headers, "User-Agent: C-ICAP-Stretch/x.xx"); if(http_xheaders) ci_headers_addheaders(headers, http_xheaders); req->type = ICAP_REQMOD; ret = ci_client_icapfilter(req, CONN_TIMEOUT, headers, NULL, NULL, (int (*)(void *, char *, int)) fileread, &fd_out, (int (*)(void *, char *, int)) filewrite); if (ret <=0 && req->bytes_out == 0 ){ ci_debug_printf(2, "Is the ICAP connection closed?\n"); *keepalive = 0; return 0; } if (ret <= 0) { ci_debug_printf(1, "Error sending requests \n"); *keepalive = 0; return -1; } *keepalive=req->keepalive; ci_headers_destroy(headers); ci_thread_mutex_lock(&statsmtx); in_bytes_stats += req->bytes_in; out_bytes_stats += req->bytes_out; ci_thread_mutex_unlock(&statsmtx); return 1; } int threadjobreqmod() { ci_request_t *req; ci_connection_t *conn; char *xh; int indx, keepalive, ret; int arand=0, p; while (!_THE_END) { if (!(conn = ci_client_connect_to(servername, PORT, 0))) { ci_debug_printf(1, "Failed to connect to icap server.....\n"); exit(-1); } req = ci_client_request(conn, servername, service); req->type = ICAP_RESPMOD; req->preview = 512; req->allow206 = 1; req->allow204 = 1; for(;;) { xh = xclient_header(); if (xh) ci_icap_add_xheader(req, xh); if (xheaders) ci_icap_append_xheaders(req, xheaders); keepalive = 0; indx = (int) ((((double) arand) / (double) RAND_MAX) * (double)URLS_COUNT); if ((ret = do_req(req, URLS[indx], &keepalive, DoTransparent)) <= 0) { ci_thread_mutex_lock(&statsmtx); if (ret == 0) soft_failed_requests_stats++; else failed_requests_stats++; requests_stats++; arand = rand(); /*rand is not thread safe .... */ ci_thread_mutex_unlock(&statsmtx); printf("Request failed...\n"); break; } ci_thread_mutex_lock(&statsmtx); requests_stats++; arand = rand(); /*rand is not thread safe .... */ ci_thread_mutex_unlock(&statsmtx); if (_THE_END) { printf("The end: thread dying\n"); ci_request_destroy(req); return 0; } if (keepalive == 0) break; p = (int) ((((double) arand) / (double) RAND_MAX) * 10.0); if (p == 5 || p == 7 || p == 3) { // 30% possibility .... // printf("OK, closing the connection......\n"); break; } usleep(500000); ci_client_request_reuse(req); } ci_hard_close(conn->fd); ci_request_destroy(req); if (!_THE_END) usleep(1000000); } return 1; } int do_file(ci_request_t *req, char *input_file, int *keepalive) { int fd_in,fd_out; int ret, arand; int indx; ci_headers_list_t *headers, *request_headers = NULL; const char *useUrl = NULL; if (URLS_COUNT > 0) { ci_thread_mutex_lock(&statsmtx); arand = rand(); /*rand is not thread safe .... */ ci_thread_mutex_unlock(&statsmtx); indx = (int) ((((double) arand) / (double) RAND_MAX) * (double)URLS_COUNT); useUrl = URLS[indx]; } if ((fd_in = open(input_file, O_RDONLY)) < 0) { ci_debug_printf(1, "Error opening file %s\n", input_file); return 0; } fd_out = 0; headers = ci_headers_create(); build_headers(fd_in, headers); if (useUrl) { request_headers = ci_headers_create(); build_request_headers(useUrl, "GET", request_headers); } ret = ci_client_icapfilter(req, CONN_TIMEOUT, request_headers, headers, &fd_in, (int (*)(void *, char *, int)) fileread, &fd_out, (int (*)(void *, char *, int)) filewrite); close(fd_in); if (ret <=0 && req->bytes_out == 0 ){ ci_debug_printf(2, "Is the ICAP connection closed?\n"); *keepalive = 0; return 0; } if (ret<= 0) { ci_debug_printf(1, "Error sending requests \n"); *keepalive = 0; return -1; } *keepalive=req->keepalive; ci_headers_destroy(headers); // printf("Done(%d bytes).\n",totalbytes); ci_thread_mutex_lock(&statsmtx); in_bytes_stats += req->bytes_in; out_bytes_stats += req->bytes_out; ci_thread_mutex_unlock(&statsmtx); return 1; } int threadjobsendfiles() { ci_request_t *req; ci_connection_t *conn; char *xh; int indx, keepalive, ret; int arand; while (1) { if (!(conn = ci_client_connect_to(servername, PORT, 0))) { ci_debug_printf(1, "Failed to connect to icap server.....\n"); exit(-1); } req = ci_client_request(conn, servername, service); for (;;) { ci_thread_mutex_lock(&filemtx); indx = file_indx; if (file_indx == (FILES_NUMBER - 1)) file_indx = 0; else file_indx++; ci_thread_mutex_unlock(&filemtx); xh = xclient_header(); if (xh) ci_icap_add_xheader(req, xh); if (xheaders) ci_icap_append_xheaders(req, xheaders); keepalive = 0; req->type = ICAP_RESPMOD; req->preview = 512; req->allow206 = 1; req->allow204 = 1; if ((ret = do_file(req, FILES[indx], &keepalive)) <= 0) { ci_thread_mutex_lock(&statsmtx); if (ret == 0) soft_failed_requests_stats++; else failed_requests_stats++; ci_thread_mutex_unlock(&statsmtx); printf("Request failed...\n"); break; } ci_thread_mutex_lock(&statsmtx); requests_stats++; arand = rand(); /*rand is not thread safe .... */ ci_thread_mutex_unlock(&statsmtx); if (_THE_END) { printf("The end: thread dying\n"); ci_request_destroy(req); return 0; } if (keepalive == 0) break; arand = (int) ((((double) arand) / (double) RAND_MAX) * 10.0); if (arand == 5 || arand == 7 || arand == 3) { // 30% possibility .... // printf("OK, closing the connection......\n"); break; } // sleep(1); usleep(500000); // printf("Keeping alive connection\n"); ci_client_request_reuse(req); } ci_hard_close(conn->fd); ci_request_destroy(req); if (_THE_END) { printf("The end: thread dying ps 2\n"); return 0; } usleep(1000000); } return 1; } void usage(char *myname){ printf("Usage:\n %s servername service threadsnum max_requests file1 file2 .....\n", myname); printf("or:\n"); printf(" %s -req servername service threadsnum max_requests file\n", myname); } int add_xheader(const char *directive, const char **argv, void *setdata) { ci_headers_list_t **xh = (ci_headers_list_t **)setdata; const char *h; if (argv == NULL || argv[0] == NULL) { ci_debug_printf(1, "Missing arguments in directive:%s\n", directive); return 0; } h = argv[0]; if (!strchr(h, ':')) { ci_debug_printf(1, "The header :%s should have the form \"header: value\" \n", h); return 0; } if (*xh == NULL) *xh = ci_headers_create(); ci_headers_add(*xh, h); return 1; } static int FILES_SIZE =0; int cfg_files_to_use(const char *directive, const char **argv, void *setdata) { assert ((void *)FILES == *(void **)setdata); if (argv == NULL || argv[0] == NULL) { ci_debug_printf(1, "Missing arguments in directive:%s\n", directive); return 0; } if (FILES == NULL) { FILES_SIZE = 1024; FILES = malloc(FILES_SIZE*sizeof(char*)); } if (FILES_NUMBER == FILES_SIZE) { FILES_SIZE += 1024; FILES = realloc(FILES, FILES_SIZE*sizeof(char*)); } FILES[FILES_NUMBER++] = strdup(argv[0]); ci_debug_printf(1, "Append file %s to file list\n", argv[0]); return 1; } int add_xclient_headers(const char *directive, const char **argv, void *setdata) { int ip1, ip2, ip3, ip4_start, ip4_end, i; const char *ip, *s; char *e; char buf[256]; if (argv == NULL || argv[0] == NULL) { ci_debug_printf(1, "Missing arguments in directive:%s\n", directive); return 0; } ip = argv[0]; if(xclient_headers == NULL) xclient_headers = malloc(256*sizeof(char*)); /*I am expecting something like this: 192.168.1.1-15 */ s= ip; ip1 = strtol(s, &e, 10); if (*e != '.') return 0; s = e+1; ip2 = strtol(s, &e, 10); if (*e != '.') return 0; s= e+1; ip3 = strtol(s, &e, 10); if (*e != '.') return 0; s= e+1; ip4_start = strtol(s, &e, 10); if (*e == '-') { s= e+1; ip4_end = strtol(s, &e, 10); } else ip4_end = ip4_start; for(i=ip4_start; i<= ip4_end; i++) { sprintf(buf, "X-Client-IP: %d.%d.%d.%d", ip1, ip2,ip3,i); xclient_headers[xclient_headers_num++] = strdup(buf); } return 1; } char *urls_file = NULL; static struct ci_options_entry options[] = { {"-i", "icap_servername", &servername, ci_cfg_set_str, "The ICAP server name"}, {"-p", "port", &PORT, ci_cfg_set_int, "The ICAP server port"}, {"-s", "service", &service, ci_cfg_set_str, "The service name"}, {"-urls", "filename", &urls_file, ci_cfg_set_str, "File with urls to use for reqmod stress test"}, {"-req", NULL, &DoReqmod, ci_cfg_enable, "Send a request modification instead of response modification requests"}, {"-m", "max-requests", &MAX_REQUESTS, ci_cfg_set_int, "the maximum requests to send"}, {"-t", "threads-number", &threadsnum, ci_cfg_set_int, "number of threads to start"}, {"-d", "level", &CI_DEBUG_LEVEL, ci_cfg_set_int, "debug level info to stdout"}, // {"-nopreview", NULL, &send_preview, ci_cfg_disable, "Do not send preview data"}, {"-x", "xheader", &xheaders, add_xheader, "Include xheader in icap request headers"}, {"-hx", "xheader", &http_xheaders, add_xheader, "Include xheader in http request headers"}, {"-rhx", "xheader", &http_resp_xheaders, add_xheader, "Include xheader in http response headers"}, {"-hcx", "X-Client-IP", &xclient_headers, add_xclient_headers, "Include this X-Client-IP header in request"}, // {"-w", "preview", &preview_size, ci_cfg_set_int, "Sets the maximum preview data size"}, {"$$", NULL, &FILES, cfg_files_to_use, "files to send"}, {NULL, NULL, NULL, NULL} }; void log_errors(ci_request_t * req, const char *format, ...) { va_list ap; va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); } void vlog_errors(ci_request_t * req, const char *format, va_list ap) { vfprintf(stderr, format, ap); } int main(int argc, char **argv) { int i; CI_DEBUG_LEVEL = 1; /*Default debug level is 1 */ ci_cfg_lib_init(); int ret = ci_args_apply(argc, argv, options); if (!ret || (DoReqmod != 0 && urls_file == NULL) || (DoReqmod == 0 && FILES == NULL)) { ci_args_usage(argv[0], options); exit(-1); } #if ! defined(_WIN32) __log_error = (void (*)(void *, const char *,...)) log_errors; /*set c-icap library log function */ #else __vlog_error = vlog_errors; /*set c-icap library log function for win32..... */ #endif signal(SIGPIPE, SIG_IGN); signal(SIGINT, sigint_handler); time(&START_TIME); srand((int) START_TIME); if (urls_file && !load_urls(urls_file)) { ci_debug_printf(1, "The file contains URL list %s does not exist\n", urls_file); exit(1); } threads = malloc(sizeof(ci_thread_t) * threadsnum); if (!threads) { ci_debug_printf(1, "Error allocation memory for threads array\n"); exit(-1); } for (i = 0; i < threadsnum; i++) threads[i] = 0; if (DoReqmod) { for (i = 0; i < threadsnum; i++) { printf("Create thread %d\n", i); ci_thread_create(&(threads[i]), (void *(*)(void *)) threadjobreqmod, (void *) NULL /*data*/); sleep(1); } } else { ci_thread_mutex_init(&filemtx); ci_thread_mutex_init(&statsmtx); printf("Files to send:%d\n", FILES_NUMBER); for (i = 0; i < threadsnum; i++) { printf("Create thread %d\n", i); ci_thread_create(&(threads[i]), (void *(*)(void *)) threadjobsendfiles, NULL); // sleep(1); } } while (1) { sleep(1); if (MAX_REQUESTS && requests_stats >= MAX_REQUESTS) { printf("Oops max requests reached. Exiting .....\n"); _THE_END = 1; break; } print_stats(); } for (i = 0; i < threadsnum; i++) { ci_thread_join(threads[i]); printf("Thread %d exited\n", i); } print_stats(); ci_thread_mutex_destroy(&filemtx); ci_thread_mutex_destroy(&statsmtx); return 0; } c_icap-0.4.2/proc_threads_queues.c0000664000175000017500000003511212567550776014114 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include "debug.h" #include "log.h" #include "proc_threads_queues.h" #include "shared_mem.h" #include static int old_requests = 0; struct connections_queue *init_queue(int size) { int ret; struct connections_queue *q; if ((q = (struct connections_queue *) malloc(sizeof(struct connections_queue))) == NULL) return NULL; ret = ci_thread_mutex_init(&(q->queue_mtx)); if (ret == 0) ret = ci_thread_mutex_init(&(q->cond_mtx)); if (ret == 0) ret = ci_thread_cond_init(&(q->queue_cond)); if (ret == 0 && (q->connections = (ci_connection_t *) malloc(size * sizeof(ci_connection_t))) != NULL) { q->size = size; q->used = 0; return q; } //else memory allocation failed or mutex/cond init failed if (q->connections) free(q->connections); free(q); return NULL; } void destroy_queue(struct connections_queue *q) { ci_thread_mutex_destroy(&(q->queue_mtx)); ci_thread_cond_destroy(&(q->queue_cond)); free(q->connections); free(q); } int put_to_queue(struct connections_queue *q, ci_connection_t * con) { int ret; if (ci_thread_mutex_lock(&(q->queue_mtx)) != 0) return -1; if (q->used == q->size) { ci_thread_mutex_unlock(&(q->queue_mtx)); ci_debug_printf(1, "put_to_queue_fatal error used=%d size=%d\n", q->used, q->size); return 0; } ci_copy_connection(&(q->connections[q->used]), con); ret = ++q->used; ci_thread_mutex_unlock(&(q->queue_mtx)); ci_thread_cond_signal(&(q->queue_cond)); //???? return ret; } int get_from_queue(struct connections_queue *q, ci_connection_t * con) { if (ci_thread_mutex_lock(&(q->queue_mtx)) != 0) return -1; if (q->used == 0) { ci_thread_mutex_unlock(&(q->queue_mtx)); return 0; } q->used--; ci_copy_connection(con, &(q->connections[q->used])); ci_thread_mutex_unlock(&(q->queue_mtx)); return 1; } int wait_for_queue(struct connections_queue *q) { ci_debug_printf(7, "Waiting for a request....\n"); if (ci_thread_mutex_lock(&(q->cond_mtx)) != 0) return -1; if (ci_thread_cond_wait(&(q->queue_cond), &(q->cond_mtx)) != 0) { ci_thread_mutex_unlock(&(q->cond_mtx)); return -1; } if (ci_thread_mutex_unlock(&(q->cond_mtx)) != 0) return -1; return 1; } /***********************************************************************************/ /* */ /* Children queue...... */ int create_childs_queue(struct childs_queue *q, int size) { int ret, i; struct stat_memblock *mem_block; q->stats_block_size = ci_stat_memblock_size(); q->shared_mem_size = sizeof(child_shared_data_t) * size /*child shared data*/ + q->stats_block_size * size /*child stats area*/ + q->stats_block_size /*Server history stats area*/ + sizeof(struct server_statistics); /*Server general statistics*/ if ((q->childs = ci_shared_mem_create(&(q->shmid), "kids-queue", q->shared_mem_size)) == NULL) { log_server(NULL, "can't get shared memory!"); return 0; } q->size = size; q->stats_area = (void *)(q->childs) + sizeof(child_shared_data_t) * q->size; for (i = 0; i < q->size; i++) { mem_block = q->stats_area + i * q->stats_block_size; mem_block->sig = MEMBLOCK_SIG; } q->stats_history = q->stats_area + q->size * q->stats_block_size; q->stats_history->sig = MEMBLOCK_SIG; q->srv_stats = (struct server_statistics *)(q->stats_area + q->size * q->stats_block_size + q->stats_block_size); ci_debug_printf(2, "Create shared mem, qsize=%d stat_block_size=%d childshared data:%d\n", q->size, q->stats_block_size, (int)sizeof(child_shared_data_t) * q->size); stat_memblock_fix(q->stats_history); ci_stat_memblock_reset(q->stats_history); for (i = 0; i < q->size; i++) { q->childs[i].pid = 0; q->childs[i].pipe = -1; } /* reset statistics */ q->srv_stats->started_childs = 0; q->srv_stats->closed_childs = 0; q->srv_stats->crashed_childs = 0; if ((ret = ci_proc_mutex_init(&(q->queue_mtx), "children-queue")) == 0) { /*Release shared mem which is allocated */ ci_shared_mem_destroy(&(q->shmid)); log_server(NULL, "can't create children queue semaphore!"); return 0; } return 1; } int attach_childs_queue(struct childs_queue *q) { child_shared_data_t *c; ci_proc_mutex_lock(&(q->queue_mtx)); //Not really needed ......... if ((c = (child_shared_data_t *) ci_shared_mem_attach(&(q->shmid))) == NULL) { log_server(NULL, "can't attach shared memory!"); ci_proc_mutex_unlock(&(q->queue_mtx)); return 0; } q->childs = c; ci_proc_mutex_unlock(&(q->queue_mtx)); return 1; } int dettach_childs_queue(struct childs_queue *q) { ci_proc_mutex_lock(&(q->queue_mtx)); //Not really needed ......... if (ci_shared_mem_detach(&(q->shmid)) == 0) { log_server(NULL, "can't dettach shared memory!"); ci_proc_mutex_unlock(&(q->queue_mtx)); return 0; } q->childs = NULL; ci_proc_mutex_unlock(&(q->queue_mtx)); return 1; } int destroy_childs_queue(struct childs_queue *q) { ci_proc_mutex_lock(&(q->queue_mtx)); //Not really needed ......... if (!ci_shared_mem_destroy(&(q->shmid))) { log_server(NULL, "can't destroy shared memory!"); ci_proc_mutex_unlock(&(q->queue_mtx)); return 0; } q->childs = NULL; ci_proc_mutex_unlock(&(q->queue_mtx)); ci_proc_mutex_destroy(&(q->queue_mtx)); return 1; } int childs_queue_is_empty(struct childs_queue *q) { int i; for (i = 0; i < q->size; i++) { if (q->childs[i].pid != 0) return 0; } return 1; } child_shared_data_t *get_child_data(struct childs_queue * q, process_pid_t pid) { int i; if (!q->childs) return NULL; for (i = 0; i < q->size; i++) { if (q->childs[i].pid == pid) return &(q->childs[i]); } return NULL; } child_shared_data_t *register_child(struct childs_queue * q, process_pid_t pid, int maxservers, ci_pipe_t pipe) { int i; if (!q->childs) return NULL; ci_debug_printf(8, "Register in shared mem, qsize=%d stat_block_size=%d childshared data:%d\n", q->size, q->stats_block_size, (int) sizeof(child_shared_data_t) * q->size); ci_proc_mutex_lock(&(q->queue_mtx)); for (i = 0; i < q->size; i++) { if (q->childs[i].pid == 0) { q->childs[i].pid = pid; q->childs[i].freeservers = maxservers; q->childs[i].usedservers = 0; q->childs[i].requests = 0; q->childs[i].connections = 0; q->childs[i].to_be_killed = 0; q->childs[i].father_said = 0; q->childs[i].idle = 1; q->childs[i].pipe = pipe; q->childs[i].stats = (void *)(q->childs) + sizeof(child_shared_data_t) * q->size + i * (q->stats_block_size); assert(q->childs[i].stats->sig == MEMBLOCK_SIG); q->childs[i].stats_size = q->stats_block_size; ci_proc_mutex_unlock(&(q->queue_mtx)); return &(q->childs[i]); } } ci_proc_mutex_unlock(&(q->queue_mtx)); return NULL; } void announce_child(struct childs_queue *q, process_pid_t pid) { if (q->childs && pid) q->srv_stats->started_childs++; } int remove_child(struct childs_queue *q, process_pid_t pid, int status) { int i; struct stat_memblock *child_stats; if (!q->childs) return 0; ci_proc_mutex_lock(&(q->queue_mtx)); for (i = 0; i < q->size; i++) { if (q->childs[i].pid == pid) { q->childs[i].pid = 0; old_requests += q->childs[i].requests; if (q->childs[i].pipe >= 0) { close(q->childs[i].pipe); q->childs[i].pipe = -1; } child_stats = q->stats_area + i * (q->stats_block_size); /*re-arange pointers in childs memblock*/ stat_memblock_reconstruct(child_stats); ci_stat_memblock_merge(q->stats_history, child_stats); q->srv_stats->closed_childs++; if (status) q->srv_stats->crashed_childs++; ci_proc_mutex_unlock(&(q->queue_mtx)); return 1; } } ci_proc_mutex_unlock(&(q->queue_mtx)); return 0; } int find_a_child_to_be_killed(struct childs_queue *q) { int i, which, freeservers; ci_proc_mutex_lock(&(q->queue_mtx)); freeservers = q->childs[0].freeservers; which = 0; for (i = 1; i < q->size; i++) { if (q->childs[i].pid != 0 && freeservers > q->childs[i].freeservers) { freeservers = q->childs[i].freeservers; which = i; } } ci_proc_mutex_unlock(&(q->queue_mtx)); return which; } int find_a_child_nrequests(struct childs_queue *q, int max_requests) { int i, which, requests; which = -1; requests = max_requests; ci_proc_mutex_lock(&(q->queue_mtx)); for (i = 0; i < q->size; i++) { if (q->childs[i].pid == 0) continue; if (q->childs[i].to_be_killed) { /*If a death of a child pending do not kill any other */ ci_proc_mutex_unlock(&(q->queue_mtx)); return -1; } if (requests < q->childs[i].requests) { requests = q->childs[i].requests; which = i; } } ci_proc_mutex_unlock(&(q->queue_mtx)); return which; } int find_an_idle_child(struct childs_queue *q) { int i, which, requests = -1; which = -1; ci_proc_mutex_lock(&(q->queue_mtx)); for (i = 0; i < q->size; i++) { if (q->childs[i].pid == 0) continue; if (q->childs[i].to_be_killed) { /*A child going to die wait... */ ci_proc_mutex_unlock(&(q->queue_mtx)); return -1; } if (q->childs[i].usedservers == 0 && q->childs[i].idle == 1) { if (requests < q->childs[i].requests) { requests = q->childs[i].requests; which = i; } } } ci_proc_mutex_unlock(&(q->queue_mtx)); return which; } int childs_queue_stats(struct childs_queue *q, int *childs, int *freeservers, int *used, int *maxrequests) { int i; *childs = 0; *freeservers = 0; *used = 0; *maxrequests = 0; if (!q->childs) return 0; for (i = 0; i < q->size; i++) { if (q->childs[i].pid != 0 && q->childs[i].to_be_killed == 0) { (*childs)++; (*freeservers) += q->childs[i].freeservers; (*used) += q->childs[i].usedservers; (*maxrequests) += q->childs[i].requests; } } (*maxrequests) += old_requests; return 1; } void dump_queue_statistics(struct childs_queue *q) { int i, k; int childs = 0; int freeservers = 0; int used = 0; int requests = 0; struct stat_memblock *child_stats, copy_stats; if (!q->childs) return; for (i = 0; i < q->size; i++) { if (q->childs[i].pid != 0 && q->childs[i].to_be_killed == 0) { childs++; freeservers += q->childs[i].freeservers; used += q->childs[i].usedservers; requests += q->childs[i].requests; ci_debug_printf(1, "\nChild pid:%d\tFree Servers:%d\tUsed Servers:%d\tRequests:%d\n", q->childs[i].pid, q->childs[i].freeservers, q->childs[i].usedservers, q->childs[i].requests ); child_stats = q->stats_area + i * (q->stats_block_size); copy_stats.counters64_size = child_stats->counters64_size; copy_stats.counterskbs_size = child_stats->counterskbs_size; copy_stats.counters64 = (void *)child_stats + sizeof(struct stat_memblock); copy_stats.counterskbs = (void *)child_stats + sizeof(struct stat_memblock) + child_stats->counters64_size*sizeof(uint64_t); for (k=0; k < copy_stats.counters64_size && k < STAT_INT64.entries_num; k++) ci_debug_printf(1,"\t%s:%llu\n", STAT_INT64.entries[k].label, (long long unsigned) copy_stats.counters64[k]); for (k=0; k < copy_stats.counterskbs_size && k < STAT_KBS.entries_num; k++) ci_debug_printf(1,"\t%s:%llu kbytes and %d bytes\n", STAT_KBS.entries[k].label, (long long unsigned) copy_stats.counterskbs[k].kb, copy_stats.counterskbs[k].bytes); } } ci_debug_printf(1, "\nChildren:%d\tFree Servers:%d\tUsed Servers:%d\tRequests:%d\n", childs, freeservers, used, requests); ci_debug_printf(1,"\nHistory\n"); for (k=0; k < q->stats_history->counters64_size && k < STAT_INT64.entries_num; k++) ci_debug_printf(1,"\t%s:%llu\n", STAT_INT64.entries[k].label, (long long unsigned) q->stats_history->counters64[k]); for (k=0; k < q->stats_history->counterskbs_size && k < STAT_KBS.entries_num; k++) ci_debug_printf(1,"\t%s:%llu kbytes and %d bytes\n",STAT_KBS.entries[k].label, (long long unsigned) q->stats_history->counterskbs[k].kb, q->stats_history->counterskbs[k].bytes); } c_icap-0.4.2/log.c0000664000175000017500000002563312567550777010641 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include #include #include #include "log.h" #include "util.h" #include "access.h" #include "module.h" #include "cfg_param.h" #include "debug.h" #include "txt_format.h" #include "acl.h" #include "proc_threads_queues.h" #include "commands.h" #include #include logger_module_t *default_logger = NULL; void logformat_release(); int log_open() { if (default_logger) return default_logger->log_open(); return 0; } void log_close() { if (default_logger) { default_logger->log_close(); } } void log_reset() { logformat_release(); default_logger = NULL; } void log_access(ci_request_t * req, int status) { /*req can not be NULL */ if (!req) return; if (default_logger) default_logger->log_access(req); } extern process_pid_t MY_PROC_PID; void log_server(ci_request_t * req, const char *format, ...) { /*req can be NULL......... */ va_list ap; char prefix[64]; va_start(ap, format); if (default_logger) { if (MY_PROC_PID) snprintf(prefix, 64, "%u/%u", (unsigned int)MY_PROC_PID, (unsigned int)ci_thread_self()); else /*probably the main process*/ strcpy(prefix, "main proc"); default_logger->log_server(prefix, format, ap); /*First argument must be changed..... */ } va_end(ap); } void vlog_server(ci_request_t * req, const char *format, va_list ap) { if (default_logger) default_logger->log_server("", format, ap); } /*************************************************************/ /* logformat */ /* Maybe logformat manipulation functions should moved to the c-icap library, because some platforms (eg. MS-WINDOWS) can not use functions and objects defined in main executable. At this time ony the sys_logger.c module uses these functions which make sense on unix platforms (where there is not a such problem). Moreover the sys_logger can be compiled inside c-icap main executable to avoid such problems. */ struct logformat { char *name; char *fmt; struct logformat *next; }; struct logformat *LOGFORMATS = NULL; int logformat_add(const char *name, const char *format) { struct logformat *lf, *tmp; lf = malloc(sizeof(struct logformat)); if (!lf) { ci_debug_printf(1, "Error allocating memory in add_logformat\n"); return 0; } lf->name = strdup(name); lf->fmt = strdup(format); if (!lf->name || !lf->fmt) { ci_debug_printf(1, "Error strduping in add_logformat\n"); free(lf); return 0; } lf->next = NULL; if (LOGFORMATS==NULL) { LOGFORMATS = lf; return 1; } tmp = LOGFORMATS; while (tmp->next != NULL) tmp = tmp->next; tmp->next = lf; return 1; } void logformat_release() { struct logformat *cur, *tmp; if (!(tmp = LOGFORMATS)) return; do { cur = tmp; tmp = tmp->next; free(cur->name); free(cur->fmt); free(cur); } while(tmp); LOGFORMATS = NULL; } char *logformat_fmt(const char *name) { struct logformat *tmp; if (!(tmp = LOGFORMATS)) return NULL; while (tmp) { if (strcmp(tmp->name, name) == 0) return tmp->fmt; tmp = tmp->next; } return NULL; } /******************************************************************/ /* file_logger implementation. This is the default logger */ /* */ int file_log_open(); void file_log_close(); void file_log_access(ci_request_t *req); void file_log_server(const char *server, const char *format, va_list ap); void file_log_relog(const char *name, int type, const char **argv); /*char *LOGS_DIR=LOGDIR;*/ char *SERVER_LOG_FILE = LOGDIR "/cicap-server.log"; /*char *ACCESS_LOG_FILE = LOGDIR "/cicap-access.log";*/ struct logfile { char *file; FILE *access_log; const char *log_fmt; ci_access_entry_t *access_list; ci_thread_rwlock_t rwlock; struct logfile *next; }; struct logfile *ACCESS_LOG_FILES = NULL; static ci_thread_rwlock_t systemlog_rwlock; logger_module_t file_logger = { "file_logger", NULL, file_log_open, file_log_close, file_log_access, file_log_server, NULL /*NULL configuration table */ }; FILE *server_log = NULL; const char *DEFAULT_LOG_FORMAT = "%tl, %la %a %im %iu %is"; FILE *logfile_open(const char *fname) { FILE *f = fopen(fname, "a+"); if (f) setvbuf(f, NULL, _IONBF, 0); return f; } int file_log_open() { int error=0, ret = 0; struct logfile *lf; assert(ret == 0); register_command("relog", MONITOR_PROC_CMD | CHILDS_PROC_CMD, file_log_relog); for (lf = ACCESS_LOG_FILES; lf != NULL; lf = lf->next) { if (!lf->file) { ci_debug_printf (1, "This is a bug! lf->file==NULL\n"); continue; } if (lf->log_fmt == NULL) lf->log_fmt = (char *)DEFAULT_LOG_FORMAT; lf->access_log = logfile_open(lf->file); if (!lf->access_log) { error = 1; ci_debug_printf (1, "WARNING! Can not open log file: %s\n", lf->file); } ret = ci_thread_rwlock_init(&(lf->rwlock)); // Initialize logfile::rwlock } ret = ci_thread_rwlock_init(&systemlog_rwlock); server_log = logfile_open(SERVER_LOG_FILE); if (!server_log) return 0; if (error) return 0; else return 1; } void file_log_close() { struct logfile *lf, *tmp; lf = ACCESS_LOG_FILES; while(lf != NULL) { if (lf->access_log) fclose(lf->access_log); free(lf->file); if (lf->access_list) ci_access_entry_release(lf->access_list); ci_thread_rwlock_destroy(&(lf->rwlock)); // Initialize logfile::rwlock tmp = lf; lf = lf->next; ACCESS_LOG_FILES = lf; free(tmp); } if (server_log) fclose(server_log); server_log = NULL; ci_thread_rwlock_destroy(&systemlog_rwlock); // destroy rwlock } void file_log_relog(const char *name, int type, const char **argv) { struct logfile *lf; /* This code should match the appropriate code from file_log_close */ for (lf = ACCESS_LOG_FILES; lf != NULL; lf = lf->next) { ci_thread_rwlock_wrlock(&(lf->rwlock)); /*obtain a write lock. When this function returns all file_log_access will block until write unlock*/ if (lf->access_log) fclose(lf->access_log); lf->access_log = logfile_open(lf->file); ci_thread_rwlock_unlock(&(lf->rwlock)); if (!lf->access_log) ci_debug_printf (1, "WARNING! Can not open log file: %s\n", lf->file); } ci_thread_rwlock_wrlock(&systemlog_rwlock); if (server_log) fclose(server_log); server_log = logfile_open(SERVER_LOG_FILE); ci_thread_rwlock_unlock(&systemlog_rwlock); /*if !server_log ???*/ } void file_log_access(ci_request_t *req) { struct logfile *lf; char logline[4096]; for (lf = ACCESS_LOG_FILES; lf != NULL; lf = lf->next) { if (lf->access_list && !(ci_access_entry_match_request(lf->access_list, req) == CI_ACCESS_ALLOW)) { ci_debug_printf(6, "access log file %s does not match, skiping\n", lf->file); continue; } ci_debug_printf(6, "Log request to access log file %s\n", lf->file); ci_format_text(req, lf->log_fmt, logline, sizeof(logline), NULL); ci_thread_rwlock_rdlock(&lf->rwlock); /*obtain a read lock*/ if (lf->access_log) fprintf(lf->access_log,"%s\n", logline); ci_thread_rwlock_unlock(&lf->rwlock); /*obtain a read lock*/ } } void file_log_server(const char *server, const char *format, va_list ap) { char buf[STR_TIME_SIZE]; if (!server_log) return; ci_strtime(buf); ci_thread_rwlock_rdlock(&systemlog_rwlock); /*obtain a read lock*/ fprintf(server_log, "%s, %s, ", buf, server); vfprintf(server_log, format, ap); ci_thread_rwlock_unlock(&systemlog_rwlock); /*release a read lock*/ // fprintf(server_log,"\n"); } int file_log_addlogfile(const char *file, const char *format, const char **acls) { char *access_log_file, *access_log_format; const char *acl_name; struct logfile *lf, *newlf; int i; access_log_file = strdup(file); if (!access_log_file) return 0; if (format) { /*the folowing return format txt or NULL. It is OK*/ access_log_format = logformat_fmt(format); } else access_log_format = NULL; newlf = malloc(sizeof(struct logfile)); newlf->file = access_log_file; newlf->log_fmt = (access_log_format != NULL? access_log_format : DEFAULT_LOG_FORMAT); newlf->access_log = NULL; newlf->access_list = NULL; newlf->next = NULL; if (acls != NULL && acls[0] != NULL) { if (ci_access_entry_new(&(newlf->access_list), CI_ACCESS_ALLOW) == NULL) { ci_debug_printf(1, "Error creating access list for access log file %s!\n", newlf->file); free(newlf->file); free(newlf); return 0; } for (i=0; acls[i] != NULL; i++) { acl_name = acls[i]; if (!ci_access_entry_add_acl_by_name(newlf->access_list, acl_name)) { ci_debug_printf(1, "Error addind acl %s to access list for access log file %s!\n", acl_name, newlf->file); ci_access_entry_release(newlf->access_list); free(newlf->file); free(newlf); return 0; } } } if (!ACCESS_LOG_FILES){ ACCESS_LOG_FILES = newlf; } else { for (lf = ACCESS_LOG_FILES; lf->next != NULL; lf = lf->next) { if (strcmp(lf->file, newlf->file)==0) { ci_debug_printf(1, "Access log file %s already defined!\n", newlf->file); if (newlf->access_list) ci_access_entry_release(newlf->access_list); free(newlf->file); free(newlf); return 0; } } lf->next = newlf; } return 1; } c_icap-0.4.2/config.sub0000755000175000017500000010535412601747524011657 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-08-10' # 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 3 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, see . # # 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. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches with a ChangeLog entry to config-patches@gnu.org. # # 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. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # 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 1992-2013 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 ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # 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 ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) 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 | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -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 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -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/'` ;; -sco5v6*) # 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*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -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 \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 \ | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # 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-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # 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 ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; 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 ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; 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 ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; 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 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; 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*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 ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; 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 ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; 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 ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; 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 ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) 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 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; 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 ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-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 ;; mmix) basic_machine=mmix-knuth ;; 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 ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -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* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -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 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -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 score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or1k-*) 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 ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-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 ;; -cnk*|-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 ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -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 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: c_icap-0.4.2/makefile.w320000664000175000017500000000254312567550777012021 00000000000000!include !include "c_icap.mak" LIBOS=os\win32\~ MODULES=services\echo\ services\url_check\ ALL_DIRS=$(LIBOS) DLL_ENTRY=os/win32/dll_entry.obj MOD_DLL_ENTRY=../../os/win32/dll_entry.obj c_icap_OBJS = request.obj proc_threads_queues.obj aserver.obj winnt_server.obj module.obj service.obj log.obj access.obj cfg_param.obj http_auth.obj all: c_icap.Dll c-icap.exe sub_modules .c.obj: $(cc) -Iinclude $(cdebug) $(cflags) $(cvarsmt) $(CI_DEFS) -I. -DUNICODE $*.c # $(cc) -Iinclude $(cdebug) $(cflags) $(cvarsdll) -I. -DUNICODE $*.c c_icap.Dll: @if EXIST c_icap_dll.mak $(MAKE) -f c_icap_dll.mak DLL_ENTRY=$(DLL_ENTRY) c-icap.exe: $(c_icap_OBJS) $(link) $(ldebug) $(conlflags) $(conlibsdll) user32.lib c_icap.lib $** /OUT:c-icap.exe # The following not needed any more. #$(LIBOS): # @cd $(@D) # @echo *** %CD% *** # @if NOT "%CD%"== "" $(MAKE) -f makefile.w32 $(makeopts) /$(MAKEFLAGS) # @cd ..\.. sub_modules: @for %%d in ($(MODULES)) do (cd %%d && $(MAKE) -f makefile.w32 DLL_ENTRY=$(MOD_DLL_ENTRY) $(makeopts) /$(MAKEFLAGS) & cd ..\..\ ) # @cd $(@D) # @echo *** %CD% *** # @if NOT "%CD%"== "" $(MAKE) -f makefile.w32 DLL_ENTRY=$(MOD_DLL_ENTRY) $(makeopts) /$(MAKEFLAGS) # @cd ..\.. clean: del *.obj *.exe *.lib *.dll os\win32\*.obj os\win32\*.lib @for %%d in ($(MODULES)) do (cd %%d && @$(MAKE) -f makefile.w32 clean & cd ..\..\ ) c_icap-0.4.2/install-sh0000755000175000017500000003325512601747524011700 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-11-20.07; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: c_icap-0.4.2/c-icap.dox0000664000175000017500000015641412567550777011566 00000000000000# Doxyfile 1.5.5 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = c-icap-doc # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = 0.1 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = docs/ # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, # Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), # Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, # Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, # and Ukrainian. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = YES # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = YES # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the DETAILS_AT_TOP tag is set to YES then Doxygen # will output the detailed description near the top, like JavaDoc. # If set to NO, the detailed description appears after the member # documentation. DETAILS_AT_TOP = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = YES # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = YES # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = NO # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = ./ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 FILE_PATTERNS = *.c \ *.h # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = Yes # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = ./ # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES (the default) # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES (the default) # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. Otherwise they will link to the documentstion. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = NO #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. For this to work a browser that supports # JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox # Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). HTML_DYNAMIC_SECTIONS = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # If the GENERATE_TREEVIEW tag is set to YES, a side panel will be # generated containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = YES # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = "CI_DECLARE_FUNC=" \ "CI_DECLARE_DATA=" # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is enabled by default, which results in a transparent # background. Warning: Depending on the platform used, enabling this option # may lead to badly anti-aliased labels on the edges of a graph (i.e. they # become hard to read). DOT_TRANSPARENT = YES # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO c_icap-0.4.2/Makefile.am0000664000175000017500000001155612567550777011747 00000000000000 CONFIGDIR=@sysconfdir@ PKGLIBDIR=@pkglibdir@ MODULESDIR=$(pkglibdir)/ SERVICESDIR=$(pkglibdir)/ #CONFIGDIR=$(sysconfdir)/ DATADIR=$(pkgdatadir)/ LOGDIR=$(localstatedir)/log/ SOCKDIR=/var/run/c-icap DOXYGEN=@doxygen_bin@ SUBDIRS = . utils modules services tests docs lib_LTLIBRARIES=libicapapi.la bin_PROGRAMS = c-icap bin_SCRIPTS = c-icap-config c-icap-libicapapi-config UTIL_LIB_SOURCES=net_io.c util.c os/unix/net_io.c os/unix/proc_mutex.c os/unix/shared_mem.c os/unix/threads.c os/unix/utilfunc.c os/unix/dlib.c if USE_REGEX UTIL_LIB_SOURCES += regex.c endif UTIL_SOURCES=os/unix/proc_utils.c libicapapi_la_SOURCES= header.c body.c decode.c simple_api.c request_common.c \ filetype.c debug.c cfg_lib.c mem.c service_lib.c \ cache.c lookup_table.c lookup_file_table.c hash.c \ txt_format.c stats.c types_ops.c acl.c txtTemplate.c \ array.c registry.c md5.c $(UTIL_LIB_SOURCES) c_icap_SOURCES = aserver.c request.c cfg_param.c \ proc_threads_queues.c http_auth.c \ access.c log.c service.c module.c \ commands.c mpmt_server.c dlib.c info.c default_acl.c $(UTIL_SOURCES) # libicapapi ...... libicapapi_la_CFLAGS= $(INVISIBILITY_CFLAG) -Iinclude/ @ZLIB_ADD_FLAG@ @BZLIB_ADD_FLAG@ @PCRE_ADD_FLAG@ -DCI_BUILD_LIB libicapapi_la_LIBADD = @ZLIB_ADD_LDADD@ @BZLIB_ADD_LDADD@ @PCRE_ADD_LDADD@ @DL_ADD_FLAG@ @THREADS_LDADD@ libicapapi_la_LDFLAGS= -shared -version-info @CICAPLIB_VERSION@ @THREADS_LDFLAGS@ #c_icap the main server c_icap_DEPENDENCIES=libicapapi.la c_icap_CFLAGS= $(INVISIBILITY_CFLAG) -Iinclude/ \ -DCONFDIR=\"$(CONFIGDIR)\" -DMODSDIR=\"$(MODULESDIR)\" \ -DSERVDIR=\"$(SERVICESDIR)\" -DLOGDIR=\"$(LOGDIR)\" \ -DDATADIR=\"$(DATADIR)\" c_icap_LDADD = libicapapi.la @DL_ADD_FLAG@ @THREADS_LDADD@ c_icap_LDFLAGS = -rdynamic -rpath @libdir@ @THREADS_LDFLAGS@ EXT_PROGRAMS_MKLIB = -licapapi INCS = access.h body.h cfg_param.h c-icap-conf.h c-icap.h ci_threads.h \ commands.h debug.h dlib.h filetype.h header.h log.h mem.h module.h \ net_io.h proc_mutex.h proc_threads_queues.h request.h service.h \ shared_mem.h simple_api.h util.h lookup_table.h hash.h stats.h acl.h \ cache.h txt_format.h types_ops.h txtTemplate.h array.h registry.h \ md5.h ci_regex.h ALL_INCS=$(INCS:%.h=include/%.h) pkginclude_HEADERS = $(ALL_INCS) #sysconf_DATA = c-icap.conf c-icap.magic do_subst=sed -e 's%[@]SYSCONFDIR[@]%$(CONFIGDIR)%g' \ -e 's%[@]PACKAGE_VERSION[@]%$(PACKAGE_VERSION)%g' \ -e 's%[@]PACKAGE[@]%$(PACKAGE)%g' \ -e 's%[@]prefix[@]%$(prefix)%g' \ -e 's%[@]LIBDIR[@]%$(libdir)%g' \ -e 's%[@]PKGINCLUDEDIR[@]%$(pkgincludedir)%g' \ -e 's%[@]INCLUDEDIR[@]%$(includedir)%g' \ -e 's%[@]PKGLIBDIR[@]%$(pkglibdir)%g' \ -e 's%[@]PKGDATADIR[@]%$(pkgdatadir)%g' \ -e 's%[@]CFLAGS[@]%$(CFLAGS)%g' \ -e 's%[@]MODULES_LIBADD[@]%$(MODULES_LIBADD)%g' \ -e 's%[@]MODULES_CFLAGS[@]%$(MODULES_CFLAGS)%g' \ -e 's%[@]EXT_PROGRAMS_LIBADD[@]%$(EXT_PROGRAMS_MKLIB)%g' \ -e 's%[@]SOCKDIR[@]%$(SOCKDIR)%g' CLEANFILES = c-icap-config c-icap-libicapapi-config c-icap-config: c-icap-config.in configure $(do_subst) < c-icap-config.in > $@ chmod 755 $@ c-icap-libicapapi-config: c-icap-libicapapi-config.in configure $(do_subst) < c-icap-libicapapi-config.in > $@ chmod 755 $@ doc: $(DOXYGEN) c-icap.dox install-data-local: $(mkinstalldirs) $(DESTDIR)$(CONFIGDIR); $(INSTALL) c-icap.conf $(DESTDIR)$(CONFIGDIR)/c-icap.conf.default $(INSTALL) c-icap.magic $(DESTDIR)$(CONFIGDIR)/c-icap.magic.default if test ! -f $(DESTDIR)$(CONFIGDIR)/c-icap.conf; then $(INSTALL) c-icap.conf $(DESTDIR)$(CONFIGDIR)/c-icap.conf; fi if test ! -f $(DESTDIR)$(CONFIGDIR)/c-icap.magic; then $(INSTALL) c-icap.magic $(DESTDIR)$(CONFIGDIR)/c-icap.magic; fi $(mkinstalldirs) $(DESTDIR)$(LOGDIR); $(mkinstalldirs) $(DESTDIR)$(SOCKDIR); chgrp nogroup $(DESTDIR)$(LOGDIR) || echo -e "*********\nWARNING! Can not set group for the log dir $(DESTDIR)$(LOGDIR)\n*********\n" chmod 775 $(DESTDIR)$(LOGDIR) chgrp nogroup $(DESTDIR)$(SOCKDIR) || echo -e "*********\nWARNING! Can not set group for the c-icap socket store dir $(DESTDIR)$(SOCKDIR)\n\n*********\n" chmod 775 $(DESTDIR)$(SOCKDIR) EXTRA_DIST = RECONF config-w32.h makefile.w32 c-icap.conf \ c_icap_dll.mak c-icap.conf.in c-icap.magic c_icap.mak c_icap.def \ contrib/get_file.pl contrib/convert_old_magic.pl \ winnt_server.c os/win32/dll_entry.c os/win32/makefile.w32 \ os/win32/net_io.c os/win32/proc_mutex.c \ os/win32/shared_mem.c os/win32/threads.c os/win32/utilfunc.c \ common.h \ c-icap-config.in c-icap-libicapapi-config.in c-icap.dox \ build/c_icap_version.awk c_icap-0.4.2/access.c0000664000175000017500000000520612567550776011312 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include "request.h" #include "module.h" #include "cfg_param.h" #include "debug.h" #include "access.h" #include "simple_api.h" #include "net_io.h" /********************************************************************************************/ extern access_control_module_t default_acl; access_control_module_t *default_access_controllers[] = { &default_acl, NULL }; access_control_module_t **used_access_controllers = default_access_controllers; int access_reset() { used_access_controllers = default_access_controllers; return 1; } int access_check_client(ci_request_t *req) { int i = 0, res; if (!used_access_controllers) return CI_ACCESS_ALLOW; i = 0; while (used_access_controllers[i] != NULL) { if (used_access_controllers[i]->client_access) { res = used_access_controllers[i]->client_access(req); if (res != CI_ACCESS_UNKNOWN) return res; } i++; } return CI_ACCESS_ALLOW; } int check_request(ci_request_t * req) { int res, i = 0; while (used_access_controllers[i] != NULL) { if (used_access_controllers[i]->request_access) { res = used_access_controllers[i]->request_access(req); if (res != CI_ACCESS_UNKNOWN) return res; } i++; } return CI_ACCESS_ALLOW; } int access_check_request(ci_request_t * req) { int res; if (!used_access_controllers) return CI_ACCESS_ALLOW; ci_debug_printf(9,"Going to check request for access control restrictions\n"); res = check_request(req); ci_debug_printf(9,"Access control: %s\n", (res==CI_ACCESS_ALLOW? "ALLOW": (res==CI_ACCESS_DENY?"DENY":"UNKNOWN"))); return res; } c_icap-0.4.2/mpmt_server.c0000664000175000017500000012407412575757272012420 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include #include #include #include #include #include #include #include #include #include #include #include #include "net_io.h" #include "proc_mutex.h" #include "debug.h" #include "log.h" #include "request.h" #include "ci_threads.h" #include "proc_threads_queues.h" #include "cfg_param.h" #include "commands.h" #define MULTICHILD //#undef MULTICHILD extern int MAX_KEEPALIVE_REQUESTS; extern int MAX_SECS_TO_LINGER; extern int MAX_REQUESTS_BEFORE_REALLOCATE_MEM; extern int MAX_REQUESTS_PER_CHILD; extern struct ci_server_conf CI_CONF; typedef struct server_decl { int srv_id; ci_thread_t srv_pthread; struct connections_queue *con_queue; ci_request_t *current_req; int served_requests; int served_requests_no_reallocation; int running; } server_decl_t; #undef SINGLE_ACCEPT ci_thread_mutex_t threads_list_mtx; server_decl_t **threads_list = NULL; ci_thread_t listener_thread_id = -1; int listener_running = 0; ci_thread_cond_t free_server_cond; ci_thread_mutex_t counters_mtx; struct childs_queue *childs_queue = NULL; struct childs_queue *old_childs_queue = NULL; child_shared_data_t *child_data = NULL; struct connections_queue *con_queue; process_pid_t MY_PROC_PID = 0; /*Child shutdown timeout is 10 seconds:*/ const int CHILD_SHUTDOWN_TIMEOUT = 10; int CHILD_HALT = 0; /*Interprocess accepting mutex ....*/ ci_proc_mutex_t accept_mutex; /*Main proccess variables*/ ci_socket LISTEN_SOCKET = -1; int c_icap_going_to_term = 0; int c_icap_reconfigure = 0; #define hard_close_connection(connection) ci_hard_close(connection->fd) #define close_connection(connection) ci_linger_close(connection->fd,MAX_SECS_TO_LINGER) void init_commands(); int init_server(char *address, int port, int *family); int start_child(int fd); void system_shutdown(); /***************************************************************************************/ /*Signals managment functions */ static void term_handler_child(int sig) { if (!child_data) return; /*going down?*/ if (!child_data->father_said) child_data->to_be_killed = IMMEDIATELY; else child_data->to_be_killed = child_data->father_said; } static void sigpipe_handler(int sig) { } static void empty(int sig) { } static void sigint_handler_main(int sig) { if (sig == SIGTERM) { } else if (sig == SIGINT) { } else { } c_icap_going_to_term = 1; } static void sigchld_handler_main(int sig) { /*Do nothing the signal will be ignored..... */ } static void sighup_handler_main() { c_icap_reconfigure = 1; } void child_signals() { signal(SIGPIPE, sigpipe_handler); signal(SIGINT, SIG_IGN); signal(SIGTERM, term_handler_child); signal(SIGHUP, empty); /*Maybe the SIGCHLD must not ignored but better a signal handler must be developed with an interface for use from modules */ /* signal(SIGCHLD,SIG_IGN);*/ } void main_signals() { signal(SIGPIPE, sigpipe_handler); signal(SIGTERM, sigint_handler_main); signal(SIGINT, sigint_handler_main); signal(SIGCHLD, sigchld_handler_main); signal(SIGHUP, sighup_handler_main); } void thread_signals(int islistener) { sigset_t sig_mask; sigemptyset(&sig_mask); sigaddset(&sig_mask, SIGINT); if (!islistener) sigaddset(&sig_mask, SIGHUP); if (pthread_sigmask(SIG_BLOCK, &sig_mask, NULL)) ci_debug_printf(5, "O an error....\n"); pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); } /*****************************************************************************/ /*Functions for handling operations for events */ static void exit_normaly() { system_shutdown(); #ifdef MULTICHILD child_data = NULL; dettach_childs_queue(childs_queue); #endif } static void release_thread_i(int i) { if (threads_list[i]->current_req) { ci_request_destroy(threads_list[i]->current_req); } free(threads_list[i]); threads_list[i] = NULL; } static void cancel_all_threads() { int i = 0; int wait_listener_time = 10000; int wait_for_workers = CHILD_SHUTDOWN_TIMEOUT>5?CHILD_SHUTDOWN_TIMEOUT:5; int servers_running; /*Cancel listener thread .... */ /*we are going to wait maximum about 10 ms */ while (wait_listener_time > 0 && listener_running != 0) { /*Interrupt listener if it is waiting for threads or waiting to accept new connections */ #ifdef SINGLE_ACCEPT pthread_cancel(listener_thread_id); /*..... */ #else pthread_kill(listener_thread_id, SIGHUP); #endif ci_thread_cond_signal(&free_server_cond); ci_usleep(1000); wait_listener_time -= 10; } if (listener_running == 0) { ci_debug_printf(5, "Going to wait for the listener thread (pid: %d) to exit!\n", threads_list[0]->srv_id); ci_thread_join(listener_thread_id); ci_debug_printf(5, "OK, cancelling the listener thread (pid: %d)!\n", threads_list[0]->srv_id); } else { /*fuck the listener! going down ..... */ } /*We are going to interupt the waiting for queue childs. We are going to wait threads which serve a request. */ ci_thread_cond_broadcast(&(con_queue->queue_cond)); /*wait for a milisecond*/ ci_usleep(1000); servers_running = CI_CONF.THREADS_PER_CHILD; while (servers_running && wait_for_workers >= 0) { /*child_data->to_be_killed, may change while we are inside this loop*/ if (child_data->to_be_killed == IMMEDIATELY) { CHILD_HALT = 1; } for (i=0; irunning) { /*if the i thread is not running any more*/ ci_debug_printf(5, "Cancel server %d, thread_id %lu (%d)\n", threads_list[i]->srv_id, threads_list[i]->srv_pthread, i); ci_thread_join(threads_list[i]->srv_pthread); release_thread_i(i); servers_running --; } else if (child_data->to_be_killed == IMMEDIATELY){ /*The thread is still running, and we have a timeout for waiting the thread to exit. */ if (wait_for_workers <= 2) { ci_debug_printf(5, "Thread %ld still running near the timeout. Try to kill it\n", threads_list[i]->srv_pthread); pthread_kill( threads_list[i]->srv_pthread, SIGTERM); } } }/*the i thread is still alive*/ } /* for(i=0;i< CI_CONF.THREADS_PER_CHILD;i++)*/ /*wait for 1 second for the next round*/ ci_usleep(999999); /* The child_data->to_be_killed may change while we are running this function. In the case it has/got the value IMMEDIATELY decrease wait_for_workers: */ if (child_data->to_be_killed == IMMEDIATELY) wait_for_workers --; } /* while(servers_running)*/ if (servers_running) { ci_debug_printf(5, "Not all the servers canceled. Anyway exiting....\n"); } else { ci_debug_printf(5, "All servers canceled\n"); free(threads_list); } } static void send_term_to_childs(struct childs_queue *q) { int i, pid; for (i = 0; i < q->size; i++) { if ((pid = q->childs[i].pid) == 0) continue; if (q->childs[i].to_be_killed != IMMEDIATELY) { /*Child did not informed yet*/ q->childs[i].father_said = IMMEDIATELY; kill(pid, SIGTERM); } } } static void wait_childs_to_exit(struct childs_queue *q) { int i, status, pid; for (i = 0; i < q->size; i++) { if (q->childs[i].pid == 0) continue; ci_debug_printf(5, "Wait for child with pid:%d\n", q->childs[i].pid); if (q->childs[i].to_be_killed != IMMEDIATELY) { ci_debug_printf(5, "Child %d not signaled yet!\n", q->childs[i].pid); continue; } do { errno = 0; pid = waitpid(q->childs[i].pid, &status, WNOHANG); } while (pid < 0 && errno == EINTR); if (pid > 0) { remove_child(q, pid, 0); ci_debug_printf(5, "Child %d died with status %d\n", pid, status); } } } static void kill_all_childs() { int childs_running; ci_debug_printf(5, "Going to term children....\n"); childs_running = 0; do { send_term_to_childs(childs_queue); if (old_childs_queue) send_term_to_childs(old_childs_queue); /*wait for 30 milisecond for childs to take care*/ ci_usleep(30000); wait_childs_to_exit(childs_queue); childs_running = !childs_queue_is_empty(childs_queue); if (old_childs_queue) { wait_childs_to_exit(old_childs_queue); childs_running += !childs_queue_is_empty(old_childs_queue); } } while(childs_running); ci_proc_mutex_destroy(&accept_mutex); destroy_childs_queue(childs_queue); childs_queue = NULL; if (old_childs_queue) destroy_childs_queue(old_childs_queue); old_childs_queue = NULL; } static void check_for_exited_childs() { int status, pid, ret, exit_status; exit_status = 0; while ((pid = waitpid(-1, &status, WNOHANG)) > 0) { ci_debug_printf(5, "Child %d died ...\n", pid); if (!WIFEXITED(status)) { ci_debug_printf(1, "Child %d did not exit normally.", pid); exit_status = 1; if (WIFSIGNALED(status)) ci_debug_printf(1, "signaled with signal:%d\n", WTERMSIG(status)); } ret = remove_child(childs_queue, pid, exit_status); if (ret == 0 && old_childs_queue) { ci_debug_printf(5, "Child %d will be removed from the old list ...\n", pid); remove_child(old_childs_queue, pid, exit_status); if (childs_queue_is_empty(old_childs_queue)) { ret = destroy_childs_queue(old_childs_queue); /* if(!ret){} */ old_childs_queue = NULL; } } } if (pid < 0) ci_debug_printf(1, "Fatal error waiting for a child to exit .....\n"); } int system_reconfigure(); static int server_reconfigure() { int i; if (old_childs_queue) { ci_debug_printf(1, "A reconfigure pending. Ignoring reconfigure request.....\n"); return 1; } /*shutdown all modules and services and reopen config file */ if (!system_reconfigure()) return 0; /*initialize commands table for server */ init_commands(); /* Mark all existing childs as to_be_killed gracefully (childs_queue.childs[child_indx].to_be_killed = GRACEFULLY) */ for (i = 0; i < childs_queue->size; i++) { if (childs_queue->childs[i].pid != 0) { childs_queue->childs[i].father_said = GRACEFULLY; kill(childs_queue->childs[i].pid, SIGTERM); } } /* Create new shared mem for childs queue */ old_childs_queue = childs_queue; childs_queue = malloc(sizeof(struct childs_queue)); if (!create_childs_queue(childs_queue, 2 * CI_CONF.MAX_SERVERS)) { ci_debug_printf(1, "Cannot init shared memory. Fatal error, exiting!\n"); return 0; /*It is not enough. We must wait all childs to exit ..... */ } /* Start new childs to handle new requests. */ if (CI_CONF.START_SERVERS > CI_CONF.MAX_SERVERS) CI_CONF.START_SERVERS = CI_CONF.MAX_SERVERS; for (i = 0; i < CI_CONF.START_SERVERS; i++) { start_child(LISTEN_SOCKET); } /* When all childs exits release the old shared mem block.... */ return 1; } /*************************************************************************************/ /*Functions for handling commands */ /* I must develop an api for pipes (named and anonymous) under the os/unix and os/win32 directories */ int ci_named_pipe_create(char *name) { int status, pipe; errno = 0; status = mkfifo(name, S_IRUSR | S_IWUSR | S_IWGRP); if (status < 0 && errno != EEXIST) return -1; pipe = open(name, O_RDONLY | O_NONBLOCK); return pipe; } int ci_named_pipe_open(char *name) { int pipe; pipe = open(name, O_RDONLY | O_NONBLOCK); return pipe; } void ci_named_pipe_close(int pipe_fd) { close(pipe_fd); } int wait_for_commands(int ctl_fd, char *command_buffer, int secs) { fd_set fds; struct timeval tv; int ret = 0; if (secs >= 0) { tv.tv_sec = secs; tv.tv_usec = 0; } FD_ZERO(&fds); FD_SET(ctl_fd, &fds); errno = 0; if ((ret = select(ctl_fd + 1, &fds, NULL, NULL, (secs >= 0 ? &tv : NULL))) > 0) { if (FD_ISSET(ctl_fd, &fds)) { ret = ci_read_nonblock(ctl_fd, command_buffer, COMMANDS_BUFFER_SIZE - 1); if (ret > 0) { command_buffer[ret] = '\0'; return ret; } if (ret == 0 ) { /*read return 0, This is an eof, we must return -1 to force socket reopening!*/ return -1; } } } if (ret < 0 && errno != EINTR) { ci_debug_printf(1, "Unexpected error waiting for or reading events in control socket!\n"); /*returning -1 we are causing reopening control socket! */ return -1; } return 0; /*expired */ } void handle_monitor_process_commands(char *cmd_line) { ci_command_t *command; int i, bytes; if ((command = find_command(cmd_line)) != NULL) { if (command->type & MONITOR_PROC_CMD) execute_command(command, cmd_line, MONITOR_PROC_CMD); if (command->type & CHILDS_PROC_CMD) { for (i = 0; i < childs_queue->size; i++) { bytes = write(childs_queue->childs[i].pipe, cmd_line, strlen(cmd_line)); } } if (command->type & MONITOR_PROC_POST_CMD) execute_command(command, cmd_line, MONITOR_PROC_POST_CMD); } } void handle_child_process_commands(char *cmd_line) { ci_command_t *command; if ((command = find_command(cmd_line)) != NULL) { if (command->type & CHILDS_PROC_CMD) execute_command(command, cmd_line, CHILDS_PROC_CMD); } } /*************************************************************************************/ /*Children functions */ server_decl_t *newthread(struct connections_queue *con_queue) { server_decl_t *serv; serv = (server_decl_t *) malloc(sizeof(server_decl_t)); serv->srv_id = 0; serv->con_queue = con_queue; serv->served_requests = 0; serv->served_requests_no_reallocation = 0; serv->current_req = NULL; serv->running = 1; return serv; } int thread_main(server_decl_t * srv) { ci_connection_t con; char clientname[CI_MAXHOSTNAMELEN + 1]; int ret, request_status = CI_NO_STATUS; int keepalive_reqs; //*********************** thread_signals(0); //************************* srv->srv_id = getpid(); //Setting my pid ... for (;;) { /* If we must shutdown IMEDIATELLY it is time to leave the server else if we are going to shutdown GRACEFULLY we are going to die only if there are not any accepted connections */ if (child_data->to_be_killed == IMMEDIATELY) { srv->running = 0; return 1; } if ((ret = get_from_queue(con_queue, &con)) == 0) { if (child_data->to_be_killed) { srv->running = 0; return 1; } ret = wait_for_queue(con_queue); continue; } if (ret < 0) { //An error has occured ci_debug_printf(1, "Fatal Error!!! Error getting a connection from connections queue!!!\n"); break; } ci_thread_mutex_lock(&counters_mtx); /*Update counters as soon as possible */ (child_data->freeservers)--; (child_data->usedservers)++; ci_thread_mutex_unlock(&counters_mtx); ci_netio_init(con.fd); ret = 1; if (srv->current_req == NULL) srv->current_req = newrequest(&con); else ret = recycle_request(srv->current_req, &con); if (srv->current_req == NULL || ret == 0) { ci_sockaddr_t_to_host(&(con.claddr), clientname, CI_MAXHOSTNAMELEN); ci_debug_printf(1, "Request from %s denied...\n", clientname); hard_close_connection((&con)); goto end_of_main_loop_thread; /*The request rejected. Log an error and continue ... */ } keepalive_reqs = 0; do { if (MAX_KEEPALIVE_REQUESTS > 0 && keepalive_reqs >= MAX_KEEPALIVE_REQUESTS) srv->current_req->keepalive = 0; /*do not keep alive connection */ if (child_data->to_be_killed) /*We are going to die do not keep-alive */ srv->current_req->keepalive = 0; if ((request_status = process_request(srv->current_req)) == CI_NO_STATUS) { ci_debug_printf(5, "Process request timeout or interrupted....\n"); ci_request_reset(srv->current_req); break; } srv->served_requests++; srv->served_requests_no_reallocation++; keepalive_reqs++; /*Increase served requests. I dont like this. The delay is small but I don't like... */ ci_thread_mutex_lock(&counters_mtx); (child_data->requests)++; ci_thread_mutex_unlock(&counters_mtx); log_access(srv->current_req, request_status); // break; //No keep-alive ...... if (child_data->to_be_killed == IMMEDIATELY) break; //Just exiting the keep-alive loop /*if we are going to term gracefully we will try to keep our promice for keepalived request.... */ if (child_data->to_be_killed == GRACEFULLY && srv->current_req->keepalive == 0) break; ci_debug_printf(8, "Keep-alive:%d\n", srv->current_req->keepalive); if (srv->current_req->keepalive && keepalive_request(srv->current_req)) { ci_debug_printf(8, "Server %d going to serve new request from client (keep-alive) \n", srv->srv_id); } else break; } while (1); if (srv->current_req) { if (request_status != CI_OK || child_data->to_be_killed) { hard_close_connection(srv->current_req->connection); } else { close_connection(srv->current_req->connection); } } if (srv->served_requests_no_reallocation > MAX_REQUESTS_BEFORE_REALLOCATE_MEM) { ci_debug_printf(5, "Max requests reached, reallocate memory and buffers .....\n"); ci_request_destroy(srv->current_req); srv->current_req = NULL; srv->served_requests_no_reallocation = 0; } end_of_main_loop_thread: ci_thread_mutex_lock(&counters_mtx); (child_data->freeservers)++; (child_data->usedservers)--; ci_thread_mutex_unlock(&counters_mtx); ci_thread_cond_signal(&free_server_cond); } srv->running = 0; return 0; } void listener_thread(int *fd) { ci_connection_t conn; socklen_t claddrlen = sizeof(struct sockaddr_in); int haschild = 1, jobs_in_queue = 0; int pid, sockfd; sockfd = *fd; thread_signals(1); /*Wait main process to signal us to start accepting requests*/ ci_thread_mutex_lock(&counters_mtx); listener_running = 1; ci_thread_cond_wait(&free_server_cond, &counters_mtx); ci_thread_mutex_unlock(&counters_mtx); pid = getpid(); for (;;) { //Global for if (child_data->to_be_killed) { ci_debug_printf(5, "Listener of pid:%d exiting!\n", pid); goto LISTENER_FAILS_UNLOCKED; } if (!ci_proc_mutex_lock(&accept_mutex)) { if (errno == EINTR) { ci_debug_printf(5, "proc_mutex_lock interrupted (EINTR received, pid=%d)!\n", pid); /*Try again to take the lock */ continue; } else { ci_debug_printf(1, "Unknown errno %d in proc_mutex_lock of pid %d. Exiting!\n", errno, pid); goto LISTENER_FAILS_UNLOCKED; } } child_data->idle = 0; ci_debug_printf(7, "Child %d getting requests now ...\n", pid); do { //Getting requests while we have free servers..... #ifndef SINGLE_ACCEPT fd_set fds; int ret; do { FD_ZERO(&fds); FD_SET(sockfd, &fds); errno = 0; ret = select(sockfd + 1, &fds, NULL, NULL, NULL); if (ret < 0) { if (errno != EINTR) { ci_debug_printf(1, "Error in select %d! Exiting server!\n", errno); goto LISTENER_FAILS; } if (child_data->to_be_killed) { ci_debug_printf(5, "Listener server signalled to exit!\n"); goto LISTENER_FAILS; } } } while (errno == EINTR); #endif do { errno = 0; claddrlen = sizeof(conn.claddr.sockaddr); if (((conn.fd = accept(sockfd, (struct sockaddr *) &(conn.claddr.sockaddr), &claddrlen)) == -1)) { if (errno != EINTR && errno != ECONNABORTED) { ci_debug_printf(1, "Error accept %d!\nExiting server!\n", errno); goto LISTENER_FAILS; } /*Here we are going to exit only if accept interrupted by a signal else if we accepted an fd we must add it to queue for processing. */ if (errno == EINTR && child_data->to_be_killed) { ci_debug_printf(5, "Listener server signalled to exit!\n"); goto LISTENER_FAILS; } else { ci_debug_printf(2, "Accept failed: errno=%d, ingore!\n", errno); } } } while (errno == EINTR && !child_data->to_be_killed); // Probably ECONNABORTED or similar error if (conn.fd < 0) continue; claddrlen = sizeof(conn.srvaddr.sockaddr); getsockname(conn.fd, (struct sockaddr *) &(conn.srvaddr.sockaddr), &claddrlen); ci_fill_sockaddr(&conn.claddr); ci_fill_sockaddr(&conn.srvaddr); icap_socket_opts(sockfd, MAX_SECS_TO_LINGER); if ((jobs_in_queue = put_to_queue(con_queue, &conn)) == 0) { ci_debug_printf(1, "ERROR!!!!!! NO AVAILABLE SERVERS! THIS IS A BUG!!!!!!!!\n"); ci_debug_printf(1, "Jobs in Queue: %d, Free servers: %d, Used Servers: %d, Requests: %d\n", jobs_in_queue, child_data->freeservers, child_data->usedservers, child_data->requests); goto LISTENER_FAILS; } (child_data->connections)++; //NUM of Requests.... if (child_data->to_be_killed) { ci_debug_printf(5, "Listener server must exit!\n"); goto LISTENER_FAILS; } ci_thread_mutex_lock(&counters_mtx); haschild = ((child_data->freeservers - jobs_in_queue) > 0 ? 1 : 0); ci_thread_mutex_unlock(&counters_mtx); } while (haschild); ci_debug_printf(7, "Child %d STOPS getting requests now ...\n", pid); child_data->idle = 1; while (!ci_proc_mutex_unlock(&accept_mutex)) { if (errno != EINTR) { ci_debug_printf(1, "Error:%d while trying to unlock proc_mutex, exiting listener of server:%d\n", errno, pid); goto LISTENER_FAILS_UNLOCKED; } ci_debug_printf(5, "Mutex lock interrupted while trying to unlock proc_mutex, pid: %d\n", pid); } ci_thread_mutex_lock(&counters_mtx); if ((child_data->freeservers - connections_pending(con_queue)) <= 0) { ci_debug_printf(7, "Child %d waiting for a thread to accept more connections ...\n", pid); ci_thread_cond_wait(&free_server_cond, &counters_mtx); } ci_thread_mutex_unlock(&counters_mtx); } LISTENER_FAILS_UNLOCKED: listener_running = 0; return; LISTENER_FAILS: listener_running = 0; errno = 0; while (!ci_proc_mutex_unlock(&accept_mutex)) { if (errno != EINTR) { ci_debug_printf(1, "Error:%d while trying to unlock proc_mutex of server:%d\n", errno, pid); break; } ci_debug_printf(7, "Mutex lock interrupted while trying to unlock proc_mutex before terminating\n"); } return; } void child_main(int sockfd, int pipefd) { ci_thread_t thread; int i, ret; signal(SIGTERM, SIG_IGN); /*Ignore parent requests to kill us untill we are up and running */ ci_thread_mutex_init(&threads_list_mtx); ci_thread_mutex_init(&counters_mtx); ci_thread_cond_init(&free_server_cond); ci_stat_attach_mem(child_data->stats, child_data->stats_size, NULL); threads_list = (server_decl_t **) malloc((CI_CONF.THREADS_PER_CHILD + 1) * sizeof(server_decl_t *)); con_queue = init_queue(CI_CONF.THREADS_PER_CHILD); for (i = 0; i < CI_CONF.THREADS_PER_CHILD; i++) { if ((threads_list[i] = newthread(con_queue)) == NULL) { exit(-1); // FATAL error..... } ret = ci_thread_create(&thread, (void *(*)(void *)) thread_main, (void *) threads_list[i]); threads_list[i]->srv_pthread = thread; } threads_list[CI_CONF.THREADS_PER_CHILD] = NULL; /*Now start the listener thread.... */ ret = ci_thread_create(&thread, (void *(*)(void *)) listener_thread, (void *) &sockfd); listener_thread_id = thread; /*set srand for child......*/ srand(((unsigned int)time(NULL)) + (unsigned int)getpid()); /*I suppose that all my threads are up now. We can setup our signal handlers */ child_signals(); /* A signal from parent may comes while we are starting. Listener will not accept any request in this case, (it checks on the beggining of the accept loop for parent commands) so we can shutdown imediatelly even if the parent said gracefuly.*/ if (child_data->father_said) child_data->to_be_killed = IMMEDIATELY; /*start child commands may have non thread safe code but the worker threads does not serving requests yet.*/ commands_execute_start_child(); /*Signal listener to start accepting requests.*/ int doStart = 0; do { ci_thread_mutex_lock(&counters_mtx); doStart = listener_running; ci_thread_mutex_unlock(&counters_mtx); if (!doStart) ci_usleep(5); } while(!doStart); ci_thread_cond_signal(&free_server_cond); while (!child_data->to_be_killed) { char buf[512]; int bytes; if ((ret = ci_wait_for_data(pipefd, 1, wait_for_read)) > 0) { /*data input */ bytes = ci_read_nonblock(pipefd, buf, 511); if (bytes == 0) { ci_debug_printf(1, "Parent closed the pipe connection! Going to term immediately!\n"); child_data->to_be_killed = IMMEDIATELY; } else { buf[bytes] = '\0'; handle_child_process_commands(buf); } } else if (ret < 0) { ci_debug_printf(1, "An error occured while waiting for commands from parent. Terminating!\n"); child_data->to_be_killed = IMMEDIATELY; } if (!listener_running && !child_data->to_be_killed) { ci_debug_printf(1, "Ohh!! something happened to listener thread! Terminating\n"); child_data->to_be_killed = GRACEFULLY; } commands_exec_scheduled(); } ci_debug_printf(5, "Child :%d going down :%s\n", getpid(), child_data->to_be_killed == IMMEDIATELY? "IMMEDIATELY" : "GRACEFULLY"); cancel_all_threads(); commands_execute_stop_child(); exit_normaly(); } /*****************************************************************************************/ /*Main process functions */ int start_child(int fd) { int pid; int pfd[2]; int children_num, free_servers, used_servers, max_requests; if (pipe(pfd) < 0) { ci_debug_printf(1, "Error creating pipe for communication with child\n"); return -1; } if (fcntl(pfd[0], F_SETFL, O_NONBLOCK) < 0 || fcntl(pfd[1], F_SETFL, O_NONBLOCK) < 0) { ci_debug_printf(1, "Error making the child pipe non-blocking\n"); close(pfd[0]); close(pfd[1]); } if ((pid = fork()) == 0) { //A Child ....... MY_PROC_PID = getpid(); if (!attach_childs_queue(childs_queue)) { ci_debug_printf(1, "Can not access shared memory for %d child\n", (int)MY_PROC_PID); exit(-2); } child_data = register_child(childs_queue, getpid(), CI_CONF.THREADS_PER_CHILD, pfd[1]); if (!child_data) { childs_queue_stats(childs_queue, &children_num, &free_servers, &used_servers, &max_requests); ci_debug_printf(1, "Not available slot in shared memory for %d child (Number of slots: %d, Running children: %d, Free servers: %d, Used servers: %d)!\n", (int)MY_PROC_PID, childs_queue->size, children_num, free_servers, used_servers ); exit(-3); } close(pfd[1]); child_main(fd, pfd[0]); exit(0); } else { close(pfd[0]); announce_child(childs_queue, pid); return pid; } } void stop_command(const char *name, int type, const char **argv) { c_icap_going_to_term = 1; } void reconfigure_command(const char *name, int type, const char **argv) { if (type == MONITOR_PROC_CMD) c_icap_reconfigure = 1; //server_reconfigure(); } void dump_statistics_command(const char *name, int type, const char **argv) { if (type == MONITOR_PROC_CMD) dump_queue_statistics(childs_queue); } void test_command(const char *name, int type, const char **argv) { int i = 0; ci_debug_printf(1, "Test command for %s. Arguments:", (type == MONITOR_PROC_CMD ? "monitor process" : "child process")); while (argv[i] != NULL) { ci_debug_printf(1, "%s,", argv[i]); i++; } ci_debug_printf(1, "\n"); } int init_server(char *address, int port, int *family) { if (LISTEN_SOCKET != -1) close(LISTEN_SOCKET); LISTEN_SOCKET = icap_init_server(address, port, family, MAX_SECS_TO_LINGER); if (LISTEN_SOCKET == CI_SOCKET_ERROR) return 0; return 1; } void init_commands() { register_command("stop", MONITOR_PROC_CMD, stop_command); register_command("reconfigure", MONITOR_PROC_CMD, reconfigure_command); register_command("dump_statistics", MONITOR_PROC_CMD, dump_statistics_command); register_command("test", MONITOR_PROC_CMD | CHILDS_PROC_CMD, test_command); } int start_server() { int child_indx, pid, i, ctl_socket; int childs, freeservers, used, maxrequests, ret; char command_buffer[COMMANDS_BUFFER_SIZE]; int user_informed = 0; ctl_socket = ci_named_pipe_create(CI_CONF.COMMANDS_SOCKET); if (ctl_socket < 0) { ci_debug_printf(1, "Error opening control socket %s: %s. Fatal error, exiting!\n", strerror(errno), CI_CONF.COMMANDS_SOCKET); exit(0); } if (!ci_proc_mutex_init(&accept_mutex, "accept")) { ci_debug_printf(1, "Can't init mutex for accepting conenctions. Fatal error, exiting!\n"); exit(0); } childs_queue = malloc(sizeof(struct childs_queue)); if (!create_childs_queue(childs_queue, 2 * CI_CONF.MAX_SERVERS)) { ci_proc_mutex_destroy(&accept_mutex); ci_debug_printf(1, "Can't init shared memory. Fatal error, exiting!\n"); exit(0); } init_commands(); pid = 1; #ifdef MULTICHILD if (CI_CONF.START_SERVERS > CI_CONF.MAX_SERVERS) CI_CONF.START_SERVERS = CI_CONF.MAX_SERVERS; for (i = 0; i < CI_CONF.START_SERVERS; i++) { if (pid) pid = start_child(LISTEN_SOCKET); } if (pid != 0) { main_signals(); while (1) { if ((ret = wait_for_commands(ctl_socket, command_buffer, 1)) > 0) { ci_debug_printf(5, "I received the command: %s\n", command_buffer); handle_monitor_process_commands(command_buffer); } if (ret < 0) { /*Eof received on pipe. Going to reopen ... */ ci_named_pipe_close(ctl_socket); ctl_socket = ci_named_pipe_open(CI_CONF.COMMANDS_SOCKET); if (ctl_socket < 0) { ci_debug_printf(1, "Error opening control socket. We are unstable and going down!"); c_icap_going_to_term = 1; } } if (c_icap_going_to_term) break; childs_queue_stats(childs_queue, &childs, &freeservers, &used, &maxrequests); ci_debug_printf(10, "Server stats: \n\t Children: %d\n\t Free servers: %d\n" "\tUsed servers:%d\n\tRequests served:%d\n", childs, freeservers, used, maxrequests); if (MAX_REQUESTS_PER_CHILD > 0 && (child_indx = find_a_child_nrequests (childs_queue, MAX_REQUESTS_PER_CHILD)) >= 0) { ci_debug_printf(8, "Max requests reached for child :%d of pid :%d\n", child_indx, childs_queue->childs[child_indx].pid); pid = start_child(LISTEN_SOCKET); // usleep(500); childs_queue->childs[child_indx].father_said = GRACEFULLY; /*kill a server ... */ kill(childs_queue->childs[child_indx].pid, SIGTERM); } else if ((freeservers <= CI_CONF.MIN_SPARE_THREADS && childs < CI_CONF.MAX_SERVERS) || childs < CI_CONF.START_SERVERS) { ci_debug_printf(8, "Free Servers: %d, children: %d. Going to start a child .....\n", freeservers, childs); pid = start_child(LISTEN_SOCKET); } else if (freeservers >= CI_CONF.MAX_SPARE_THREADS && childs > CI_CONF.START_SERVERS && (freeservers - CI_CONF.THREADS_PER_CHILD) > CI_CONF.MIN_SPARE_THREADS) { if ((child_indx = find_an_idle_child(childs_queue)) >= 0) { childs_queue->childs[child_indx].father_said = GRACEFULLY; ci_debug_printf(8, "Free Servers: %d, children: %d. Going to stop child %d(index: %d)\n", freeservers, childs, childs_queue->childs[child_indx].pid, child_indx); /*kill a server ... */ kill(childs_queue->childs[child_indx].pid, SIGTERM); user_informed = 0; } } else if (childs == CI_CONF.MAX_SERVERS && freeservers < CI_CONF.MIN_SPARE_THREADS) { if(! user_informed) { ci_debug_printf(1, "ATTENTION!!!! Not enough available servers (children %d, free servers %d, used servers %d)!!!!! " "Maybe you should increase the MaxServers and the " "ThreadsPerChild values in c-icap.conf file!!!!!!!!!",childs , freeservers, used); user_informed = 1; } } if (c_icap_going_to_term) break; check_for_exited_childs(); if (c_icap_reconfigure) { c_icap_reconfigure = 0; if (!server_reconfigure()) { ci_debug_printf(1, "Error while reconfiguring, exiting!\n"); break; } } } /*Main process exit point */ ci_debug_printf(1, "Possibly a term signal received. Monitor process going to term all children\n"); kill_all_childs(); system_shutdown(); ci_debug_printf(1, "Exiting....\n"); return 1; } #else child_data = (child_shared_data_t *) malloc(sizeof(child_shared_data_t)); child_data->pid = 0; child_data->freeservers = CI_CONF.THREADS_PER_CHILD; child_data->usedservers = 0; child_data->requests = 0; child_data->connections = 0; child_data->to_be_killed = 0; child_data->father_said = 0; child_data->idle = 1; child_data->stats_size = ci_stat_memblock_size(); child_data->stats = malloc(child_data->stats_size); child_data->stats->sig = MEMBLOCK_SIG; ci_stat_attach_mem(child_data->stats, child_data->stats_size, NULL); child_main(LISTEN_SOCKET, 0); ci_proc_mutex_destroy(&accept_mutex); destroy_childs_queue(childs_queue); #endif return 1; } c_icap-0.4.2/depcomp0000755000175000017500000005601612601747525011252 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2013 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, see . # 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 . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} 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 # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # 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 cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc 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. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## 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). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - 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 -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # 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. ## 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. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -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 -ne 0; then 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 ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # 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 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, 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. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; 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. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # 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 ;; #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 preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--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 test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | 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 $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | 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 preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--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 -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [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 preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # 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 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: c_icap-0.4.2/array.c0000664000175000017500000005264512567550776011200 00000000000000/* * Copyright (C) 2011 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include "debug.h" #include "mem.h" #include "array.h" #include #define array_item_size(type) ( (size_t)&((type *)0)[1]) ci_array_t * ci_array_new(size_t size) { ci_array_t *array; ci_mem_allocator_t *packer; void *buffer; buffer = ci_buffer_alloc(size); if (!buffer) return NULL; packer = ci_create_pack_allocator_on_memblock(buffer, size); if (!packer) { ci_buffer_free(buffer); return NULL; } array = ci_pack_allocator_alloc(packer, sizeof(ci_array_t)); if (!array) { ci_buffer_free(buffer); ci_mem_allocator_destroy(packer); return NULL; } array->max_size = size; array->count = 0; array->items = NULL; array->mem = buffer; array->alloc = packer; return array; } ci_array_t * ci_array_new2(size_t items, size_t item_size) { size_t array_size; array_size = ci_pack_allocator_required_size() + _CI_ALIGN(sizeof(ci_array_t)) + items * (_CI_ALIGN(item_size) + _CI_ALIGN(sizeof(ci_array_item_t))); return ci_array_new(array_size); } void ci_array_destroy(ci_array_t *array) { void *buffer = array->mem; assert(buffer); if (array->alloc) ci_mem_allocator_destroy(array->alloc); ci_buffer_free(buffer); } const ci_array_item_t * ci_array_add(ci_array_t *array, const char *name, const void *value, size_t size) { ci_array_item_t *item; ci_mem_allocator_t *packer = array->alloc; assert(packer); item = ci_pack_allocator_alloc_unaligned(packer, array_item_size(ci_array_item_t)); if (item) { item->name = ci_pack_allocator_alloc_from_rear(packer, strlen(name) + 1); item->value = ci_pack_allocator_alloc_from_rear(packer, size); } if (!item || !item->name || !item->value) { ci_debug_printf(2, "Not enough space to add the new item to array!\n"); return NULL; } strcpy(item->name, name); memcpy(item->value, value, size); /*The array->items should point to the first item...*/ if (array->items == NULL) array->items = item; array->count++; return item; } const void * ci_array_search(ci_array_t *array, const char *name) { int i; for (i=0; i < array->count; i++) { if (strcmp(array->items[i].name, name) == 0) { return array->items[i].value; } } return NULL; } void ci_array_iterate(const ci_array_t *array, void *data, int (*fn)(void *data, const char *name, const void *)) { int i, ret = 0; for (i=0; i < array->count && ret == 0; i++) { ret = (*fn)(data, array->items[i].name, array->items[i].value); } } #define MIN_P(p1, p2) ((void *)p1 < (void *)p2 ? (void *)p1 : (void *)p2) const ci_array_item_t *ci_array_pop(ci_array_t *array) { ci_array_item_t *item; if (array->count == 0) return NULL; /*Delete the last element*/ item = &array->items[array->count-1]; ci_pack_allocator_set_start_pos(array->alloc, item); /*Delete the content of the last element*/ array->count--; if (array->count == 0) ci_pack_allocator_set_end_pos(array->alloc, NULL); else ci_pack_allocator_set_end_pos(array->alloc, MIN_P(array->items[array->count-1].name, array->items[array->count-1].value) ); return item; } const ci_array_item_t *ci_array_get_item(ci_array_t *array, int pos) { if (pos >= array->count) return NULL; return &(array->items[pos]); } ci_ptr_array_t * ci_ptr_array_new2(size_t items) { size_t array_size; array_size = ci_pack_allocator_required_size() + _CI_ALIGN(sizeof(ci_ptr_array_t)) + items * (_CI_ALIGN(sizeof(void *)) + _CI_ALIGN(sizeof(ci_array_item_t))); return ci_ptr_array_new(array_size); } void * ci_ptr_array_search(ci_ptr_array_t *array, const char *name) { return (void *)ci_array_search(array, name); } const ci_array_item_t * ci_ptr_array_add(ci_ptr_array_t *ptr_array, const char *name, void *value) { ci_array_item_t *item; ci_mem_allocator_t *packer = ptr_array->alloc; assert(packer); item = ci_pack_allocator_alloc_unaligned(packer, array_item_size(ci_array_item_t)); if (item) item->name = ci_pack_allocator_alloc_from_rear(packer, strlen(name) + 1); if (!item || !item->name) { ci_debug_printf(2, "Not enough space to add the new item to array!\n"); return NULL; } strcpy(item->name, name); item->value = value; /*The array->items should point to the first item...*/ if (ptr_array->items == NULL) ptr_array->items = item; ptr_array->count++; return item; } const ci_array_item_t *ci_ptr_array_pop(ci_ptr_array_t *ptr_array) { ci_array_item_t *item; if (ptr_array->count == 0) return NULL; item = &ptr_array->items[ptr_array->count-1]; ci_pack_allocator_set_start_pos(ptr_array->alloc, item); ptr_array->count--; return item; } void * ci_ptr_array_pop_value(ci_ptr_array_t *ptr_array, char *name, size_t name_size) { const ci_array_item_t *item = ci_ptr_array_pop(ptr_array); if (!item) return NULL; strncpy(name, item->name, name_size); name[name_size-1] = '\0'; return item->value; } /**************************************************************************/ ci_dyn_array_t * ci_dyn_array_new(size_t size) { /*use 25% of memory for index.*/ size_t index_memory = size / 4; size_t items_memory = size - index_memory; size_t items_count = index_memory / sizeof(ci_array_item_t *); size_t item_size = items_memory / items_count; if (item_size < sizeof(ci_array_item_t)) item_size = sizeof(ci_array_item_t); return ci_dyn_array_new2(items_count, item_size); } ci_dyn_array_t * ci_dyn_array_new2(size_t items, size_t item_size) { ci_dyn_array_t *array; ci_mem_allocator_t *packer; size_t array_size; /* Items of size = item_size + sizeof(ci_array_item)+sizeof(name) for sizeof(name) assume a size of 16 bytes. We can not be accurate here.... */ array_size = _CI_ALIGN(sizeof(ci_dyn_array_t)) + items * (_CI_ALIGN(item_size) + _CI_ALIGN(sizeof(ci_array_item_t)) + _CI_ALIGN(16)); packer = ci_create_serial_allocator(array_size); if (!packer) { return NULL; } array = packer->alloc(packer, sizeof(ci_dyn_array_t)); if (!array) { ci_mem_allocator_destroy(packer); return NULL; } if (items < 32) items = 32; array->max_items = items; array->items = ci_buffer_alloc(items*sizeof(ci_array_item_t *)); array->count = 0; array->alloc = packer; return array; } void ci_dyn_array_destroy(ci_dyn_array_t *array) { if (array->items) ci_buffer_free(array->items); if (array->alloc) ci_mem_allocator_destroy(array->alloc); } const ci_array_item_t * ci_dyn_array_add(ci_dyn_array_t *array, const char *name, const void *value, size_t size) { ci_array_item_t *item; ci_array_item_t **items_space; ci_mem_allocator_t *packer = array->alloc; int name_size; if (array->count == array->max_items) { items_space = ci_buffer_realloc(array->items, (array->max_items + 32)*sizeof(ci_array_item_t *)); if (!items_space) return NULL; array->items = items_space; array->max_items += 32; } assert(packer); item = packer->alloc(packer, sizeof(ci_array_item_t)); if (!item) { ci_debug_printf(2, "Not enough space to add the new item %s to array!\n", name); return NULL; } name_size = strlen(name) + 1; item->name = packer->alloc(packer, name_size); if (size > 0) item->value = packer->alloc(packer, size); else item->value = NULL; if (!item->name || (!item->value && size > 0)) { ci_debug_printf(2, "Not enough space to add the new item %s to array!\n", name); /*packer->free does not realy free anything bug maybe in the future will be able to release memory*/ if (item->name) packer->free(packer, item->name); if (item->value) packer->free(packer, item->value); packer->free(packer, item); return NULL; } /*copy values*/ memcpy(item->name, name, name_size); if (size > 0) memcpy(item->value, value, size); else item->value = (void *)value; array->items[array->count++] = item; return item; } const void * ci_dyn_array_search(ci_dyn_array_t *array, const char *name) { ci_array_item_t *item; int i; for (i = 0; i < array->count; ++i) if (strcmp(array->items[i]->name, name) == 0) return array->items[i]->value; /*did not found anything*/ return NULL; } void ci_dyn_array_iterate(const ci_dyn_array_t *array, void *data, int (*fn)(void *data, const char *name, const void *value)) { int i, ret = 0; for (i=0; i < array->count && ret == 0; i++) ret = (*fn)(data, array->items[i]->name, array->items[i]->value); } const ci_array_item_t * ci_ptr_dyn_array_add(ci_ptr_dyn_array_t *array, const char *name, void *value) { return ci_dyn_array_add(array, name, value, 0); } /**************/ /* Vectors API */ ci_vector_t * ci_vector_create(size_t max_size) { ci_vector_t *vector; ci_mem_allocator_t *packer; void *buffer; void **indx; buffer = ci_buffer_alloc(max_size); if (!buffer) return NULL; packer = ci_create_pack_allocator_on_memblock(buffer, max_size); if (!packer) { ci_buffer_free(buffer); return NULL; } vector = ci_pack_allocator_alloc(packer, sizeof(ci_vector_t)); /*Allocate mem for the first item which points to NULL. Vectors are NULL terminated*/ indx = ci_pack_allocator_alloc_unaligned(packer, array_item_size(void *)); if (!vector || ! indx) { ci_buffer_free(buffer); ci_mem_allocator_destroy(packer); return NULL; } *indx = NULL; vector->max_size = max_size; vector->mem = buffer; vector->items = indx; vector->last = indx; vector->count = 0; vector->alloc = packer; return vector; } const void **ci_vector_cast_to_voidvoid(ci_vector_t *vector) { return (const void **)vector->items; } ci_vector_t *ci_vector_cast_from_voidvoid(const void **p) { const void *buf; ci_vector_t *v; v = (ci_vector_t *)((void *)p - _CI_ALIGN(sizeof(ci_vector_t))); buf = (void *)v - ci_pack_allocator_required_size(); /*Check if it is a valid vector. The ci_buffer_blocksize will return 0, if buf is not a ci_buffer object*/ assert(v->mem == buf); assert(ci_buffer_blocksize(buf) != 0); return v; } void ci_vector_destroy(ci_vector_t *vector) { void *buffer = vector->mem; assert(buffer); if (vector->alloc) ci_mem_allocator_destroy(vector->alloc); ci_buffer_free(buffer); } void * ci_vector_add(ci_vector_t *vector, const void *value, size_t size) { void *item, **indx; ci_mem_allocator_t *packer = vector->alloc; assert(packer); indx = ci_pack_allocator_alloc_unaligned(packer, array_item_size(void *)); item = ci_pack_allocator_alloc_from_rear(packer, size); if (!item || !indx) { ci_debug_printf(2, "Not enough space to add the new item to vector!\n"); return NULL; } memcpy(item, value, size); *(vector->last) = item; vector->last = indx; *(vector->last) = NULL; vector->count++; return item; } void * ci_vector_pop(ci_vector_t *vector) { void *p; if (vector->count == 0) return NULL; /*Delete the last NULL element*/ ci_pack_allocator_set_start_pos(vector->alloc, vector->last); /*Set last to the preview ellement*/ vector->count--; vector->last = &vector->items[vector->count]; /*Erase the content of last element*/ if (vector->count == 0) ci_pack_allocator_set_end_pos(vector->alloc, NULL); else ci_pack_allocator_set_end_pos(vector->alloc, vector->items[vector->count-1]); /*The last element must point to NULL*/ p = *(vector->last); *(vector->last) = NULL; return p; } void ci_vector_iterate(const ci_vector_t *vector, void *data, int (*fn)(void *data, const void *)) { int i, ret = 0; for (i=0; vector->items[i] != NULL && ret == 0; i++) ret = (*fn)(data, vector->items[i]); } /*ci_str_vector functions */ void ci_str_vector_iterate(const ci_str_vector_t *vector, void *data, int (*fn)(void *data, const char *)) { ci_vector_iterate(vector, data, (int(*)(void *, const void *))fn); } const char * ci_str_vector_search(ci_str_vector_t *vector, const char *item) { int i; for (i=0; vector->items[i] != NULL; i++) { if (strcmp(vector->items[i], item) == 0) return vector->items[i]; } return NULL; } /*ci_ptr_vector functions....*/ void * ci_ptr_vector_add(ci_vector_t *vector, void *value) { void **indx; ci_mem_allocator_t *packer = vector->alloc; assert(packer); if (!value) return NULL; indx = ci_pack_allocator_alloc_unaligned(packer, array_item_size(void *)); if (!indx) { ci_debug_printf(2, "Not enough space to add the new item to ptr_vector!\n"); return NULL; } /*Store the pointer to the last ellement */ *(vector->last) = value; /*And create a new NULL terminated item: */ vector->last = indx; *(vector->last) = NULL; vector->count++; return value; } /****************/ /* Lists API */ ci_list_t * ci_list_create(size_t init_size, size_t obj_size) { ci_list_t *list = NULL; ci_mem_allocator_t *alloc = NULL; if (init_size < 1024) init_size = 1024; alloc = ci_create_serial_allocator(init_size); list = alloc->alloc(alloc, sizeof(ci_list_t)); list->alloc = alloc; list->items = NULL; list->last = NULL; list->trash = NULL; list->cursor = NULL; list->obj_size = obj_size; /*By default do not use any handler*/ list->cmp_func = NULL; list->copy_func = NULL; list->free_func = NULL; return list; } void ci_list_destroy(ci_list_t *list) { ci_mem_allocator_t *alloc = list->alloc; ci_mem_allocator_destroy(alloc); } void ci_list_cmp_handler(ci_list_t *list, int (*cmp_func)(const void *obj, const void *user_data, size_t user_data_size)) { list->cmp_func = cmp_func; } void ci_list_free_handler(ci_list_t *list, void (*free_func)(void *obj)) { list->free_func = free_func; } void ci_list_copy_handler(ci_list_t *list, int (*copy_func)(void *newObj, const void *oldObj)) { list->copy_func = copy_func; } void ci_list_iterate(ci_list_t *list, void *data, int (*fn)(void *data, const void *obj)) { ci_list_item_t *it; for (list->cursor = list->items; list->cursor != NULL; ) { it = list->cursor; list->cursor = list->cursor->next; if ((*fn)(data, it->item)) return; } } static ci_list_item_t *list_alloc_item(ci_list_t *list, const void *data) { ci_list_item_t *it; if (list->trash) { it = list->trash; list->trash = list->trash->next; } else { it = list->alloc->alloc(list->alloc, sizeof(ci_list_item_t)); if (!it) return NULL; if (list->obj_size) { it->item = list->alloc->alloc(list->alloc, list->obj_size); if (!it->item) return NULL; } } it->next = NULL; if (list->obj_size) { memcpy(it->item, data, list->obj_size); if (list->copy_func) list->copy_func(it->item, data); } else it->item = data; return it; } const void * ci_list_push(ci_list_t *list, const void *data) { ci_list_item_t *it = list_alloc_item(list, data); if (!it) return NULL; if (list->items) { it->next = list->items; list->items = it; } else { list->items = list->last = it; } return it->item; } const void * ci_list_push_back(ci_list_t *list, const void *data) { ci_list_item_t *it = list_alloc_item(list, data); if (!it) return NULL; if (list->last != NULL) { list->last->next = it; list->last = it; } else { list->items = list->last = it; } return it->item; } void *ci_list_pop(ci_list_t *list, void *data) { ci_list_item_t *it = list->items; if (list->items == NULL) return NULL; if (list->last == list->items) { list->last = NULL; list->items = NULL; list->cursor = NULL; } else { if (list->cursor == list->items) list->cursor = list->items->next; list->items = list->items->next; } it->next = list->trash; list->trash = it; if (list->obj_size) { memcpy(data, it->item, list->obj_size); if (list->copy_func) list->copy_func(data, it->item); if (list->free_func) list->free_func(it->item); return data; } else return (*((void **)data) = it->item); } void *ci_list_pop_back(ci_list_t *list, void *data) { ci_list_item_t *tmp, *it = list->last; if (list->items == NULL) return NULL; if (list->last == list->items) { list->last = NULL; list->items = NULL; list->cursor = NULL; } else { if (list->cursor == list->last) list->cursor = NULL; for (tmp = list->items; tmp != NULL && tmp->next != list->last; tmp = tmp->next); assert(tmp != NULL); list->last = tmp; list->last->next = NULL; } it->next = list->trash; list->trash = it; if (list->obj_size) { memcpy(data, it->item, list->obj_size); if (list->copy_func) list->copy_func(data, it->item); if (list->free_func) list->free_func(it->item); return data; } else return (*((void **)data) = it->item); } static int default_cmp(const void *obj1, const void *obj2, size_t size) { return memcmp(obj1, obj2, size); } static int pointers_cmp(const void *obj1, const void *obj2, size_t size) { return (obj1 == obj2 ? 0 : (obj1 > obj2 ? 1 : -1)); } int ci_list_remove(ci_list_t *list, const void *obj) { ci_list_item_t *it, *prev; int (*cmp_func)(const void *, const void *, size_t); if (list->cmp_func) cmp_func = list->cmp_func; else if (list->obj_size) cmp_func = default_cmp; else cmp_func = pointers_cmp; prev = NULL; for (it = list->items; it != NULL; prev = it,it = it->next) { if (cmp_func(it->item, obj, list->obj_size) == 0) { if (prev) { prev->next = it->next; } else { /*it is the first item*/ list->items = it->next; } if (list->cursor == it) list->cursor = list->cursor->next; it->next = list->trash; list->trash = it; if (list->free_func && list->obj_size) list->free_func(it->item); return 1; } } return 0; } const void * ci_list_search(ci_list_t *list, const void *data) { ci_list_item_t *it; int (*cmp_func)(const void *, const void *, size_t); if (list->cmp_func) cmp_func = list->cmp_func; else if (list->obj_size) cmp_func = default_cmp; else cmp_func = pointers_cmp; for (it = list->items; it != NULL; it = it->next) { if (cmp_func(it->item, data, list->obj_size) == 0) return it->item; } return NULL; } const void * ci_list_search2(ci_list_t *list, const void *data, int (*cmp_func)(const void *obj, const void *user_data, size_t user_data_size)) { ci_list_item_t *it; for (it = list->items; it != NULL; it = it->next) { if (cmp_func(it->item, data, list->obj_size) == 0) return it->item; } return NULL; } void ci_list_sort(ci_list_t *list) { int (*cmp_func)(const void *, const void *, size_t); if (list->cmp_func) cmp_func = list->cmp_func; else if (list->obj_size) cmp_func = default_cmp; else cmp_func = pointers_cmp; ci_list_sort2(list, cmp_func); } void ci_list_sort2(ci_list_t *list, int (*cmp_func)(const void *obj1, const void *obj2, size_t obj_size)) { ci_list_item_t *it; ci_list_item_t *sortedHead = NULL, *sortedTail = NULL; ci_list_item_t **currentSorted, *currentHead; if (!list->items || ! list->items->next) return; it = list->items; while (it) { currentHead = it; it = it->next; currentSorted = &sortedHead; while(!(*currentSorted == NULL || cmp_func(currentHead->item, (*currentSorted)->item, list->obj_size) < 0)) currentSorted = &(*currentSorted)->next; currentHead->next = *currentSorted; *currentSorted = currentHead; if ((*currentSorted)->next == NULL) sortedTail = (*currentSorted); } list->items = sortedHead; list->last = sortedTail; } c_icap-0.4.2/c_icap.mak0000664000175000017500000000032312567550776011610 00000000000000 CONFDIR="c:\\c-icap\\etc" SERVDIR="c:\\c-icap\\lib" MODSDIR="c:\\c-icap\\lib" LOGDIR="c:\\c-icap\\log" CI_DEFS=-DCONFDIR=\"$(CONFDIR)\" -DSERVDIR=\"$(SERVDIR)\" -DMODSDIR=\"$(MODSDIR)\" -DLOGDIR=\"$(LOGDIR)\" c_icap-0.4.2/common.h0000664000175000017500000000171412567550777011347 00000000000000 #ifndef __COMMON_H #define __COMMON_H #ifdef HAVE_CONFIG_H #include "autoconf.h" #elif defined (_MSC_VER) #include "config-w32.h" #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #if HAVE_SYS_PARAM_H #include #endif #ifdef HAVE_MALLOC_H #include #endif #ifdef HAVE_DLFCN_H #include #endif #ifdef HAVE_STDINT_H #include #endif #ifdef HAVE_LIMITS_H #include #endif #ifndef HAVE_STRNSTR #define strnstr(s, find, slen) ci_strnstr(s, find, slen) #endif #ifndef HAVE_STRNCASESTR #define strncasestr(s, find, slen) ci_strncasestr(s, find, slen) #endif #ifndef HAVE_STRCASESTR #define strcasestr(str, find) ci_strcasestr(str, find) #endif #endif c_icap-0.4.2/config.guess0000755000175000017500000013036112601747524012210 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-06-10' # 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 3 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, see . # # 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. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches with a ChangeLog entry to config-patches@gnu.org. 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 1992-2013 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 ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # 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 case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` ;; esac # 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 tuples: *-*-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 ;; sh5el) machine=sh5le-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 -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; 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 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; 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 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; 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 ;; 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 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; 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 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # 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 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; 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 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????: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 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; 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 ;; *: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 if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi 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 ;; *:AIX:*:[4567]) 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 ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; 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 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; 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 ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; 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 -q ld.so.1 if test "$?" = 0 ; then LIBC="gnulibc1" ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; or1k:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-${LIBC} exit ;; 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-${LIBC} ;; PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-${LIBC} exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-${LIBC} exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; 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 ;; 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 ;; 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 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; 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 ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. 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 ;; 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 ;; 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 i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; 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 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*: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; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' 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; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *: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 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; 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 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *: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 ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *: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 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac 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\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # 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 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; 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: c_icap-0.4.2/c_icap_dll.mak0000664000175000017500000000122612567550777012447 00000000000000!include !include "c_icap.mak" all: c_icap.Dll LIBICAPOBJS = header.obj body.obj net_io.obj simple_api.obj base64.obj cfg_lib.obj filetype.obj debug.obj LIBUTIL=os\win32\shared_mem.obj os\win32\proc_mutex.obj os\win32\net_io.obj os\win32\threads.obj os\win32\utilfunc.obj .c.obj: $(cc) -Iinclude $(cdebug) $(cflags) $(cvarsdll) $(CI_DEFS) -I. -DCI_BUILD_LIB -DUNICODE $*.c /Fo$*.obj # $(cc) -Iinclude $(cdebug) $(cflags) $(cvarsmt) -I. -DCI_BUILD_LIB -DUNICODE $*.c c_icap.Dll: $(LIBICAPOBJS) $(LIBUTIL) $(DLL_ENTRY) $(link) $(ldebug) $(dlllflags) -def:c_icap.def -out:$*.Dll $** Ws2_32.lib kernel32.lib $(DLL_ENTRY) $(EXTRA_LIBS) c_icap-0.4.2/ltmain.sh0000644000175000017500000105204412601747521011507 00000000000000 # libtool (GNU libtool) 2.4.2 # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, # 2007, 2008, 2009, 2010, 2011 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. # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Usage: $progname [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 # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --no-quiet, --no-silent # print informational messages (default) # --no-warn don't display warning messages # --tag=TAG use configuration variables from tag TAG # -v, --verbose print more informational messages than default # --no-verbose don't print the extra informational messages # --version print version information # -h, --help, --help-all print short, long, or detailed help message # # 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. When passed as first option, # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. # Try `$progname --help --mode=MODE' for a more detailed description of MODE. # # When reporting a bug, please describe a test case to reproduce it and # include the following information: # # host-triplet: $host # shell: $SHELL # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) # $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.7ubuntu1 # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # GNU libtool home page: . # General help using GNU software: . PROGRAM=libtool PACKAGE=libtool VERSION="2.4.2 Debian-2.4.2-1.7ubuntu1" TIMESTAMP="" package_revision=1.3337 # 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+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # NLS nuisances: We save the old values to restore during execute mode. lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${$lt_var+set}\" = set; then save_$lt_var=\$$lt_var $lt_var=C export $lt_var lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done LC_ALL=C LANGUAGE=C export LANGUAGE LC_ALL $lt_unset CDPATH # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath="$0" : ${CP="cp -f"} test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. exit_status=$EXIT_SUCCESS # Make sure IFS has a sensible default lt_nl=' ' IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_dirname may be replaced by extended shell implementation # func_basename file func_basename () { func_basename_result=`$ECHO "${1}" | $SED "$basename"` } # func_basename may be replaced by extended shell implementation # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` } # func_dirname_and_basename may be replaced by extended shell implementation # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname may be replaced by extended shell implementation # These SED scripts presuppose an absolute path with a trailing slash. pathcar='s,^/\([^/]*\).*$,\1,' pathcdr='s,^/[^/]*,,' removedotparts=':dotsl s@/\./@/@g t dotsl s,/\.$,/,' collapseslashes='s@/\{1,\}@/@g' finalslash='s,/*$,/,' # func_normal_abspath PATH # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. # value returned in "$func_normal_abspath_result" func_normal_abspath () { # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` while :; do # Processed it all yet? if test "$func_normal_abspath_tpath" = / ; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result" ; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_relative_path SRCDIR DSTDIR # generates a relative path from SRCDIR to DSTDIR, with a trailing # slash if non-empty, suitable for immediately appending a filename # without needing to append a separator. # value returned in "$func_relative_path_result" func_relative_path () { func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=${func_dirname_result} if test "x$func_relative_path_tlibdir" = x ; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test "x$func_stripname_result" != x ; then func_relative_path_result=${func_relative_path_result}/${func_stripname_result} fi # Normalisation. If bindir is libdir, return empty string, # else relative path ending with a slash; either way, target # file name can be directly appended. if test ! -z "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result/" func_relative_path_result=$func_stripname_result fi } # The name of this program: func_dirname_and_basename "$progpath" progname=$func_basename_result # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=$func_dirname_result progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; *) save_IFS="$IFS" IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break done IFS="$save_IFS" test -n "$progdir" || progdir=`pwd` progpath="$progdir/$progname" ;; esac # 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='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' # Sed substitution that converts a w32 file name or path # which contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. # Since each input `\' is now two `\'s, look for any number of runs of # four `\'s followed by two `\'s and then a '$'. `\' that '$'. bs='\\' bs2='\\\\' bs4='\\\\\\\\' dollar='\$' sed_double_backslash="\ s/$bs4/&\\ /g s/^$bs2$dollar/$bs&/ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g s/\n//g" # Standard options: opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode # name if it has been set yet. func_echo () { $ECHO "$progname: ${opt_mode+$opt_mode: }$*" } # func_verbose arg... # Echo program name prefixed message in verbose mode only. func_verbose () { $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_error arg... # Echo program name prefixed message to standard error. func_error () { $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 # bash bug again: : } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } help="Try \`$progname --help' for more information." ## default # func_grep expression filename # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $GREP "$1" "$2" >/dev/null 2>&1 } # func_mkdir_p directory-path # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { my_directory_path="$1" my_dir_list= if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then # Protect directory names starting with `-' case $my_directory_path in -*) my_directory_path="./$my_directory_path" ;; esac # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` done my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do IFS="$save_mkdir_p_IFS" # mkdir can fail with a `File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$my_dir" 2>/dev/null || : done IFS="$save_mkdir_p_IFS" # Bail out if we (or some other process) failed to create a directory. test -d "$my_directory_path" || \ func_fatal_error "Failed to create \`$1'" fi } # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $MKDIR "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || \ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi $ECHO "$my_tmpdir" } # func_quote_for_eval arg # Aesthetically quote ARG to be evaled later. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT # is double-quoted, suitable for a subsequent eval, whereas # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters # which are still active within double quotes backslashified. func_quote_for_eval () { case $1 in *[\\\`\"\$]*) func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac case $func_quote_for_eval_unquoted_result in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" esac } # func_quote_for_expand arg # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { case $1 in *[\\\`\"]*) my_arg=`$ECHO "$1" | $SED \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; esac case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") my_arg="\"$my_arg\"" ;; esac func_quote_for_expand_result="$my_arg" } # func_show_eval cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$my_cmd" my_status=$? if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_show_eval_locale cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_tr_sh # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_version # Echo version message to standard output and exit. func_version () { $opt_debug $SED -n '/(C)/!b go :more /\./!{ N s/\n# / / b more } :go /^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $? } # func_usage # Echo short help message to standard output and exit. func_usage () { $opt_debug $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" echo $ECHO "run \`$progname --help | more' for full usage" exit $? } # func_help [NOEXIT] # Echo long help message to standard output and exit, # unless 'noexit' is passed as argument. func_help () { $opt_debug $SED -n '/^# Usage:/,/# Report bugs to/ { :print s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ p d } /^# .* home page:/b print /^# General help using/b print ' < "$progpath" ret=$? if test -z "$1"; then exit $ret fi } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $opt_debug func_error "missing argument for $1." exit_cmd=exit } # func_split_short_opt shortopt # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. func_split_short_opt () { my_sed_short_opt='1s/^\(..\).*$/\1/;q' my_sed_short_rest='1s/^..\(.*\)$/\1/;q' func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` } # func_split_short_opt may be replaced by extended shell implementation # func_split_long_opt longopt # Set func_split_long_opt_name and func_split_long_opt_arg shell # variables after splitting LONGOPT at the `=' sign. func_split_long_opt () { my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` } # func_split_long_opt may be replaced by extended shell implementation exit_cmd=: magic="%%%MAGIC variable%%%" magic_exe="%%%MAGIC EXE variable%%%" # Global variables. nonopt= preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" extracted_archives= extracted_serial=0 # 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= # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "${1}=\$${1}\${2}" } # func_append may be replaced by extended shell implementation # func_append_quoted var value # Quote VALUE and append to the end of shell variable VAR, separated # by a space. func_append_quoted () { func_quote_for_eval "${2}" eval "${1}=\$${1}\\ \$func_quote_for_eval_result" } # func_append_quoted may be replaced by extended shell implementation # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "${@}"` } # func_arith may be replaced by extended shell implementation # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` } # func_len may be replaced by extended shell implementation # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` } # func_lo2o may be replaced by extended shell implementation # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` } # func_xform may be replaced by extended shell implementation # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # func_config # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # Display the features supported by this script. func_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 $? } # func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname="$1" re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf="/$re_begincf/,/$re_endcf/p" # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Option defaults: opt_debug=: opt_dry_run=false opt_config=false opt_preserve_dup_deps=false opt_features=false opt_finish=false opt_help=false opt_help_all=false opt_silent=: opt_warning=: opt_verbose=: opt_silent=false opt_verbose=false # Parse options once, thoroughly. This comes as soon as possible in the # script to make things like `--version' happen as quickly as we can. { # this just eases exit handling while test $# -gt 0; do opt="$1" shift case $opt in --debug|-x) opt_debug='set -x' func_echo "enabling shell trace mode" $opt_debug ;; --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) opt_config=: func_config ;; --dlopen|-dlopen) optarg="$1" opt_dlopen="${opt_dlopen+$opt_dlopen }$optarg" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) opt_features=: func_features ;; --finish) opt_finish=: set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help_all=: opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_mode="$optarg" case $optarg in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_silent=false func_append preserve_args " $opt" ;; --no-warning|--no-warn) opt_warning=false func_append preserve_args " $opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $opt" ;; --silent|--quiet) opt_silent=: func_append preserve_args " $opt" opt_verbose=false ;; --verbose|-v) opt_verbose=: func_append preserve_args " $opt" opt_silent=false ;; --tag) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_tag="$optarg" func_append preserve_args " $opt $optarg" func_enable_tag "$optarg" shift ;; -\?|-h) func_usage ;; --help) func_help ;; --version) func_version ;; # Separate optargs to long options: --*=*) func_split_long_opt "$opt" set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-n*|-v*) func_split_short_opt "$opt" set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) set dummy "$opt" ${1+"$@"}; shift; break ;; esac done # Validate options: # save first non-option argument if test "$#" -gt 0; then nonopt="$opt" shift fi # preserve --debug test "$opt_debug" = : || func_append preserve_args " --debug" case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test "$opt_mode" != execute; then func_error "unrecognized option \`-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help="$help" help="Try \`$progname --help --mode=$opt_mode' for more information." } # Bail if the options were screwed $exit_cmd $EXIT_FAILURE } ## ----------- ## ## Main. ## ## ----------- ## # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test "$lalib_p" = yes } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { func_lalib_p "$1" } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. func_source () { $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case "$lt_sysroot:$1" in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result="=$func_stripname_result" ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=${1} if test "$build_libtool_libs" = yes; then write_lobj=\'${2}\' else write_lobj=none fi if test "$build_old_libs" = yes; then write_oldobj=\'${3}\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$lt_sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $opt_debug # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result="" if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result" ; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $opt_debug if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $opt_debug # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $opt_debug if test -z "$2" && test -n "$1" ; then func_error "Could not determine host file name corresponding to" func_error " \`$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result="$1" fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $opt_debug if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " \`$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result="$3" fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $opt_debug case $4 in $1 ) func_to_host_path_result="$3$func_to_host_path_result" ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via `$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $opt_debug $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $opt_debug case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result="$1" } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result="$func_convert_core_msys_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $opt_debug func_to_host_file_result="$1" if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via `$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $opt_debug if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd="func_convert_path_${func_stripname_result}" fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $opt_debug func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result="$1" } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_msys_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $opt_debug func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_mode_compile arg... func_mode_compile () { $opt_debug # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg="$arg" arg_mode=normal ;; target ) libobj="$arg" arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" func_append_quoted lastarg "$arg" done IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg="$srcfile" srcfile="$arg" ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj="$func_basename_result" } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name \`$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname="$func_basename_result" xdir="$func_dirname_result" lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) 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 "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} lockfile="$output_obj.lock" else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test "$need_locks" = yes; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "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." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # 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 command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' 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." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi 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 $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 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." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test "$opt_mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [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: $progname [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 -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a \`.o' file suitable for static linking -static only build a \`.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler 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: $progname [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: $progname [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: $progname [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 following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [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 -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -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 -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) 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: $progname [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." ;; *) func_fatal_help "invalid operation mode \`$opt_mode'" ;; esac echo $ECHO "Try \`$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test "$opt_help" = :; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | sed -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | sed '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $opt_debug # The first argument is the command name. cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "\`$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi func_dirname "$file" "" "." dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir="$func_dirname_result" ;; *) func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" 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 -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file="$progdir/$program" elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file="$progdir/$program" fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # 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 $EXIT_SUCCESS fi } test "$opt_mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "\`$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument \`$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and \`=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_silent && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 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" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $opt_debug # 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. case $nonopt in *shtool*) :;; *) false;; esac; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=no stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=yes ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test "x$prev" = x-m && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the \`$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=yes if test "$isdir" = yes; then destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; 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. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir="$func_dirname_result" func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking \`$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname="$1" shift srcname="$realname" test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme="$stripme" case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme="" ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib="$destdir/$realname" func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name="$func_basename_result" instname="$dir/$name"i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append 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 func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest="$destfile" destfile= ;; *) func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= func_source "$wrapper" outputname= if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name="$func_basename_result" # Set up the ranlib parameters. oldlib="$destdir/$name" func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" name="$func_basename_result" case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename="" if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname" ; then func_basename "$dlprefile_dlname" dlprefile_dlbasename="$func_basename_result" else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename" ; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # 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/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[]; LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) 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*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' # Transform the symbol file into the correct name. symfileobj="$output_objdir/${my_outputname}S.$objext" case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; 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 "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s,.*,import, p q } }'` case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $opt_debug sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $opt_debug match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive which possess that section. Heuristic: eliminate # all those which have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $opt_debug func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $opt_debug if func_cygming_gnu_implib_p "$1" ; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1" ; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result="" fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" if test "$lock_old_archive_extraction" = yes; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test "$lock_old_archive_extraction" = yes; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $opt_debug my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result="$my_oldobjs" } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory in which it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # 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. sed_quote_subst='$sed_quote_subst' # 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+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' 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 file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ which is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options which match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED '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 \"\$file\" | $SED '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 \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test "$fast_install" = yes; then $ECHO "\ 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 "\ # 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 "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # 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 \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${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\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include /* declarations of non-ANSI functions */ #if defined(__MINGW32__) # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined(__CYGWIN__) # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined (other platforms) ... */ #endif /* portability defines, excluding path handling macros */ #if defined(_MSC_VER) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC # ifndef _INTPTR_T_DEFINED # define _INTPTR_T_DEFINED # define intptr_t int # endif #elif defined(__MINGW32__) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined(__CYGWIN__) # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined (other platforms) ... */ #endif #if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX #elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free ((void *) stale); stale = 0; } \ } while (0) #if defined(LT_DEBUGWRAPPER) static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; int tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined (HAVE_DOS_BASED_FILE_SYSTEM) if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined (HAVE_DOS_BASED_FILE_SYSTEM) } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = q - p; p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (strcmp (str, pat) == 0) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else int len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { int orig_value_len = strlen (orig_value); int add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ int len = strlen (new_value); while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $opt_debug case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_mode_link arg... func_mode_link () { $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # 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 invocation. # 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 base_compile="$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` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_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 func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir="$arg" prev= continue ;; dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append 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 func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols="$arg" test -f "$arg" \ || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex="$arg" prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir="$arg" prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; precious_regex) precious_files_regex="$arg" prev= continue ;; release) release="-$arg" prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds="$arg" prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append 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 # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir 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 func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between \`-L' and \`$1'" else func_fatal_error "need path for \`-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of \`$dir'" dir="$absdir" ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module="${wl}-multi_module" continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "\`-no-install' is ignored for $host" func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs="$IFS"; IFS=',' for flag in $args; do IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-flto*|-fwhopr*|-fuse-linker-plugin) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test "$pic_object" = none && test "$non_pic_object" = none; then func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg="$pic_object" fi # Non-PIC object. if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; then arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test "$prev" = dlfiles; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" 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. func_quote_for_eval "$arg" arg="$func_quote_for_eval_result" ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the \`$prevarg' option requires an argument" if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname="$func_basename_result" libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'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\" func_dirname "$output" "/" "" output_objdir="$func_dirname_result$objdir" func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$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 $opt_preserve_dup_deps ; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; 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 # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs="$dlprefiles" fi if test "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then if test "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll="$l" done if test "X$ll" = "X$old_library" ; then # only static version available found=no func_dirname "$lib" "" "." ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test "$pass" = link; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; 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 use here." else echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "\`$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir="$func_dirname_result" dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append 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 func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done elif test "$linkmode" != prog && test "$linkmode" != lib; then func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test "$prefer_static_libs" = yes || test "$prefer_static_libs,$installed" = "built,no"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib="$l" done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. if test "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append 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 func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir="$ladir" fi ;; esac func_basename "$lib" laname="$func_basename_result" # Find the relevant object directory and library name. if test "X$installed" = Xyes; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library \`$lib' was moved." dir="$ladir" absdir="$abs_ladir" libdir="$abs_ladir" else dir="$lt_sysroot$libdir" absdir="$lt_sysroot$libdir" fi test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later func_append notinst_path " $abs_ladir" else dir="$ladir/$objdir" absdir="$abs_ladir/$objdir" # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; then func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi case "$host" in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then func_append 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*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; 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 $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test "$installed" = no; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule="$dlpremoduletest" break fi done if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then echo if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname="$1" shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc*) func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use soroot="$soname" func_basename "$soroot" soname="$func_basename_result" func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from \`$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for \`$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' 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 "$opt_mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library" ; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add="$dir/$old_library" fi elif test -n "$old_library"; then add="$dir/$old_library" fi fi esac elif test "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$absdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append 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:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; 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:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system can not link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else 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*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs="$temp_deplibs" fi func_append 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" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path="$deplib" ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of \`$dir'" absdir="$dir" fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names" ; then for tmp in $deplibrary_names ; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl" ; then depdepl="$absdir/$objdir/$depdepl" darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) path="-L$absdir/$objdir" ;; esac else eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "\`$deplib' seems to be moved" path="-L$absdir" fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test "$pass" = link; then if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs="$output" func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test "$deplibs_check_method" != pass_all; then func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test "$#" -gt 1 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$1" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 shift IFS="$save_ifs" test -n "$7" && \ func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major="$1" number_minor="$2" number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # which has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|qnx|sunos) current="$number_major" revision="$number_minor" age="0" ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_minor" lt_irix_increment=no ;; *) func_fatal_configuration "$modename: unknown library version type \`$version_type'" ;; esac ;; no) current="$1" revision="$2" age="$3" ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT \`$current' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION \`$revision' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE \`$age' must be a nonnegative integer" func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE \`$age' is greater than the current interface number \`$current'" func_fatal_error "\`$vinfo' is not valid version information" 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 func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 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) if test "X$lt_irix_increment" = "Xno"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision while test "$loop" -ne 0; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring_prefix$major.$iface:$verstring" done # Before this point, $major must not contain `.'. major=.$major versuffix="$major.$revision" ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix="$major.$age.$revision" ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=".$current.$age.$revision" verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age while test "$loop" -ne 0; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring="$verstring:${iface}.0" done # Make executables depend on our current version. func_append verstring ":${current}.0" ;; qnx) major=".$current" versuffix=".$current" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. func_arith $current - $age major=$func_arith_result versuffix="-$major" ;; *) func_fatal_configuration "unknown library version type \`$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring="0.0" ;; esac if test "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" func_append libobjs " $symfileobj" test "X$libobjs" = "X " && libobjs= if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "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 func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append 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 "*) ;; *) func_append 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 "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test "$build_libtool_need_lc" = "yes"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release="" versuffix="" major="" newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi 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 "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib="" ;; esac fi if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib="" break 2 fi done done fi if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs="" tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi case $tmp_deplibs in *[!\ \ ]*) 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 ;; esac ;; 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 with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; 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 # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs="$new_libs" # 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 # Remove ${wl} instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$opt_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 func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result 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"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append 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 func_append 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 "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname="$1" shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi lib="$output_objdir/$realname" linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols="$output_objdir/$libname.uexp" func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs="$IFS"; IFS='~' for cmd1 in $cmds; do IFS="$save_ifs" # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test "$try_normal_branch" = yes \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=${output_objdir}/${output_la}.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS="$save_ifs" if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-${k}.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-${k}.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\${concat_cmds}$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi if ${skipped_export-false}; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi fi test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do IFS="$save_ifs" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi fi libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs="$IFS"; IFS='~' for cmd in $cmds; do IFS="$save_ifs" eval cmd=\"$cmd\" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS="$save_ifs" # Restore the uninstalled library and exit if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_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 "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "\`-l' and \`-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj="$output" ;; esac # Delete the old objects. $opt_dry_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 and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else gentop="$output_objdir/${obj}x" func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" # Create the old-style object. reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then func_show_eval '${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" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS 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" func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ func_warning "\`-release' is ignored for programs" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " ${wl}-bind_at_load" func_append finalize_command " ${wl}-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs="$new_libs" func_append compile_command " $compile_deplibs" func_append 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 "*) ;; *) func_append 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"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; 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"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append 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 "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=yes case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=no ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; esac if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.${objext}"; then func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status 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 func_append 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 func_append 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 "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS 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" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED '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 "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "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}\" || $lt_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 func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource="$output_path/$objdir/lt-$output_name.c" cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host" ; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; 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 $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then func_append oldobjs " $symfileobj" fi fi addlibs="$old_convenience" fi if test -n "$addlibs"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test "$build_old_libs" = yes && old_library="$libname.$libext" func_verbose "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}\" || $lt_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 func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { 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) func_basename "$deplib" name="$func_basename_result" func_resolve_sysroot "$deplib" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "\`$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name="$func_basename_result" eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test "x$bindir" != x ; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # 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' # Linker flags that can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } { test "$opt_mode" = link || test "$opt_mode" = relink; } && func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { $opt_debug 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) func_append RM " $arg"; rmforce=yes ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir="$func_dirname_result" if test "X$dir" = X.; then odir="$objdir" else odir="$dir/$objdir" fi func_basename "$file" name="$func_basename_result" test "$opt_mode" = uninstall && odir="$dir" # Remember odir for removal later, being careful to avoid duplicates if test "$opt_mode" = clean; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; 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 func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case "$opt_mode" in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test "$pic_object" != none; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test "$non_pic_object" != none; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.${objext}" if test "$fast_install" = yes && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name" ; then func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi ;; esac func_show_eval "$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 func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && func_mode_uninstall ${1+"$@"} test -z "$opt_mode" && { help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # vi:sw=2 c_icap-0.4.2/docs/0000775000175000017500000000000012601747561010677 500000000000000c_icap-0.4.2/docs/Makefile.am0000664000175000017500000000001612567550777012664 00000000000000SUBDIRS = man c_icap-0.4.2/docs/Makefile.in0000664000175000017500000004623512601747525012676 00000000000000# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = docs DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/autoconf.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BDB_ADD_FLAG = @BDB_ADD_FLAG@ BDB_ADD_LDADD = @BDB_ADD_LDADD@ BZLIB_ADD_FLAG = @BZLIB_ADD_FLAG@ BZLIB_ADD_LDADD = @BZLIB_ADD_LDADD@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CICAPLIB_VERSION = @CICAPLIB_VERSION@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ C_ICAP_HEX_VERSION = @C_ICAP_HEX_VERSION@ DEFINE_INT64 = @DEFINE_INT64@ DEFINE_INT8 = @DEFINE_INT8@ DEFINE_OFF_T = @DEFINE_OFF_T@ DEFINE_SIZE_OFF_T = @DEFINE_SIZE_OFF_T@ DEFINE_SIZE_T = @DEFINE_SIZE_T@ DEFINE_SIZE_VOID_P = @DEFINE_SIZE_VOID_P@ DEFINE_UINT64 = @DEFINE_UINT64@ DEFINE_UINT8 = @DEFINE_UINT8@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_ADD_FLAG = @DL_ADD_FLAG@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTTYPES_H = @INTTYPES_H@ INVISIBILITY_CFLAG = @INVISIBILITY_CFLAG@ LD = @LD@ LDAP_ADD_FLAG = @LDAP_ADD_FLAG@ LDAP_ADD_LDADD = @LDAP_ADD_LDADD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MEMCACHED_CFLAGS = @MEMCACHED_CFLAGS@ MEMCACHED_LDFLAGS = @MEMCACHED_LDFLAGS@ MKDIR_P = @MKDIR_P@ MODULES_CFLAGS = @MODULES_CFLAGS@ MODULES_LIBADD = @MODULES_LIBADD@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_ADD_FLAG = @PCRE_ADD_FLAG@ PCRE_ADD_LDADD = @PCRE_ADD_LDADD@ POSIX_FILE_LOCK = @POSIX_FILE_LOCK@ POSIX_MAPPED_FILES = @POSIX_MAPPED_FILES@ POSIX_SEMAPHORES = @POSIX_SEMAPHORES@ POSIX_SHARED_MEM = @POSIX_SHARED_MEM@ PTHREADS_RWLOCK = @PTHREADS_RWLOCK@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SYSV_IPC = @SYSV_IPC@ SYS_TYPES_H = @SYS_TYPES_H@ THREADS_LDADD = @THREADS_LDADD@ THREADS_LDFLAGS = @THREADS_LDFLAGS@ USE_COMPAT = @USE_COMPAT@ USE_IPV6 = @USE_IPV6@ USE_REGEX = @USE_REGEX@ VERSION = @VERSION@ VISIBILITY_ATTR = @VISIBILITY_ATTR@ ZLIB_ADD_FLAG = @ZLIB_ADD_FLAG@ ZLIB_ADD_LDADD = @ZLIB_ADD_LDADD@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_bin = @doxygen_bin@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ has_doxygen = @has_doxygen@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ perlccflags = @perlccflags@ perlcore = @perlcore@ perlldflags = @perlldflags@ perllib = @perllib@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = man all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu docs/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu docs/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$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 \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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 clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags tags-am uninstall uninstall-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: c_icap-0.4.2/docs/man/0000775000175000017500000000000012601747561011452 500000000000000c_icap-0.4.2/docs/man/c-icap-stretch.8.in0000664000175000017500000000305412567550777014714 00000000000000.TH c-icap-stretch 8 "@PACKAGE_STRING@" .SH NAME c-icap-stretch - A simple utility for stretching ICAP servers .SH SYNOPSIS .B c-icap-stretch [ .B \-i "icap_servername" ] [ .B \-p "port" ] [ .B \-s "service" ] [ .B \-urls "filename" ] [ .B \-req ] [ .B \-m "max-requests" ] [ .B \-t "threads-number" ] [ .B \-d "debug level" ] [ .B \-x "icap-header" ] [ .B \-hx "http-request-header" ] [ .B \-rhx "http-response-header" ] .B file1 file2 ... .SH DESCRIPTION .B c-icap-stretch is a simple utility for loading ICAP servers. .SH OPTIONS .IP "-i icap_servername" The hostname of the icap server. The default is localhost .IP "-p port" The server port. The default port value is 1344 .IP "-s service" The service name. The default service name is "echo" .IP "-urls filename" File with urls, one url per line, to use for stress test .IP "-req" Send request modification requests .IP "-m max-requests" The maximum requests to send .IP "-t threads-number" The number of client threads to start .IP "-d level" debug level info to stdout .IP "-x icap-header" Include the icap-header in icap request headers .IP "-hx http-request-header" Include the http-request-header in http request headers .IP "-rhx http-response-header" Include the http-response-header in http response headers .IP "file1 file2 ..." The files to use as body data to the ICAP requests. .SH SEE ALSO .BR c-icap "(8)" .BR c-icap-client "(8)" .BR c-icap-config "(8)" .BR c-icap-libicapapi-config "(8)" .BR c-icap-mkbdb "(8)" .SH BUGS It can used only for ICAP response modification services. .SH AUTHOR Tsantilas Christos c_icap-0.4.2/docs/man/c-icap-config.8.in0000664000175000017500000000172412567550777014507 00000000000000.TH c-icap-config 8 "@PACKAGE_STRING@" .SH NAME c-icap-config - script to get information about c-icap server .SH SYNOPSIS .B c-icap-config [ .B --cflags ] [ .B --libs ] [ .B --datarootdir ] [ .B --configdir ] [ .B --version ] [ .B --config ] .SH DESCRIPTION .B c-icap-config is a script to get information about c-icap server and compile options must used to build c-icap server modules and services. .SH OPTIONS .IP --cflags print preprocessor and compiler flags should used to compile a c-icap service or module .IP --libs print linker flags should used to build a c-icap service or module .IP --datarootdir print the c-icap data directory .IP --configdir print the c-icap configuration directory .IP --version print the c-icap server version .IP --config print the c-icap server compile configuration .SH SEE ALSO .BR c-icap "(8)" .BR c-icap-client "(8)" .BR c-icap-stretch "(8)" .BR c-icap-libicapapi-config "(8)" .BR c-icap-mkbdb "(8)" .SH AUTHOR Tsantilas Christos c_icap-0.4.2/docs/man/Makefile.am0000664000175000017500000000105412567550777013442 00000000000000 CONFIGDIR=@sysconfdir@ PKGLIBDIR=@pkglibdir@ MODULESDIR=$(pkglibdir)/ SERVICESDIR=$(pkglibdir)/ LOGDIR=$(localstatedir)/log/ SOCKDIR=/var/run/c-icap do_subst=sed -e 's%[@]SYSCONFDIR[@]%$(CONFIGDIR)%g' \ -e 's%[@]PACKAGE_STRING[@]%$(PACKAGE_STRING)%g' manpages = c-icap.8 c-icap-client.8 c-icap-config.8 c-icap-libicapapi-config.8 \ c-icap-stretch.8 c-icap-mkbdb.8 manpages_src = $(manpages:.8=.8.in) CLEANFILES = $(manpages) SUFFIXES = .8.in .8 .8.in.8: $(do_subst) < $< > $@ man_MANS = $(manpages) EXTRA_DIST = $(manpages_src) c_icap-0.4.2/docs/man/c-icap.8.in0000664000175000017500000001056512567550777013247 00000000000000.TH c-icap 8 "@PACKAGE_STRING@" .SH NAME c-icap - ICAP filtering server .SH SYNOPSIS .B c-icap [ .B \-f " config-file" ] [ .B \-N ] [ .B \-d " debug-level" ] [ .B \-D ] .SH DESCRIPTION .B c-icap is an implementation of an ICAP server. It can be used with HTTP proxies that support the ICAP protocol. Most of the comercial HTTP proxies must support ICAP pcotocol. .SH OPTIONS .IP "-f config-file" Specify the configuration file .IP "-N" Do not run as daemon .IP "-d level" Specify the debug level .IP "-D" Print debug info to stdout .SH FILES .I @SYSCONFDIR@/c-icap.conf .RS The main configuration file .RE .I @SYSCONFDIR@/c-icap.magic .RS In this file defined the types of files and the groups of file types. .RE .I /var/run/c-icap.pid .RS By default c-icap writes its pid in this file. The path of this file can changed using the PidFile configuration parameter in the c-icap.conf file .RE .I /var/run/c-icap.ctl .RS The commands socket. This file used to send commands to the icap server from command line. For informations about implemented commands look below in the "Implemented commands" sub-section .SH NOTES .SS Implemented commands Currently the following commands are implemented: .IP "stop" .RS The c-icap will shutdown .RE .IP "reconfigure" .RS The service will reread the config file without the need to stop and restart the c-icap server. The services will be reinitialized .RE .IP "relog" .RS This command causes c-icap to close and reopen the log files. This is very useful for log rotation. .RE .PP Services and modules can define their own commands. .PP \fBExamples:\fR .IP "To reconfigure c-icap:" echo -n "reconfigure" > /var/run/c-icap.ctl .IP "To rotate access log:" mv /var/log/c-icap/access.log /var/log/c-icap/access.log.1 echo -n "relog" > /var/run/c-icap.ctl .RE .SS Lookup tables Lookup tables are simple read-only databases. A lookup table can defined in c-icap.conf file using the form: .RE type:path .RE where the \fBtype\fR is the type of lookup table and \fBpath\fR is the extra information required to use the table (e.g. file path). Currently the following lookup table types defined internally by c-icap: .IP file Simple text file databases. The database records are stored in text files in the form: .RS key[: value1, value2 ...] .RE .RS .IP "example path definition:" .RS file:/path/to/the/file.txt .RE .RE .IP hash Similar to file lookup tables but c-icap uses fast hashes for searching. .RS .IP "example path definition:" .RS hash:/path/to/the/file.txt .RE .RE .IP regex Similar to the file lookup tables but the keys are regular expressions in the form /regex/flags . For possible flags values please read 'Regex expressions' paragraph in this manual. .RS .IP "example regex lookup table data:" /^[a-m].*/i: group1 .br /^[n-z].*/i: group2 .RE .IP "example path definition:" .RS regex:/path/to/the/file.txt .RE .RE .SS Regex expressions The c-icap regex expressions have the form /regex_definition/flags where "flags" is one or more letters, its of them express a flag. .IP "Common flags" .RS g This flag forces the score multiplied by the number of regex expression matches. For example if the expression matches 5 times and the devined score value is 10 then the final score will be 50. .RE .RS i Do caseless matching .RE .RS m Match-any-character operators don't match a newline and ^$ operators does not match newlines within data .RE .IP "If the module compiled using the pcre library the following flags can be used" .RS s (PCRE_DOTALL) matches anything including NL .RE .RS x (PCRE_EXTENDED) Ignore whitespace and # comments .RE .RS A (PCRE_ANCHORED) Force pattern anchoring .RE .RS D (PCRE_DOLLAR_ENDONLY) $ not to match newline at end .RE .RS U (PCRE_UNGREEDY) Invert greediness of quantifiers .RE .RS X (PCRE_EXTRA) PCRE extra features .RE .RS u (PCRE_UTF8) Run in UTF-8 mode .RE .SS Runtime information Someone can retrieve runtime information using the \fBinfo\fR service. The information includes bytes received and transmited, active services, information about service usage and many other. The information provided in HTML and text format. .PP \fBExample:\fR .IP "Retrieve runtime information from command line:" .RS c-icap-client -i localhost -s "info?view=text" -req "a_url" .RE .SH SEE ALSO .BR c-icap-client "(8)" .BR c-icap-stretch "(8)" .BR c-icap-config "(8)" .BR c-icap-libicapapi-config "(8)" .BR c-icap-mkbdb "(8)" .SH BUGS Many... .SH AUTHOR Tsantilas Christos c_icap-0.4.2/docs/man/c-icap-libicapapi-config.8.in0000664000175000017500000000132212567550777016574 00000000000000.TH c-icap-libicapapi-config 8 "@PACKAGE_STRING@" .SH NAME c-icap-libicapapi-config - script to get information about c-icap library .SH SYNOPSIS .B c-icap-libicapapi-config [ .B --cflags ] [ .B --libs ] [ .B --version ] .SH DESCRIPTION .B c-icap-libicapapi-config is a script to get compile options must used to use c-icap library. .SH OPTIONS .IP --cflags print preprocessor and compiler flags should used to compile a c-icap service or module .IP --libs print linker flags should used to link with c-icap library .IP --version print the c-icap server version .SH SEE ALSO .BR c-icap "(8)" .BR c-icap-client "(8)" .BR c-icap-stretch "(8)" .BR c-icap-config "(8)" .BR c-icap-mkbdb "(8)" .SH AUTHOR Tsantilas Christos c_icap-0.4.2/docs/man/Makefile.in0000664000175000017500000004111712601747525013443 00000000000000# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = docs/man DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/autoconf.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man8dir = $(mandir)/man8 am__installdirs = "$(DESTDIR)$(man8dir)" NROFF = nroff MANS = $(man_MANS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BDB_ADD_FLAG = @BDB_ADD_FLAG@ BDB_ADD_LDADD = @BDB_ADD_LDADD@ BZLIB_ADD_FLAG = @BZLIB_ADD_FLAG@ BZLIB_ADD_LDADD = @BZLIB_ADD_LDADD@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CICAPLIB_VERSION = @CICAPLIB_VERSION@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ C_ICAP_HEX_VERSION = @C_ICAP_HEX_VERSION@ DEFINE_INT64 = @DEFINE_INT64@ DEFINE_INT8 = @DEFINE_INT8@ DEFINE_OFF_T = @DEFINE_OFF_T@ DEFINE_SIZE_OFF_T = @DEFINE_SIZE_OFF_T@ DEFINE_SIZE_T = @DEFINE_SIZE_T@ DEFINE_SIZE_VOID_P = @DEFINE_SIZE_VOID_P@ DEFINE_UINT64 = @DEFINE_UINT64@ DEFINE_UINT8 = @DEFINE_UINT8@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_ADD_FLAG = @DL_ADD_FLAG@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTTYPES_H = @INTTYPES_H@ INVISIBILITY_CFLAG = @INVISIBILITY_CFLAG@ LD = @LD@ LDAP_ADD_FLAG = @LDAP_ADD_FLAG@ LDAP_ADD_LDADD = @LDAP_ADD_LDADD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MEMCACHED_CFLAGS = @MEMCACHED_CFLAGS@ MEMCACHED_LDFLAGS = @MEMCACHED_LDFLAGS@ MKDIR_P = @MKDIR_P@ MODULES_CFLAGS = @MODULES_CFLAGS@ MODULES_LIBADD = @MODULES_LIBADD@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_ADD_FLAG = @PCRE_ADD_FLAG@ PCRE_ADD_LDADD = @PCRE_ADD_LDADD@ POSIX_FILE_LOCK = @POSIX_FILE_LOCK@ POSIX_MAPPED_FILES = @POSIX_MAPPED_FILES@ POSIX_SEMAPHORES = @POSIX_SEMAPHORES@ POSIX_SHARED_MEM = @POSIX_SHARED_MEM@ PTHREADS_RWLOCK = @PTHREADS_RWLOCK@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SYSV_IPC = @SYSV_IPC@ SYS_TYPES_H = @SYS_TYPES_H@ THREADS_LDADD = @THREADS_LDADD@ THREADS_LDFLAGS = @THREADS_LDFLAGS@ USE_COMPAT = @USE_COMPAT@ USE_IPV6 = @USE_IPV6@ USE_REGEX = @USE_REGEX@ VERSION = @VERSION@ VISIBILITY_ATTR = @VISIBILITY_ATTR@ ZLIB_ADD_FLAG = @ZLIB_ADD_FLAG@ ZLIB_ADD_LDADD = @ZLIB_ADD_LDADD@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_bin = @doxygen_bin@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ has_doxygen = @has_doxygen@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ perlccflags = @perlccflags@ perlcore = @perlcore@ perlldflags = @perlldflags@ perllib = @perllib@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ CONFIGDIR = @sysconfdir@ PKGLIBDIR = @pkglibdir@ MODULESDIR = $(pkglibdir)/ SERVICESDIR = $(pkglibdir)/ LOGDIR = $(localstatedir)/log/ SOCKDIR = /var/run/c-icap do_subst = sed -e 's%[@]SYSCONFDIR[@]%$(CONFIGDIR)%g' \ -e 's%[@]PACKAGE_STRING[@]%$(PACKAGE_STRING)%g' manpages = c-icap.8 c-icap-client.8 c-icap-config.8 c-icap-libicapapi-config.8 \ c-icap-stretch.8 c-icap-mkbdb.8 manpages_src = $(manpages:.8=.8.in) CLEANFILES = $(manpages) SUFFIXES = .8.in .8 man_MANS = $(manpages) EXTRA_DIST = $(manpages_src) all: all-am .SUFFIXES: .SUFFIXES: .8.in .8 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu docs/man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu docs/man/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-man8: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man8dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man8dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man8dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.8[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ done; } uninstall-man8: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man8dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.8[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) installdirs: for dir in "$(DESTDIR)$(man8dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man8 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man8 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-man8 install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags-am uninstall uninstall-am uninstall-man \ uninstall-man8 .8.in.8: $(do_subst) < $< > $@ # 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: c_icap-0.4.2/docs/man/c-icap-client.8.in0000664000175000017500000000367612567550777014530 00000000000000.TH c-icap-client 8 "@PACKAGE_STRING@" .SH NAME c-icap-client - simple ICAP client .SH SYNOPSIS .B c-icap-client [ .B \-i "icap_servername" ] [ .B \-p "port" ] [ .B \-s "service" ] [ .B \-f "input_file" ] [ .B \-o "out_file" ] [ .B \-req "url" ] [ .B \-resp "url" ] [ .B \-d "debug level" ] [ .B \-noreshdr ] [ .B \-nopreview ] [ .B \-no204 ] [ .B \-206 ] [ .B \-x "icap-header" ] [ .B \-hx "http-request-header" ] [ .B \-rhx "http-response-header" ] [ .B \-w preview_size ] [ .B \-v ] .SH DESCRIPTION .B c-icap-client is a simple ICAP client. It can be used to test your icap server configuration. .SH OPTIONS .IP "-i icap_servername" The hostname of the icap server. The default is localhost .IP "-p port" The server port. The default port value is 1344 .IP "-s service" The service name. The default service name is "echo" .IP "-f filename" Send this file to the icap server. Default is to send an options request .IP "-o filename" Save output to this file. Default is to send to stdout .IP "-req url" Send a request modification instead of response modification, using as http url the url provided with this option. .IP "-resp url" Send a response modification with http request headers, using as http url the url provided with this option. .IP "-d level" debug level info to stdout .IP "-noreshdr" Do not send reshdr headers .IP "-nopreview" Do not send preview request data .IP "-no204" Do not allow204 outside preview .IP "-206" Support 206 responses .IP "-x icap-header" Include the icap-header in icap request headers .IP "-hx http-request-header" Include the http-request-header in http request headers .IP "-rhx http-response-header" Include the http-response-header in http response headers .IP "-w preview" Sets the maximum preview data size to preview .IP "-v" Print response headers .SH SEE ALSO .BR c-icap "(8)" .BR c-icap-stretch "(8)" .BR c-icap-config "(8)" .BR c-icap-libicapapi-config "(8)" .BR c-icap-mkbdb "(8)" .SH BUGS Many... .SH AUTHOR Tsantilas Christos c_icap-0.4.2/docs/man/c-icap-mkbdb.8.in0000664000175000017500000000251612567550777014321 00000000000000.TH c-icap-mkbdb 8 "@PACKAGE_STRING@" .SH NAME c-icap-mkbdb - simple ICAP clientutility to create Berkeley DB lookup tables .SH SYNOPSIS .B c-icap-mkbdb [ .B \-d debug_level ] [ .B \-i file.txt ] [ .B \-o file.db ] [ .B \-t string|int|ip ] [ .B \-v string|int|ip ] [ .B \-\-dump ] .SH DESCRIPTION .B c-icap-mkbdb utility can be used to create Berkeley DB databases which can be used as lookup tables by the c-icap server. .SH OPTIONS .IP "-d debug_level" The debug level .IP "-i file.txt" The file contains the data (required). The line format of this file must be: .br .I "key: value1, value2, ...." .IP "-o file.db" The database to be created .IP "-t string|int|ip" The type of the key. Select .B "string" for string keys, .B "int" for integer keys or .B "ip" for using IP addresses as keys. The "string" is the default. .IP "-v string|int|ip" The type of the values. The "string" is the default. .IP "--dump" Do not update the database just dump it to the screen. .SH EXAMPLES .TP c-icap-mkbdb \-o keys \-i keys.txt It builds the .B keys Berkeley DB database, using string type for keys and values. .TP c-icap-mkbdb \-o keys \-\-dump Dump the contents of the keys database .SH SEE ALSO .BR c-icap "(8)" .BR c-icap-client "(8)" .BR c-icap-stretch "(8)" .BR c-icap-config "(8)" .BR c-icap-libicapapi-config "(8)" .SH AUTHOR Tsantilas Christos c_icap-0.4.2/Makefile.in0000664000175000017500000033065112601747525011744 00000000000000# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ bin_PROGRAMS = c-icap$(EXEEXT) @USE_REGEX_TRUE@am__append_1 = regex.c subdir = . DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \ $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/configure $(am__configure_deps) \ $(srcdir)/autoconf.h.in $(top_srcdir)/include/c-icap-conf.h.in \ $(srcdir)/c-icap.conf.in depcomp $(pkginclude_HEADERS) COPYING \ TODO compile config.guess config.sub install-sh missing \ ltmain.sh ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = autoconf.h CONFIG_CLEAN_FILES = include/c-icap-conf.h c-icap.conf CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgincludedir)" LTLIBRARIES = $(lib_LTLIBRARIES) libicapapi_la_DEPENDENCIES = am__libicapapi_la_SOURCES_DIST = header.c body.c decode.c simple_api.c \ request_common.c filetype.c debug.c cfg_lib.c mem.c \ service_lib.c cache.c lookup_table.c lookup_file_table.c \ hash.c txt_format.c stats.c types_ops.c acl.c txtTemplate.c \ array.c registry.c md5.c net_io.c util.c os/unix/net_io.c \ os/unix/proc_mutex.c os/unix/shared_mem.c os/unix/threads.c \ os/unix/utilfunc.c os/unix/dlib.c regex.c am__dirstamp = $(am__leading_dot)dirstamp @USE_REGEX_TRUE@am__objects_1 = libicapapi_la-regex.lo am__objects_2 = libicapapi_la-net_io.lo libicapapi_la-util.lo \ os/unix/libicapapi_la-net_io.lo \ os/unix/libicapapi_la-proc_mutex.lo \ os/unix/libicapapi_la-shared_mem.lo \ os/unix/libicapapi_la-threads.lo \ os/unix/libicapapi_la-utilfunc.lo \ os/unix/libicapapi_la-dlib.lo $(am__objects_1) am_libicapapi_la_OBJECTS = libicapapi_la-header.lo \ libicapapi_la-body.lo libicapapi_la-decode.lo \ libicapapi_la-simple_api.lo libicapapi_la-request_common.lo \ libicapapi_la-filetype.lo libicapapi_la-debug.lo \ libicapapi_la-cfg_lib.lo libicapapi_la-mem.lo \ libicapapi_la-service_lib.lo libicapapi_la-cache.lo \ libicapapi_la-lookup_table.lo \ libicapapi_la-lookup_file_table.lo libicapapi_la-hash.lo \ libicapapi_la-txt_format.lo libicapapi_la-stats.lo \ libicapapi_la-types_ops.lo libicapapi_la-acl.lo \ libicapapi_la-txtTemplate.lo libicapapi_la-array.lo \ libicapapi_la-registry.lo libicapapi_la-md5.lo \ $(am__objects_2) libicapapi_la_OBJECTS = $(am_libicapapi_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libicapapi_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libicapapi_la_CFLAGS) \ $(CFLAGS) $(libicapapi_la_LDFLAGS) $(LDFLAGS) -o $@ PROGRAMS = $(bin_PROGRAMS) am__objects_3 = os/unix/c_icap-proc_utils.$(OBJEXT) am_c_icap_OBJECTS = c_icap-aserver.$(OBJEXT) c_icap-request.$(OBJEXT) \ c_icap-cfg_param.$(OBJEXT) \ c_icap-proc_threads_queues.$(OBJEXT) \ c_icap-http_auth.$(OBJEXT) c_icap-access.$(OBJEXT) \ c_icap-log.$(OBJEXT) c_icap-service.$(OBJEXT) \ c_icap-module.$(OBJEXT) c_icap-commands.$(OBJEXT) \ c_icap-mpmt_server.$(OBJEXT) c_icap-dlib.$(OBJEXT) \ c_icap-info.$(OBJEXT) c_icap-default_acl.$(OBJEXT) \ $(am__objects_3) c_icap_OBJECTS = $(am_c_icap_OBJECTS) c_icap_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(c_icap_CFLAGS) $(CFLAGS) \ $(c_icap_LDFLAGS) $(LDFLAGS) -o $@ SCRIPTS = $(bin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libicapapi_la_SOURCES) $(c_icap_SOURCES) DIST_SOURCES = $(am__libicapapi_la_SOURCES_DIST) $(c_icap_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(pkginclude_HEADERS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ $(LISP)autoconf.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best DIST_TARGETS = dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BDB_ADD_FLAG = @BDB_ADD_FLAG@ BDB_ADD_LDADD = @BDB_ADD_LDADD@ BZLIB_ADD_FLAG = @BZLIB_ADD_FLAG@ BZLIB_ADD_LDADD = @BZLIB_ADD_LDADD@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CICAPLIB_VERSION = @CICAPLIB_VERSION@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ C_ICAP_HEX_VERSION = @C_ICAP_HEX_VERSION@ DEFINE_INT64 = @DEFINE_INT64@ DEFINE_INT8 = @DEFINE_INT8@ DEFINE_OFF_T = @DEFINE_OFF_T@ DEFINE_SIZE_OFF_T = @DEFINE_SIZE_OFF_T@ DEFINE_SIZE_T = @DEFINE_SIZE_T@ DEFINE_SIZE_VOID_P = @DEFINE_SIZE_VOID_P@ DEFINE_UINT64 = @DEFINE_UINT64@ DEFINE_UINT8 = @DEFINE_UINT8@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_ADD_FLAG = @DL_ADD_FLAG@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTTYPES_H = @INTTYPES_H@ INVISIBILITY_CFLAG = @INVISIBILITY_CFLAG@ LD = @LD@ LDAP_ADD_FLAG = @LDAP_ADD_FLAG@ LDAP_ADD_LDADD = @LDAP_ADD_LDADD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MEMCACHED_CFLAGS = @MEMCACHED_CFLAGS@ MEMCACHED_LDFLAGS = @MEMCACHED_LDFLAGS@ MKDIR_P = @MKDIR_P@ MODULES_CFLAGS = @MODULES_CFLAGS@ MODULES_LIBADD = @MODULES_LIBADD@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_ADD_FLAG = @PCRE_ADD_FLAG@ PCRE_ADD_LDADD = @PCRE_ADD_LDADD@ POSIX_FILE_LOCK = @POSIX_FILE_LOCK@ POSIX_MAPPED_FILES = @POSIX_MAPPED_FILES@ POSIX_SEMAPHORES = @POSIX_SEMAPHORES@ POSIX_SHARED_MEM = @POSIX_SHARED_MEM@ PTHREADS_RWLOCK = @PTHREADS_RWLOCK@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SYSV_IPC = @SYSV_IPC@ SYS_TYPES_H = @SYS_TYPES_H@ THREADS_LDADD = @THREADS_LDADD@ THREADS_LDFLAGS = @THREADS_LDFLAGS@ USE_COMPAT = @USE_COMPAT@ USE_IPV6 = @USE_IPV6@ USE_REGEX = @USE_REGEX@ VERSION = @VERSION@ VISIBILITY_ATTR = @VISIBILITY_ATTR@ ZLIB_ADD_FLAG = @ZLIB_ADD_FLAG@ ZLIB_ADD_LDADD = @ZLIB_ADD_LDADD@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_bin = @doxygen_bin@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ has_doxygen = @has_doxygen@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ perlccflags = @perlccflags@ perlcore = @perlcore@ perlldflags = @perlldflags@ perllib = @perllib@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ CONFIGDIR = @sysconfdir@ PKGLIBDIR = @pkglibdir@ MODULESDIR = $(pkglibdir)/ SERVICESDIR = $(pkglibdir)/ #CONFIGDIR=$(sysconfdir)/ DATADIR = $(pkgdatadir)/ LOGDIR = $(localstatedir)/log/ SOCKDIR = /var/run/c-icap DOXYGEN = @doxygen_bin@ SUBDIRS = . utils modules services tests docs lib_LTLIBRARIES = libicapapi.la bin_SCRIPTS = c-icap-config c-icap-libicapapi-config UTIL_LIB_SOURCES = net_io.c util.c os/unix/net_io.c \ os/unix/proc_mutex.c os/unix/shared_mem.c os/unix/threads.c \ os/unix/utilfunc.c os/unix/dlib.c $(am__append_1) UTIL_SOURCES = os/unix/proc_utils.c libicapapi_la_SOURCES = header.c body.c decode.c simple_api.c request_common.c \ filetype.c debug.c cfg_lib.c mem.c service_lib.c \ cache.c lookup_table.c lookup_file_table.c hash.c \ txt_format.c stats.c types_ops.c acl.c txtTemplate.c \ array.c registry.c md5.c $(UTIL_LIB_SOURCES) c_icap_SOURCES = aserver.c request.c cfg_param.c \ proc_threads_queues.c http_auth.c \ access.c log.c service.c module.c \ commands.c mpmt_server.c dlib.c info.c default_acl.c $(UTIL_SOURCES) # libicapapi ...... libicapapi_la_CFLAGS = $(INVISIBILITY_CFLAG) -Iinclude/ @ZLIB_ADD_FLAG@ @BZLIB_ADD_FLAG@ @PCRE_ADD_FLAG@ -DCI_BUILD_LIB libicapapi_la_LIBADD = @ZLIB_ADD_LDADD@ @BZLIB_ADD_LDADD@ @PCRE_ADD_LDADD@ @DL_ADD_FLAG@ @THREADS_LDADD@ libicapapi_la_LDFLAGS = -shared -version-info @CICAPLIB_VERSION@ @THREADS_LDFLAGS@ #c_icap the main server c_icap_DEPENDENCIES = libicapapi.la c_icap_CFLAGS = $(INVISIBILITY_CFLAG) -Iinclude/ \ -DCONFDIR=\"$(CONFIGDIR)\" -DMODSDIR=\"$(MODULESDIR)\" \ -DSERVDIR=\"$(SERVICESDIR)\" -DLOGDIR=\"$(LOGDIR)\" \ -DDATADIR=\"$(DATADIR)\" c_icap_LDADD = libicapapi.la @DL_ADD_FLAG@ @THREADS_LDADD@ c_icap_LDFLAGS = -rdynamic -rpath @libdir@ @THREADS_LDFLAGS@ EXT_PROGRAMS_MKLIB = -licapapi INCS = access.h body.h cfg_param.h c-icap-conf.h c-icap.h ci_threads.h \ commands.h debug.h dlib.h filetype.h header.h log.h mem.h module.h \ net_io.h proc_mutex.h proc_threads_queues.h request.h service.h \ shared_mem.h simple_api.h util.h lookup_table.h hash.h stats.h acl.h \ cache.h txt_format.h types_ops.h txtTemplate.h array.h registry.h \ md5.h ci_regex.h ALL_INCS = $(INCS:%.h=include/%.h) pkginclude_HEADERS = $(ALL_INCS) #sysconf_DATA = c-icap.conf c-icap.magic do_subst = sed -e 's%[@]SYSCONFDIR[@]%$(CONFIGDIR)%g' \ -e 's%[@]PACKAGE_VERSION[@]%$(PACKAGE_VERSION)%g' \ -e 's%[@]PACKAGE[@]%$(PACKAGE)%g' \ -e 's%[@]prefix[@]%$(prefix)%g' \ -e 's%[@]LIBDIR[@]%$(libdir)%g' \ -e 's%[@]PKGINCLUDEDIR[@]%$(pkgincludedir)%g' \ -e 's%[@]INCLUDEDIR[@]%$(includedir)%g' \ -e 's%[@]PKGLIBDIR[@]%$(pkglibdir)%g' \ -e 's%[@]PKGDATADIR[@]%$(pkgdatadir)%g' \ -e 's%[@]CFLAGS[@]%$(CFLAGS)%g' \ -e 's%[@]MODULES_LIBADD[@]%$(MODULES_LIBADD)%g' \ -e 's%[@]MODULES_CFLAGS[@]%$(MODULES_CFLAGS)%g' \ -e 's%[@]EXT_PROGRAMS_LIBADD[@]%$(EXT_PROGRAMS_MKLIB)%g' \ -e 's%[@]SOCKDIR[@]%$(SOCKDIR)%g' CLEANFILES = c-icap-config c-icap-libicapapi-config EXTRA_DIST = RECONF config-w32.h makefile.w32 c-icap.conf \ c_icap_dll.mak c-icap.conf.in c-icap.magic c_icap.mak c_icap.def \ contrib/get_file.pl contrib/convert_old_magic.pl \ winnt_server.c os/win32/dll_entry.c os/win32/makefile.w32 \ os/win32/net_io.c os/win32/proc_mutex.c \ os/win32/shared_mem.c os/win32/threads.c os/win32/utilfunc.c \ common.h \ c-icap-config.in c-icap-libicapapi-config.in c-icap.dox \ build/c_icap_version.awk all: autoconf.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: .SUFFIXES: .c .lo .o .obj am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): autoconf.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/autoconf.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status autoconf.h $(srcdir)/autoconf.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f autoconf.h stamp-h1 include/c-icap-conf.h: $(top_builddir)/config.status $(top_srcdir)/include/c-icap-conf.h.in cd $(top_builddir) && $(SHELL) ./config.status $@ c-icap.conf: $(top_builddir)/config.status $(srcdir)/c-icap.conf.in cd $(top_builddir) && $(SHELL) ./config.status $@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } os/unix/$(am__dirstamp): @$(MKDIR_P) os/unix @: > os/unix/$(am__dirstamp) os/unix/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) os/unix/$(DEPDIR) @: > os/unix/$(DEPDIR)/$(am__dirstamp) os/unix/libicapapi_la-net_io.lo: os/unix/$(am__dirstamp) \ os/unix/$(DEPDIR)/$(am__dirstamp) os/unix/libicapapi_la-proc_mutex.lo: os/unix/$(am__dirstamp) \ os/unix/$(DEPDIR)/$(am__dirstamp) os/unix/libicapapi_la-shared_mem.lo: os/unix/$(am__dirstamp) \ os/unix/$(DEPDIR)/$(am__dirstamp) os/unix/libicapapi_la-threads.lo: os/unix/$(am__dirstamp) \ os/unix/$(DEPDIR)/$(am__dirstamp) os/unix/libicapapi_la-utilfunc.lo: os/unix/$(am__dirstamp) \ os/unix/$(DEPDIR)/$(am__dirstamp) os/unix/libicapapi_la-dlib.lo: os/unix/$(am__dirstamp) \ os/unix/$(DEPDIR)/$(am__dirstamp) libicapapi.la: $(libicapapi_la_OBJECTS) $(libicapapi_la_DEPENDENCIES) $(EXTRA_libicapapi_la_DEPENDENCIES) $(AM_V_CCLD)$(libicapapi_la_LINK) -rpath $(libdir) $(libicapapi_la_OBJECTS) $(libicapapi_la_LIBADD) $(LIBS) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list os/unix/c_icap-proc_utils.$(OBJEXT): os/unix/$(am__dirstamp) \ os/unix/$(DEPDIR)/$(am__dirstamp) c-icap$(EXEEXT): $(c_icap_OBJECTS) $(c_icap_DEPENDENCIES) $(EXTRA_c_icap_DEPENDENCIES) @rm -f c-icap$(EXEEXT) $(AM_V_CCLD)$(c_icap_LINK) $(c_icap_OBJECTS) $(c_icap_LDADD) $(LIBS) install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f os/unix/*.$(OBJEXT) -rm -f os/unix/*.lo distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_icap-access.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_icap-aserver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_icap-cfg_param.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_icap-commands.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_icap-default_acl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_icap-dlib.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_icap-http_auth.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_icap-info.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_icap-log.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_icap-module.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_icap-mpmt_server.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_icap-proc_threads_queues.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_icap-request.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c_icap-service.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-acl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-array.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-body.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-cache.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-cfg_lib.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-debug.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-decode.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-filetype.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-hash.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-header.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-lookup_file_table.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-lookup_table.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-md5.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-mem.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-net_io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-regex.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-registry.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-request_common.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-service_lib.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-simple_api.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-stats.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-txtTemplate.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-txt_format.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-types_ops.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libicapapi_la-util.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@os/unix/$(DEPDIR)/c_icap-proc_utils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@os/unix/$(DEPDIR)/libicapapi_la-dlib.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@os/unix/$(DEPDIR)/libicapapi_la-net_io.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@os/unix/$(DEPDIR)/libicapapi_la-proc_mutex.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@os/unix/$(DEPDIR)/libicapapi_la-shared_mem.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@os/unix/$(DEPDIR)/libicapapi_la-threads.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@os/unix/$(DEPDIR)/libicapapi_la-utilfunc.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< libicapapi_la-header.lo: header.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-header.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-header.Tpo -c -o libicapapi_la-header.lo `test -f 'header.c' || echo '$(srcdir)/'`header.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-header.Tpo $(DEPDIR)/libicapapi_la-header.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='header.c' object='libicapapi_la-header.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-header.lo `test -f 'header.c' || echo '$(srcdir)/'`header.c libicapapi_la-body.lo: body.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-body.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-body.Tpo -c -o libicapapi_la-body.lo `test -f 'body.c' || echo '$(srcdir)/'`body.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-body.Tpo $(DEPDIR)/libicapapi_la-body.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='body.c' object='libicapapi_la-body.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-body.lo `test -f 'body.c' || echo '$(srcdir)/'`body.c libicapapi_la-decode.lo: decode.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-decode.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-decode.Tpo -c -o libicapapi_la-decode.lo `test -f 'decode.c' || echo '$(srcdir)/'`decode.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-decode.Tpo $(DEPDIR)/libicapapi_la-decode.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='decode.c' object='libicapapi_la-decode.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-decode.lo `test -f 'decode.c' || echo '$(srcdir)/'`decode.c libicapapi_la-simple_api.lo: simple_api.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-simple_api.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-simple_api.Tpo -c -o libicapapi_la-simple_api.lo `test -f 'simple_api.c' || echo '$(srcdir)/'`simple_api.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-simple_api.Tpo $(DEPDIR)/libicapapi_la-simple_api.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='simple_api.c' object='libicapapi_la-simple_api.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-simple_api.lo `test -f 'simple_api.c' || echo '$(srcdir)/'`simple_api.c libicapapi_la-request_common.lo: request_common.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-request_common.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-request_common.Tpo -c -o libicapapi_la-request_common.lo `test -f 'request_common.c' || echo '$(srcdir)/'`request_common.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-request_common.Tpo $(DEPDIR)/libicapapi_la-request_common.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='request_common.c' object='libicapapi_la-request_common.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-request_common.lo `test -f 'request_common.c' || echo '$(srcdir)/'`request_common.c libicapapi_la-filetype.lo: filetype.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-filetype.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-filetype.Tpo -c -o libicapapi_la-filetype.lo `test -f 'filetype.c' || echo '$(srcdir)/'`filetype.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-filetype.Tpo $(DEPDIR)/libicapapi_la-filetype.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filetype.c' object='libicapapi_la-filetype.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-filetype.lo `test -f 'filetype.c' || echo '$(srcdir)/'`filetype.c libicapapi_la-debug.lo: debug.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-debug.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-debug.Tpo -c -o libicapapi_la-debug.lo `test -f 'debug.c' || echo '$(srcdir)/'`debug.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-debug.Tpo $(DEPDIR)/libicapapi_la-debug.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='debug.c' object='libicapapi_la-debug.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-debug.lo `test -f 'debug.c' || echo '$(srcdir)/'`debug.c libicapapi_la-cfg_lib.lo: cfg_lib.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-cfg_lib.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-cfg_lib.Tpo -c -o libicapapi_la-cfg_lib.lo `test -f 'cfg_lib.c' || echo '$(srcdir)/'`cfg_lib.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-cfg_lib.Tpo $(DEPDIR)/libicapapi_la-cfg_lib.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cfg_lib.c' object='libicapapi_la-cfg_lib.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-cfg_lib.lo `test -f 'cfg_lib.c' || echo '$(srcdir)/'`cfg_lib.c libicapapi_la-mem.lo: mem.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-mem.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-mem.Tpo -c -o libicapapi_la-mem.lo `test -f 'mem.c' || echo '$(srcdir)/'`mem.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-mem.Tpo $(DEPDIR)/libicapapi_la-mem.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mem.c' object='libicapapi_la-mem.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-mem.lo `test -f 'mem.c' || echo '$(srcdir)/'`mem.c libicapapi_la-service_lib.lo: service_lib.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-service_lib.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-service_lib.Tpo -c -o libicapapi_la-service_lib.lo `test -f 'service_lib.c' || echo '$(srcdir)/'`service_lib.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-service_lib.Tpo $(DEPDIR)/libicapapi_la-service_lib.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='service_lib.c' object='libicapapi_la-service_lib.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-service_lib.lo `test -f 'service_lib.c' || echo '$(srcdir)/'`service_lib.c libicapapi_la-cache.lo: cache.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-cache.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-cache.Tpo -c -o libicapapi_la-cache.lo `test -f 'cache.c' || echo '$(srcdir)/'`cache.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-cache.Tpo $(DEPDIR)/libicapapi_la-cache.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cache.c' object='libicapapi_la-cache.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-cache.lo `test -f 'cache.c' || echo '$(srcdir)/'`cache.c libicapapi_la-lookup_table.lo: lookup_table.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-lookup_table.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-lookup_table.Tpo -c -o libicapapi_la-lookup_table.lo `test -f 'lookup_table.c' || echo '$(srcdir)/'`lookup_table.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-lookup_table.Tpo $(DEPDIR)/libicapapi_la-lookup_table.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='lookup_table.c' object='libicapapi_la-lookup_table.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-lookup_table.lo `test -f 'lookup_table.c' || echo '$(srcdir)/'`lookup_table.c libicapapi_la-lookup_file_table.lo: lookup_file_table.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-lookup_file_table.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-lookup_file_table.Tpo -c -o libicapapi_la-lookup_file_table.lo `test -f 'lookup_file_table.c' || echo '$(srcdir)/'`lookup_file_table.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-lookup_file_table.Tpo $(DEPDIR)/libicapapi_la-lookup_file_table.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='lookup_file_table.c' object='libicapapi_la-lookup_file_table.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-lookup_file_table.lo `test -f 'lookup_file_table.c' || echo '$(srcdir)/'`lookup_file_table.c libicapapi_la-hash.lo: hash.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-hash.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-hash.Tpo -c -o libicapapi_la-hash.lo `test -f 'hash.c' || echo '$(srcdir)/'`hash.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-hash.Tpo $(DEPDIR)/libicapapi_la-hash.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hash.c' object='libicapapi_la-hash.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-hash.lo `test -f 'hash.c' || echo '$(srcdir)/'`hash.c libicapapi_la-txt_format.lo: txt_format.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-txt_format.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-txt_format.Tpo -c -o libicapapi_la-txt_format.lo `test -f 'txt_format.c' || echo '$(srcdir)/'`txt_format.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-txt_format.Tpo $(DEPDIR)/libicapapi_la-txt_format.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='txt_format.c' object='libicapapi_la-txt_format.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-txt_format.lo `test -f 'txt_format.c' || echo '$(srcdir)/'`txt_format.c libicapapi_la-stats.lo: stats.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-stats.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-stats.Tpo -c -o libicapapi_la-stats.lo `test -f 'stats.c' || echo '$(srcdir)/'`stats.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-stats.Tpo $(DEPDIR)/libicapapi_la-stats.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='stats.c' object='libicapapi_la-stats.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-stats.lo `test -f 'stats.c' || echo '$(srcdir)/'`stats.c libicapapi_la-types_ops.lo: types_ops.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-types_ops.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-types_ops.Tpo -c -o libicapapi_la-types_ops.lo `test -f 'types_ops.c' || echo '$(srcdir)/'`types_ops.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-types_ops.Tpo $(DEPDIR)/libicapapi_la-types_ops.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='types_ops.c' object='libicapapi_la-types_ops.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-types_ops.lo `test -f 'types_ops.c' || echo '$(srcdir)/'`types_ops.c libicapapi_la-acl.lo: acl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-acl.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-acl.Tpo -c -o libicapapi_la-acl.lo `test -f 'acl.c' || echo '$(srcdir)/'`acl.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-acl.Tpo $(DEPDIR)/libicapapi_la-acl.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='acl.c' object='libicapapi_la-acl.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-acl.lo `test -f 'acl.c' || echo '$(srcdir)/'`acl.c libicapapi_la-txtTemplate.lo: txtTemplate.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-txtTemplate.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-txtTemplate.Tpo -c -o libicapapi_la-txtTemplate.lo `test -f 'txtTemplate.c' || echo '$(srcdir)/'`txtTemplate.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-txtTemplate.Tpo $(DEPDIR)/libicapapi_la-txtTemplate.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='txtTemplate.c' object='libicapapi_la-txtTemplate.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-txtTemplate.lo `test -f 'txtTemplate.c' || echo '$(srcdir)/'`txtTemplate.c libicapapi_la-array.lo: array.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-array.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-array.Tpo -c -o libicapapi_la-array.lo `test -f 'array.c' || echo '$(srcdir)/'`array.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-array.Tpo $(DEPDIR)/libicapapi_la-array.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='array.c' object='libicapapi_la-array.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-array.lo `test -f 'array.c' || echo '$(srcdir)/'`array.c libicapapi_la-registry.lo: registry.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-registry.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-registry.Tpo -c -o libicapapi_la-registry.lo `test -f 'registry.c' || echo '$(srcdir)/'`registry.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-registry.Tpo $(DEPDIR)/libicapapi_la-registry.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='registry.c' object='libicapapi_la-registry.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-registry.lo `test -f 'registry.c' || echo '$(srcdir)/'`registry.c libicapapi_la-md5.lo: md5.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-md5.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-md5.Tpo -c -o libicapapi_la-md5.lo `test -f 'md5.c' || echo '$(srcdir)/'`md5.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-md5.Tpo $(DEPDIR)/libicapapi_la-md5.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='md5.c' object='libicapapi_la-md5.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-md5.lo `test -f 'md5.c' || echo '$(srcdir)/'`md5.c libicapapi_la-net_io.lo: net_io.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-net_io.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-net_io.Tpo -c -o libicapapi_la-net_io.lo `test -f 'net_io.c' || echo '$(srcdir)/'`net_io.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-net_io.Tpo $(DEPDIR)/libicapapi_la-net_io.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='net_io.c' object='libicapapi_la-net_io.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-net_io.lo `test -f 'net_io.c' || echo '$(srcdir)/'`net_io.c libicapapi_la-util.lo: util.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-util.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-util.Tpo -c -o libicapapi_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-util.Tpo $(DEPDIR)/libicapapi_la-util.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util.c' object='libicapapi_la-util.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-util.lo `test -f 'util.c' || echo '$(srcdir)/'`util.c os/unix/libicapapi_la-net_io.lo: os/unix/net_io.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT os/unix/libicapapi_la-net_io.lo -MD -MP -MF os/unix/$(DEPDIR)/libicapapi_la-net_io.Tpo -c -o os/unix/libicapapi_la-net_io.lo `test -f 'os/unix/net_io.c' || echo '$(srcdir)/'`os/unix/net_io.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) os/unix/$(DEPDIR)/libicapapi_la-net_io.Tpo os/unix/$(DEPDIR)/libicapapi_la-net_io.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='os/unix/net_io.c' object='os/unix/libicapapi_la-net_io.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o os/unix/libicapapi_la-net_io.lo `test -f 'os/unix/net_io.c' || echo '$(srcdir)/'`os/unix/net_io.c os/unix/libicapapi_la-proc_mutex.lo: os/unix/proc_mutex.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT os/unix/libicapapi_la-proc_mutex.lo -MD -MP -MF os/unix/$(DEPDIR)/libicapapi_la-proc_mutex.Tpo -c -o os/unix/libicapapi_la-proc_mutex.lo `test -f 'os/unix/proc_mutex.c' || echo '$(srcdir)/'`os/unix/proc_mutex.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) os/unix/$(DEPDIR)/libicapapi_la-proc_mutex.Tpo os/unix/$(DEPDIR)/libicapapi_la-proc_mutex.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='os/unix/proc_mutex.c' object='os/unix/libicapapi_la-proc_mutex.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o os/unix/libicapapi_la-proc_mutex.lo `test -f 'os/unix/proc_mutex.c' || echo '$(srcdir)/'`os/unix/proc_mutex.c os/unix/libicapapi_la-shared_mem.lo: os/unix/shared_mem.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT os/unix/libicapapi_la-shared_mem.lo -MD -MP -MF os/unix/$(DEPDIR)/libicapapi_la-shared_mem.Tpo -c -o os/unix/libicapapi_la-shared_mem.lo `test -f 'os/unix/shared_mem.c' || echo '$(srcdir)/'`os/unix/shared_mem.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) os/unix/$(DEPDIR)/libicapapi_la-shared_mem.Tpo os/unix/$(DEPDIR)/libicapapi_la-shared_mem.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='os/unix/shared_mem.c' object='os/unix/libicapapi_la-shared_mem.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o os/unix/libicapapi_la-shared_mem.lo `test -f 'os/unix/shared_mem.c' || echo '$(srcdir)/'`os/unix/shared_mem.c os/unix/libicapapi_la-threads.lo: os/unix/threads.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT os/unix/libicapapi_la-threads.lo -MD -MP -MF os/unix/$(DEPDIR)/libicapapi_la-threads.Tpo -c -o os/unix/libicapapi_la-threads.lo `test -f 'os/unix/threads.c' || echo '$(srcdir)/'`os/unix/threads.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) os/unix/$(DEPDIR)/libicapapi_la-threads.Tpo os/unix/$(DEPDIR)/libicapapi_la-threads.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='os/unix/threads.c' object='os/unix/libicapapi_la-threads.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o os/unix/libicapapi_la-threads.lo `test -f 'os/unix/threads.c' || echo '$(srcdir)/'`os/unix/threads.c os/unix/libicapapi_la-utilfunc.lo: os/unix/utilfunc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT os/unix/libicapapi_la-utilfunc.lo -MD -MP -MF os/unix/$(DEPDIR)/libicapapi_la-utilfunc.Tpo -c -o os/unix/libicapapi_la-utilfunc.lo `test -f 'os/unix/utilfunc.c' || echo '$(srcdir)/'`os/unix/utilfunc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) os/unix/$(DEPDIR)/libicapapi_la-utilfunc.Tpo os/unix/$(DEPDIR)/libicapapi_la-utilfunc.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='os/unix/utilfunc.c' object='os/unix/libicapapi_la-utilfunc.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o os/unix/libicapapi_la-utilfunc.lo `test -f 'os/unix/utilfunc.c' || echo '$(srcdir)/'`os/unix/utilfunc.c os/unix/libicapapi_la-dlib.lo: os/unix/dlib.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT os/unix/libicapapi_la-dlib.lo -MD -MP -MF os/unix/$(DEPDIR)/libicapapi_la-dlib.Tpo -c -o os/unix/libicapapi_la-dlib.lo `test -f 'os/unix/dlib.c' || echo '$(srcdir)/'`os/unix/dlib.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) os/unix/$(DEPDIR)/libicapapi_la-dlib.Tpo os/unix/$(DEPDIR)/libicapapi_la-dlib.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='os/unix/dlib.c' object='os/unix/libicapapi_la-dlib.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o os/unix/libicapapi_la-dlib.lo `test -f 'os/unix/dlib.c' || echo '$(srcdir)/'`os/unix/dlib.c libicapapi_la-regex.lo: regex.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -MT libicapapi_la-regex.lo -MD -MP -MF $(DEPDIR)/libicapapi_la-regex.Tpo -c -o libicapapi_la-regex.lo `test -f 'regex.c' || echo '$(srcdir)/'`regex.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libicapapi_la-regex.Tpo $(DEPDIR)/libicapapi_la-regex.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='regex.c' object='libicapapi_la-regex.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libicapapi_la_CFLAGS) $(CFLAGS) -c -o libicapapi_la-regex.lo `test -f 'regex.c' || echo '$(srcdir)/'`regex.c c_icap-aserver.o: aserver.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-aserver.o -MD -MP -MF $(DEPDIR)/c_icap-aserver.Tpo -c -o c_icap-aserver.o `test -f 'aserver.c' || echo '$(srcdir)/'`aserver.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-aserver.Tpo $(DEPDIR)/c_icap-aserver.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='aserver.c' object='c_icap-aserver.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-aserver.o `test -f 'aserver.c' || echo '$(srcdir)/'`aserver.c c_icap-aserver.obj: aserver.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-aserver.obj -MD -MP -MF $(DEPDIR)/c_icap-aserver.Tpo -c -o c_icap-aserver.obj `if test -f 'aserver.c'; then $(CYGPATH_W) 'aserver.c'; else $(CYGPATH_W) '$(srcdir)/aserver.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-aserver.Tpo $(DEPDIR)/c_icap-aserver.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='aserver.c' object='c_icap-aserver.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-aserver.obj `if test -f 'aserver.c'; then $(CYGPATH_W) 'aserver.c'; else $(CYGPATH_W) '$(srcdir)/aserver.c'; fi` c_icap-request.o: request.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-request.o -MD -MP -MF $(DEPDIR)/c_icap-request.Tpo -c -o c_icap-request.o `test -f 'request.c' || echo '$(srcdir)/'`request.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-request.Tpo $(DEPDIR)/c_icap-request.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='request.c' object='c_icap-request.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-request.o `test -f 'request.c' || echo '$(srcdir)/'`request.c c_icap-request.obj: request.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-request.obj -MD -MP -MF $(DEPDIR)/c_icap-request.Tpo -c -o c_icap-request.obj `if test -f 'request.c'; then $(CYGPATH_W) 'request.c'; else $(CYGPATH_W) '$(srcdir)/request.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-request.Tpo $(DEPDIR)/c_icap-request.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='request.c' object='c_icap-request.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-request.obj `if test -f 'request.c'; then $(CYGPATH_W) 'request.c'; else $(CYGPATH_W) '$(srcdir)/request.c'; fi` c_icap-cfg_param.o: cfg_param.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-cfg_param.o -MD -MP -MF $(DEPDIR)/c_icap-cfg_param.Tpo -c -o c_icap-cfg_param.o `test -f 'cfg_param.c' || echo '$(srcdir)/'`cfg_param.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-cfg_param.Tpo $(DEPDIR)/c_icap-cfg_param.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cfg_param.c' object='c_icap-cfg_param.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-cfg_param.o `test -f 'cfg_param.c' || echo '$(srcdir)/'`cfg_param.c c_icap-cfg_param.obj: cfg_param.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-cfg_param.obj -MD -MP -MF $(DEPDIR)/c_icap-cfg_param.Tpo -c -o c_icap-cfg_param.obj `if test -f 'cfg_param.c'; then $(CYGPATH_W) 'cfg_param.c'; else $(CYGPATH_W) '$(srcdir)/cfg_param.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-cfg_param.Tpo $(DEPDIR)/c_icap-cfg_param.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cfg_param.c' object='c_icap-cfg_param.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-cfg_param.obj `if test -f 'cfg_param.c'; then $(CYGPATH_W) 'cfg_param.c'; else $(CYGPATH_W) '$(srcdir)/cfg_param.c'; fi` c_icap-proc_threads_queues.o: proc_threads_queues.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-proc_threads_queues.o -MD -MP -MF $(DEPDIR)/c_icap-proc_threads_queues.Tpo -c -o c_icap-proc_threads_queues.o `test -f 'proc_threads_queues.c' || echo '$(srcdir)/'`proc_threads_queues.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-proc_threads_queues.Tpo $(DEPDIR)/c_icap-proc_threads_queues.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='proc_threads_queues.c' object='c_icap-proc_threads_queues.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-proc_threads_queues.o `test -f 'proc_threads_queues.c' || echo '$(srcdir)/'`proc_threads_queues.c c_icap-proc_threads_queues.obj: proc_threads_queues.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-proc_threads_queues.obj -MD -MP -MF $(DEPDIR)/c_icap-proc_threads_queues.Tpo -c -o c_icap-proc_threads_queues.obj `if test -f 'proc_threads_queues.c'; then $(CYGPATH_W) 'proc_threads_queues.c'; else $(CYGPATH_W) '$(srcdir)/proc_threads_queues.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-proc_threads_queues.Tpo $(DEPDIR)/c_icap-proc_threads_queues.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='proc_threads_queues.c' object='c_icap-proc_threads_queues.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-proc_threads_queues.obj `if test -f 'proc_threads_queues.c'; then $(CYGPATH_W) 'proc_threads_queues.c'; else $(CYGPATH_W) '$(srcdir)/proc_threads_queues.c'; fi` c_icap-http_auth.o: http_auth.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-http_auth.o -MD -MP -MF $(DEPDIR)/c_icap-http_auth.Tpo -c -o c_icap-http_auth.o `test -f 'http_auth.c' || echo '$(srcdir)/'`http_auth.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-http_auth.Tpo $(DEPDIR)/c_icap-http_auth.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='http_auth.c' object='c_icap-http_auth.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-http_auth.o `test -f 'http_auth.c' || echo '$(srcdir)/'`http_auth.c c_icap-http_auth.obj: http_auth.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-http_auth.obj -MD -MP -MF $(DEPDIR)/c_icap-http_auth.Tpo -c -o c_icap-http_auth.obj `if test -f 'http_auth.c'; then $(CYGPATH_W) 'http_auth.c'; else $(CYGPATH_W) '$(srcdir)/http_auth.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-http_auth.Tpo $(DEPDIR)/c_icap-http_auth.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='http_auth.c' object='c_icap-http_auth.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-http_auth.obj `if test -f 'http_auth.c'; then $(CYGPATH_W) 'http_auth.c'; else $(CYGPATH_W) '$(srcdir)/http_auth.c'; fi` c_icap-access.o: access.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-access.o -MD -MP -MF $(DEPDIR)/c_icap-access.Tpo -c -o c_icap-access.o `test -f 'access.c' || echo '$(srcdir)/'`access.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-access.Tpo $(DEPDIR)/c_icap-access.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='access.c' object='c_icap-access.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-access.o `test -f 'access.c' || echo '$(srcdir)/'`access.c c_icap-access.obj: access.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-access.obj -MD -MP -MF $(DEPDIR)/c_icap-access.Tpo -c -o c_icap-access.obj `if test -f 'access.c'; then $(CYGPATH_W) 'access.c'; else $(CYGPATH_W) '$(srcdir)/access.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-access.Tpo $(DEPDIR)/c_icap-access.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='access.c' object='c_icap-access.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-access.obj `if test -f 'access.c'; then $(CYGPATH_W) 'access.c'; else $(CYGPATH_W) '$(srcdir)/access.c'; fi` c_icap-log.o: log.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-log.o -MD -MP -MF $(DEPDIR)/c_icap-log.Tpo -c -o c_icap-log.o `test -f 'log.c' || echo '$(srcdir)/'`log.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-log.Tpo $(DEPDIR)/c_icap-log.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='log.c' object='c_icap-log.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-log.o `test -f 'log.c' || echo '$(srcdir)/'`log.c c_icap-log.obj: log.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-log.obj -MD -MP -MF $(DEPDIR)/c_icap-log.Tpo -c -o c_icap-log.obj `if test -f 'log.c'; then $(CYGPATH_W) 'log.c'; else $(CYGPATH_W) '$(srcdir)/log.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-log.Tpo $(DEPDIR)/c_icap-log.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='log.c' object='c_icap-log.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-log.obj `if test -f 'log.c'; then $(CYGPATH_W) 'log.c'; else $(CYGPATH_W) '$(srcdir)/log.c'; fi` c_icap-service.o: service.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-service.o -MD -MP -MF $(DEPDIR)/c_icap-service.Tpo -c -o c_icap-service.o `test -f 'service.c' || echo '$(srcdir)/'`service.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-service.Tpo $(DEPDIR)/c_icap-service.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='service.c' object='c_icap-service.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-service.o `test -f 'service.c' || echo '$(srcdir)/'`service.c c_icap-service.obj: service.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-service.obj -MD -MP -MF $(DEPDIR)/c_icap-service.Tpo -c -o c_icap-service.obj `if test -f 'service.c'; then $(CYGPATH_W) 'service.c'; else $(CYGPATH_W) '$(srcdir)/service.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-service.Tpo $(DEPDIR)/c_icap-service.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='service.c' object='c_icap-service.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-service.obj `if test -f 'service.c'; then $(CYGPATH_W) 'service.c'; else $(CYGPATH_W) '$(srcdir)/service.c'; fi` c_icap-module.o: module.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-module.o -MD -MP -MF $(DEPDIR)/c_icap-module.Tpo -c -o c_icap-module.o `test -f 'module.c' || echo '$(srcdir)/'`module.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-module.Tpo $(DEPDIR)/c_icap-module.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='module.c' object='c_icap-module.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-module.o `test -f 'module.c' || echo '$(srcdir)/'`module.c c_icap-module.obj: module.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-module.obj -MD -MP -MF $(DEPDIR)/c_icap-module.Tpo -c -o c_icap-module.obj `if test -f 'module.c'; then $(CYGPATH_W) 'module.c'; else $(CYGPATH_W) '$(srcdir)/module.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-module.Tpo $(DEPDIR)/c_icap-module.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='module.c' object='c_icap-module.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-module.obj `if test -f 'module.c'; then $(CYGPATH_W) 'module.c'; else $(CYGPATH_W) '$(srcdir)/module.c'; fi` c_icap-commands.o: commands.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-commands.o -MD -MP -MF $(DEPDIR)/c_icap-commands.Tpo -c -o c_icap-commands.o `test -f 'commands.c' || echo '$(srcdir)/'`commands.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-commands.Tpo $(DEPDIR)/c_icap-commands.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='commands.c' object='c_icap-commands.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-commands.o `test -f 'commands.c' || echo '$(srcdir)/'`commands.c c_icap-commands.obj: commands.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-commands.obj -MD -MP -MF $(DEPDIR)/c_icap-commands.Tpo -c -o c_icap-commands.obj `if test -f 'commands.c'; then $(CYGPATH_W) 'commands.c'; else $(CYGPATH_W) '$(srcdir)/commands.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-commands.Tpo $(DEPDIR)/c_icap-commands.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='commands.c' object='c_icap-commands.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-commands.obj `if test -f 'commands.c'; then $(CYGPATH_W) 'commands.c'; else $(CYGPATH_W) '$(srcdir)/commands.c'; fi` c_icap-mpmt_server.o: mpmt_server.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-mpmt_server.o -MD -MP -MF $(DEPDIR)/c_icap-mpmt_server.Tpo -c -o c_icap-mpmt_server.o `test -f 'mpmt_server.c' || echo '$(srcdir)/'`mpmt_server.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-mpmt_server.Tpo $(DEPDIR)/c_icap-mpmt_server.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mpmt_server.c' object='c_icap-mpmt_server.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-mpmt_server.o `test -f 'mpmt_server.c' || echo '$(srcdir)/'`mpmt_server.c c_icap-mpmt_server.obj: mpmt_server.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-mpmt_server.obj -MD -MP -MF $(DEPDIR)/c_icap-mpmt_server.Tpo -c -o c_icap-mpmt_server.obj `if test -f 'mpmt_server.c'; then $(CYGPATH_W) 'mpmt_server.c'; else $(CYGPATH_W) '$(srcdir)/mpmt_server.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-mpmt_server.Tpo $(DEPDIR)/c_icap-mpmt_server.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mpmt_server.c' object='c_icap-mpmt_server.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-mpmt_server.obj `if test -f 'mpmt_server.c'; then $(CYGPATH_W) 'mpmt_server.c'; else $(CYGPATH_W) '$(srcdir)/mpmt_server.c'; fi` c_icap-dlib.o: dlib.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-dlib.o -MD -MP -MF $(DEPDIR)/c_icap-dlib.Tpo -c -o c_icap-dlib.o `test -f 'dlib.c' || echo '$(srcdir)/'`dlib.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-dlib.Tpo $(DEPDIR)/c_icap-dlib.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dlib.c' object='c_icap-dlib.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-dlib.o `test -f 'dlib.c' || echo '$(srcdir)/'`dlib.c c_icap-dlib.obj: dlib.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-dlib.obj -MD -MP -MF $(DEPDIR)/c_icap-dlib.Tpo -c -o c_icap-dlib.obj `if test -f 'dlib.c'; then $(CYGPATH_W) 'dlib.c'; else $(CYGPATH_W) '$(srcdir)/dlib.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-dlib.Tpo $(DEPDIR)/c_icap-dlib.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dlib.c' object='c_icap-dlib.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-dlib.obj `if test -f 'dlib.c'; then $(CYGPATH_W) 'dlib.c'; else $(CYGPATH_W) '$(srcdir)/dlib.c'; fi` c_icap-info.o: info.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-info.o -MD -MP -MF $(DEPDIR)/c_icap-info.Tpo -c -o c_icap-info.o `test -f 'info.c' || echo '$(srcdir)/'`info.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-info.Tpo $(DEPDIR)/c_icap-info.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='info.c' object='c_icap-info.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-info.o `test -f 'info.c' || echo '$(srcdir)/'`info.c c_icap-info.obj: info.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-info.obj -MD -MP -MF $(DEPDIR)/c_icap-info.Tpo -c -o c_icap-info.obj `if test -f 'info.c'; then $(CYGPATH_W) 'info.c'; else $(CYGPATH_W) '$(srcdir)/info.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-info.Tpo $(DEPDIR)/c_icap-info.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='info.c' object='c_icap-info.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-info.obj `if test -f 'info.c'; then $(CYGPATH_W) 'info.c'; else $(CYGPATH_W) '$(srcdir)/info.c'; fi` c_icap-default_acl.o: default_acl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-default_acl.o -MD -MP -MF $(DEPDIR)/c_icap-default_acl.Tpo -c -o c_icap-default_acl.o `test -f 'default_acl.c' || echo '$(srcdir)/'`default_acl.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-default_acl.Tpo $(DEPDIR)/c_icap-default_acl.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='default_acl.c' object='c_icap-default_acl.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-default_acl.o `test -f 'default_acl.c' || echo '$(srcdir)/'`default_acl.c c_icap-default_acl.obj: default_acl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT c_icap-default_acl.obj -MD -MP -MF $(DEPDIR)/c_icap-default_acl.Tpo -c -o c_icap-default_acl.obj `if test -f 'default_acl.c'; then $(CYGPATH_W) 'default_acl.c'; else $(CYGPATH_W) '$(srcdir)/default_acl.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/c_icap-default_acl.Tpo $(DEPDIR)/c_icap-default_acl.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='default_acl.c' object='c_icap-default_acl.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o c_icap-default_acl.obj `if test -f 'default_acl.c'; then $(CYGPATH_W) 'default_acl.c'; else $(CYGPATH_W) '$(srcdir)/default_acl.c'; fi` os/unix/c_icap-proc_utils.o: os/unix/proc_utils.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT os/unix/c_icap-proc_utils.o -MD -MP -MF os/unix/$(DEPDIR)/c_icap-proc_utils.Tpo -c -o os/unix/c_icap-proc_utils.o `test -f 'os/unix/proc_utils.c' || echo '$(srcdir)/'`os/unix/proc_utils.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) os/unix/$(DEPDIR)/c_icap-proc_utils.Tpo os/unix/$(DEPDIR)/c_icap-proc_utils.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='os/unix/proc_utils.c' object='os/unix/c_icap-proc_utils.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o os/unix/c_icap-proc_utils.o `test -f 'os/unix/proc_utils.c' || echo '$(srcdir)/'`os/unix/proc_utils.c os/unix/c_icap-proc_utils.obj: os/unix/proc_utils.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -MT os/unix/c_icap-proc_utils.obj -MD -MP -MF os/unix/$(DEPDIR)/c_icap-proc_utils.Tpo -c -o os/unix/c_icap-proc_utils.obj `if test -f 'os/unix/proc_utils.c'; then $(CYGPATH_W) 'os/unix/proc_utils.c'; else $(CYGPATH_W) '$(srcdir)/os/unix/proc_utils.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) os/unix/$(DEPDIR)/c_icap-proc_utils.Tpo os/unix/$(DEPDIR)/c_icap-proc_utils.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='os/unix/proc_utils.c' object='os/unix/c_icap-proc_utils.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(c_icap_CFLAGS) $(CFLAGS) -c -o os/unix/c_icap-proc_utils.obj `if test -f 'os/unix/proc_utils.c'; then $(CYGPATH_W) 'os/unix/proc_utils.c'; else $(CYGPATH_W) '$(srcdir)/os/unix/proc_utils.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs -rm -rf os/unix/.libs os/unix/_libs distclean-libtool: -rm -f libtool config.lt install-pkgincludeHEADERS: $(pkginclude_HEADERS) @$(NORMAL_INSTALL) @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \ done uninstall-pkgincludeHEADERS: @$(NORMAL_UNINSTALL) @list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir) # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$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 \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -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 $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_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 case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(HEADERS) \ autoconf.h install-binPROGRAMS: install-libLTLIBRARIES installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f os/unix/$(DEPDIR)/$(am__dirstamp) -rm -f os/unix/$(am__dirstamp) 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-binPROGRAMS clean-generic clean-libLTLIBRARIES \ clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf ./$(DEPDIR) os/unix/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-data-local install-pkgincludeHEADERS install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binPROGRAMS install-binSCRIPTS \ install-libLTLIBRARIES install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -rf ./$(DEPDIR) os/unix/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \ uninstall-libLTLIBRARIES uninstall-pkgincludeHEADERS .MAKE: $(am__recursive_targets) all install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-binPROGRAMS \ clean-cscope clean-generic clean-libLTLIBRARIES clean-libtool \ cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ distcheck distclean distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags distcleancheck \ distdir distuninstallcheck dvi dvi-am html html-am info \ info-am install install-am install-binPROGRAMS \ install-binSCRIPTS install-data install-data-am \ install-data-local install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-libLTLIBRARIES install-man install-pdf \ install-pdf-am install-pkgincludeHEADERS install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \ uninstall-binSCRIPTS uninstall-libLTLIBRARIES \ uninstall-pkgincludeHEADERS c-icap-config: c-icap-config.in configure $(do_subst) < c-icap-config.in > $@ chmod 755 $@ c-icap-libicapapi-config: c-icap-libicapapi-config.in configure $(do_subst) < c-icap-libicapapi-config.in > $@ chmod 755 $@ doc: $(DOXYGEN) c-icap.dox install-data-local: $(mkinstalldirs) $(DESTDIR)$(CONFIGDIR); $(INSTALL) c-icap.conf $(DESTDIR)$(CONFIGDIR)/c-icap.conf.default $(INSTALL) c-icap.magic $(DESTDIR)$(CONFIGDIR)/c-icap.magic.default if test ! -f $(DESTDIR)$(CONFIGDIR)/c-icap.conf; then $(INSTALL) c-icap.conf $(DESTDIR)$(CONFIGDIR)/c-icap.conf; fi if test ! -f $(DESTDIR)$(CONFIGDIR)/c-icap.magic; then $(INSTALL) c-icap.magic $(DESTDIR)$(CONFIGDIR)/c-icap.magic; fi $(mkinstalldirs) $(DESTDIR)$(LOGDIR); $(mkinstalldirs) $(DESTDIR)$(SOCKDIR); chgrp nogroup $(DESTDIR)$(LOGDIR) || echo -e "*********\nWARNING! Can not set group for the log dir $(DESTDIR)$(LOGDIR)\n*********\n" chmod 775 $(DESTDIR)$(LOGDIR) chgrp nogroup $(DESTDIR)$(SOCKDIR) || echo -e "*********\nWARNING! Can not set group for the c-icap socket store dir $(DESTDIR)$(SOCKDIR)\n\n*********\n" chmod 775 $(DESTDIR)$(SOCKDIR) # 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: c_icap-0.4.2/dlib.c0000664000175000017500000000443612567550777010770 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include "dlib.h" struct dlib_entry { char *file; char *name; CI_DLIB_HANDLE handle; struct dlib_entry *next; }; struct dlib_entry *dlib_list = NULL; int ci_dlib_entry(const char *name, const char *file, CI_DLIB_HANDLE handle) { struct dlib_entry *dl_e, *dl_cur; if (!name || !file || !handle) return 0; dl_e = malloc(sizeof(struct dlib_entry)); if (!dl_e) return 0; dl_e->file = strdup(file); if (!dl_e->file) { free(dl_e); return 0; } dl_e->name = strdup(name); if (!dl_e->name) { free(dl_e->file); free(dl_e); return 0; } dl_e->handle = handle; dl_e->next = NULL; if (dlib_list == NULL) { dlib_list = dl_e; return 1; } dl_cur = dlib_list; while (dl_cur->next != NULL) dl_cur = dl_cur->next; dl_cur->next = dl_e; return 1; } int ci_dlib_closeall() { struct dlib_entry *dl_e, *dl_cur; int ret, error = 0; dl_cur = dlib_list; while (dl_cur != NULL) { dl_e = dl_cur; dl_cur = dl_cur->next; ret = ci_module_unload(dl_e->handle, dl_e->name); if (!ret) error = 1; if (dl_e->name) free(dl_e->name); if (dl_e->file) free(dl_e->file); free(dl_e); } dlib_list = NULL; if (error) return 0; return 1; } c_icap-0.4.2/autoconf.h.in0000664000175000017500000001334112601747523012263 00000000000000/* autoconf.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* Define HAVE_BDB if berkeley DB is installed */ #undef HAVE_BDB /* Define HAVE_BZLIB if bzlib installed */ #undef HAVE_BZLIB /* Define to 1 if you have the declaration of `strerror_r', and to 0 if you don't. */ #undef HAVE_DECL_STRERROR_R /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define to 1 if you have the `inet_aton' function. */ #undef HAVE_INET_ATON /* Define HAVE_INTTYPES_H if you have the header file. */ #undef HAVE_INTTYPES_H /* Define HAVE_IPV6 if OS supports ipv6 */ #undef HAVE_IPV6 /* Define HAVE_LDAP if LDAP libraries are installed */ #undef HAVE_LDAP /* Define to 1 if you have the header file. */ #undef HAVE_LIBMEMCACHED_MEMCACHED_H /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `mmap' function. */ #undef HAVE_MMAP /* Define to 1 if you have the `munmap' function. */ #undef HAVE_MUNMAP /* Define to 1 if you have the `nanosleep' function. */ #undef HAVE_NANOSLEEP /* Define HAVE_PCRE if pcre installed */ #undef HAVE_PCRE /* Define to 1 if you have the header file. */ #undef HAVE_PCRE_H /* Define HAVE_POSIX_FILE_LOCK if posix fcntl file locking works */ #undef HAVE_POSIX_FILE_LOCK /* Define HAVE_POSIX_MAPPED_FILES if mmap and munmap exists */ #undef HAVE_POSIX_MAPPED_FILES /* Define HAVE_POSIX_SEMAPHORES if posix 1003.1b semaphores works */ #undef HAVE_POSIX_SEMAPHORES /* Define HAVE_POSIX_SHARED_MEM if shm_open/shm_unlink functions implemented */ #undef HAVE_POSIX_SHARED_MEM /* Define HAVE_PTHREADS_RWLOCK if pthreads library supports rwlocks */ #undef HAVE_PTHREADS_RWLOCK /* Define HAVE_REGEX if regex.h exists (posix regular expressions - maybe more tests needed) */ #undef HAVE_REGEX /* Define to 1 if you have the header file. */ #undef HAVE_REGEX_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 `strcasestr' function. */ #undef HAVE_STRCASESTR /* Define to 1 if you have the `strerror_r' function. */ #undef HAVE_STRERROR_R /* 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 `strncasestr' function. */ #undef HAVE_STRNCASESTR /* Define to 1 if you have the `strnstr' function. */ #undef HAVE_STRNSTR /* Define HAVE_SYSV_IPC if sys/ipc.h exists (maybe more tests needed) */ #undef HAVE_SYSV_IPC /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IPC_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define HAVE_SYS_TYPES_H if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define HAVE_UNION_SEMUN if union semun defined in ipc */ #undef HAVE_UNION_SEMUN /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define if __attribute__((visibility("default"))) is supported. */ #undef HAVE_VISIBILITY_ATTRIBUTE /* Define HAVE_ZLIB if zlib installed */ #undef HAVE_ZLIB /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* 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 home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* The size of `int', as computed by sizeof. */ #undef SIZEOF_INT /* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG /* The size of `long long', as computed by sizeof. */ #undef SIZEOF_LONG_LONG /* The size of `off_t', as computed by sizeof. */ #undef SIZEOF_OFF_T /* The size of `short', as computed by sizeof. */ #undef SIZEOF_SHORT /* The size of `void *', as computed by sizeof. */ #undef SIZEOF_VOID_P /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if strerror_r returns char *. */ #undef STRERROR_R_CHAR_P /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS #endif /* Enable extensions on HP NonStop. */ #ifndef _TANDEM_SOURCE # undef _TANDEM_SOURCE #endif /* Enable general extensions on Solaris. */ #ifndef __EXTENSIONS__ # undef __EXTENSIONS__ #endif /* Version number of package */ #undef VERSION /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* Define to 1 if on MINIX. */ #undef _MINIX /* Define to 2 if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE /* Define to empty if `const' does not conform to ANSI C. */ #undef const c_icap-0.4.2/module.c0000664000175000017500000005404612567550777011345 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include "module.h" #include "header.h" #include "body.h" #include "debug.h" #ifdef _WIN32 #include #endif #include "dlib.h" #include "cfg_param.h" struct modules_list { void **modules; int modules_num; int list_size; }; /* ci_service_module_t **module_list=NULL; int module_list_size; int modules_num=0; */ #define STEP 20 static struct modules_list service_handlers; service_handler_module_t *default_service_handler; static struct modules_list loggers = {NULL, 0 , 0}; static struct modules_list access_controllers = {NULL, 0 , 0}; static struct modules_list auth_methods = {NULL, 0 , 0}; static struct modules_list authenticators = {NULL, 0 , 0}; static struct modules_list common_modules = {NULL, 0 , 0}; static struct modules_list *modules_lists_table[] = { /*Must follows the 'enum module_type' enumeration */ NULL, &service_handlers, &loggers, &access_controllers, &auth_methods, &authenticators, &common_modules }; void *load_module(const char *module_file) { void *module = NULL; CI_DLIB_HANDLE module_handle; module_handle = ci_module_load(module_file, CI_CONF.MODULES_DIR); if (!module_handle) return NULL; module = ci_module_sym(module_handle, "module"); if (!module) { ci_debug_printf(1, "Symbol \"module\" not found in library; unload it\n"); ci_module_unload(module_handle, module_file); return NULL; } ci_dlib_entry("module", module_file, module_handle); return module; } /* Must called only in initialization procedure. It is not thread-safe! */ void *add_to_modules_list(struct modules_list *mod_list, void *module) { if (mod_list->modules == NULL) { mod_list->list_size = STEP; mod_list->modules = malloc(mod_list->list_size * sizeof(void *)); } else if (mod_list->modules_num == mod_list->list_size) { mod_list->list_size += STEP; mod_list->modules = realloc(mod_list->modules, mod_list->list_size * sizeof(void *)); } if (mod_list->modules == NULL) { //log an error......and... exit(-1); } mod_list->modules[mod_list->modules_num++] = module; return module; } static int module_type(const char *type) { if (strcmp(type, "service_handler") == 0) { return SERVICE_HANDLER; } else if (strcmp(type, "logger") == 0) { return LOGGER; } else if (strcmp(type, "access_controller") == 0) { return ACCESS_CONTROLLER; } else if (strcmp(type, "auth_method") == 0) { return AUTH_METHOD; } else if (strcmp(type, "authenticator") == 0) { return AUTHENTICATOR; } else if(strcmp(type, "common") == 0) { return COMMON; } ci_debug_printf(1, "Uknown type of module:%s\n", type); return UNKNOWN; } static int init_module(void *module, enum module_type type) { int ret = 0; switch (type) { case SERVICE_HANDLER: if (((service_handler_module_t *) module)->init_service_handler) ret = ((service_handler_module_t *) module)-> init_service_handler(&CI_CONF); if (((service_handler_module_t *) module)->conf_table) register_conf_table(((service_handler_module_t *) module)->name, ((service_handler_module_t *) module)-> conf_table, MAIN_TABLE); break; case LOGGER: if (((logger_module_t *) module)->init_logger) ret = ((logger_module_t *) module)->init_logger(&CI_CONF); if (((logger_module_t *) module)->conf_table) register_conf_table(((logger_module_t *) module)->name, ((logger_module_t *) module)->conf_table, MAIN_TABLE); break; case ACCESS_CONTROLLER: if (((access_control_module_t *) module)->init_access_controller) ret = ((access_control_module_t *) module)-> init_access_controller(&CI_CONF); if (((access_control_module_t *) module)->conf_table) register_conf_table(((access_control_module_t *) module)->name, ((access_control_module_t *) module)-> conf_table, MAIN_TABLE); break; case AUTH_METHOD: if (((http_auth_method_t *) module)->init_auth_method) ret = ((http_auth_method_t *) module)->init_auth_method(&CI_CONF); if (((http_auth_method_t *) module)->conf_table) register_conf_table(((http_auth_method_t *) module)->name, ((http_auth_method_t *) module)->conf_table, MAIN_TABLE); break; case AUTHENTICATOR: if (((authenticator_module_t *) module)->init_authenticator) ret = ((authenticator_module_t *) module)-> init_authenticator(&CI_CONF); if (((authenticator_module_t *) module)->conf_table) register_conf_table(((authenticator_module_t *) module)->name, ((authenticator_module_t *) module)-> conf_table, MAIN_TABLE); break; case COMMON: if (((common_module_t *) module)->init_module) ret = ((common_module_t *) module)->init_module(&CI_CONF); if (((common_module_t *) module)->conf_table) register_conf_table(((common_module_t *) module)->name, ((common_module_t *) module)->conf_table, MAIN_TABLE); break; default: return 0; } return ret; } logger_module_t *find_logger(const char *name) { logger_module_t *sh; int i; for (i = 0; i < loggers.modules_num; i++) { sh = (logger_module_t *) loggers.modules[i]; if (sh->name && strcmp(sh->name, name) == 0) return sh; } return NULL; } access_control_module_t *find_access_controller(const char *name) { access_control_module_t *sh; int i; for (i = 0; i < access_controllers.modules_num; i++) { sh = (access_control_module_t *) access_controllers.modules[i]; if (sh->name && strcmp(sh->name, name) == 0) return sh; } return NULL; } common_module_t *find_common(const char *name) { common_module_t *m; int i; for (i = 0; i < common_modules.modules_num; i++) { m = (common_module_t *) common_modules.modules[i]; if (m->name && strcmp(m->name, name) == 0) return m; } return NULL; } /******************************************************************/ http_auth_method_t *find_auth_method(const char *method) { int i; for (i = 0; i < auth_methods.modules_num; i++) { if (strcmp (method, ((http_auth_method_t *) auth_methods.modules[i])->name) == 0) return (http_auth_method_t *) auth_methods.modules[i]; } return NULL; } /* The following function is a hacked version of find_auth_method function. Also return an integer (method_id) which corresponds to a hash key points to an array with authenticators which can handle the authentication method. */ http_auth_method_t *find_auth_method_id(const char *method, int *method_id) { int i; *method_id = 0; for (i = 0; i < auth_methods.modules_num; i++) { if (strcasecmp (method, ((http_auth_method_t *) auth_methods.modules[i])->name) == 0) { *method_id = i; return (http_auth_method_t *) auth_methods.modules[i]; } } return NULL; } authenticator_module_t *find_authenticator(const char *name) { int i; for (i = 0; i < authenticators.modules_num; i++) { if (strcmp (name, ((authenticator_module_t *) authenticators.modules[i])->name) == 0) { return (authenticator_module_t *) authenticators.modules[i]; } } return NULL; } service_handler_module_t *find_servicehandler(const char *name) { service_handler_module_t *sh; int i; for (i = 0; i < service_handlers.modules_num; i++) { sh = (service_handler_module_t *) service_handlers.modules[i]; if (sh->name && strcmp(sh->name, name) == 0) return sh; } return NULL; } void *find_module(const char *name, int *type) { void *mod; if ((mod = find_logger(name)) != NULL) { *type = LOGGER; return mod; } if ((mod = find_servicehandler(name)) != NULL) { *type = SERVICE_HANDLER; return mod; } if ((mod = find_access_controller(name)) != NULL) { *type = ACCESS_CONTROLLER; return mod; } if ((mod = find_auth_method(name)) != NULL) { *type = AUTH_METHOD; return mod; } if ((mod = find_authenticator(name)) != NULL) { *type = AUTHENTICATOR; return mod; } if ((mod = find_common(name)) != NULL) { *type = COMMON; return mod; } *type = UNKNOWN; return NULL; } /*All struct modules as first field have the name.*/ struct module_tmp_struct{ char *name; void *other_data; }; void *register_module(const char *module_file, const char *type) { void *module = NULL; int mod_type; struct modules_list *l = NULL; struct module_tmp_struct *check_mod; int check_mod_type; l = modules_lists_table[mod_type = module_type(type)]; if (l == NULL) return NULL; module = load_module(module_file); if (!module) { ci_debug_printf(3, "Error while loading module %s\n", module_file); return NULL; } check_mod = (struct module_tmp_struct *)module; if (find_module(check_mod->name, &check_mod_type) != NULL) { ci_debug_printf(1, "Error, the module %s is already loaded\n", check_mod->name); return NULL; } init_module(module, mod_type); add_to_modules_list(l, module); return module; } service_handler_module_t *find_servicehandler_by_ext(const char *extension) { service_handler_module_t *sh; const char *s; int i, len_extension, len_s = 0, found = 0; len_extension = strlen(extension); for (i = 0; i < service_handlers.modules_num; i++) { sh = (service_handler_module_t *) service_handlers.modules[i]; s = sh->extensions; do { if ((s = strstr(s, extension)) != NULL) { len_s = strlen(s); if (len_s >= len_extension && (strchr(",. \t", s[len_extension]) || s[len_extension] == '\0')) { found = 1; } } if (!s || len_extension >= len_s) /*There is no any more extensions....... */ break; s += len_extension; } while (s && !found); if (found) { ci_debug_printf(3, "Found handler %s for service with extension:%s\n", sh->name, extension); return sh; } } ci_debug_printf(1, "No handler for extension %s. Using default ...\n", extension); return default_service_handler; } /*************************************************************************************/ #define MAX_HASH_SIZE 256 /*Maybe, better a value of 10 or 20 */ struct auth_hash { authenticator_module_t ***hash; /*A 2-d array which contains pointers to authenticator_module_t */ int usedsize; int hash_size; }; struct auth_hash authenticators_hash; int init_auth_hash(struct auth_hash *hash) { hash->usedsize = 0; if (NULL == (hash->hash = malloc(STEP * sizeof(authenticator_module_t *)))) { hash->hash_size = STEP; return 0; } hash->hash_size = STEP; memset(hash->hash, 0, hash->hash_size); return 1; } void release_auth_hash(struct auth_hash *hash) { int i; for (i = 0; i < hash->hash_size; i++) { if (hash->hash[i] != NULL) { free(hash->hash[i]); } } free(hash->hash); hash->hash = NULL; } authenticator_module_t **get_authenticators_list(struct auth_hash *hash, int method_id) { if (method_id > hash->hash_size) return NULL; return hash->hash[method_id]; } int check_to_add_method_id(struct auth_hash *hash, int method_id) { authenticator_module_t ***new_mem; if (method_id > MAX_HASH_SIZE || method_id < 0) { ci_debug_printf(1, "Method id is %d. Possible bug, please report it to developers!!!!!!\n", method_id); return 0; } while (hash->hash_size < method_id) { new_mem = realloc(hash->hash, hash->hash_size + STEP); if (!new_mem) { ci_debug_printf(1, "Error allocating memory for authenticator hash!!!!!!\n"); return 0; } memset(hash->hash + hash->hash_size, 0, STEP); /*Reset the newly allocated memory */ hash->hash = new_mem; hash->hash_size += STEP; } return 1; } int methods_authenticators(struct auth_hash *hash, const char *method_name, int method_id, const char **argv) { int i, k, auths_num; authenticator_module_t **new_mem, *auth_mod; if (!check_to_add_method_id(hash, method_id)) return 0; for (auths_num = 0; argv[auths_num] != NULL; auths_num++); if (NULL == (new_mem = malloc((auths_num + 1) * sizeof(authenticator_module_t *)))) { ci_debug_printf(1, "Error allocating memory!!!!!!\n"); return 0; } memset(new_mem, 0, auths_num + 1); if (hash->hash[method_id] != NULL) free(hash->hash[method_id]); hash->hash[method_id] = new_mem; k = 0; for (i = 0; i < auths_num; i++) { ci_debug_printf(3, "Authenticator %s......\n", argv[i]); if ((auth_mod = find_authenticator(argv[i])) == NULL) { ci_debug_printf(1, "Authenticator %s does not exist!!!!!\n", argv[i]); continue; } if (strcasecmp(auth_mod->method, method_name) != 0) { ci_debug_printf(1, "Authenticator %s does not provide authentication method %s!!!!\n", auth_mod->name, method_name); continue; } new_mem[k++] = auth_mod; } new_mem[k] = NULL; return 1; } int set_method_authenticators(const char *method_name, const char **argv) { int method_id; http_auth_method_t *method_mod; if (!(method_mod = find_auth_method_id(method_name, &method_id))) { ci_debug_printf(1, "Authentication method \"%s\" not supported\n", method_name); return 0; } return methods_authenticators(&authenticators_hash, method_name, method_id, argv); } http_auth_method_t *get_authentication_schema(const char *method_name, authenticator_module_t *** authenticators) { int method_id; http_auth_method_t *method_mod; if (!(method_mod = find_auth_method_id(method_name, &method_id))) { *authenticators = NULL; return NULL; } *authenticators = get_authenticators_list(&authenticators_hash, method_id); return method_mod; } /*************************************************************************************/ extern service_handler_module_t c_service_handler; extern logger_module_t file_logger; extern logger_module_t *default_logger; extern access_control_module_t default_acl; extern http_auth_method_t basic_auth; extern authenticator_module_t basic_simple_db; int init_modules() { /*first initialize authenticators hash...... */ init_auth_hash(&authenticators_hash); default_service_handler = &c_service_handler; add_to_modules_list(&service_handlers, default_service_handler); default_logger = &file_logger; /* init_module(default_logger,LOGGER); Must be called, if default module has conf table or init_service_handler. */ add_to_modules_list(&loggers, default_logger); init_module(&default_acl, ACCESS_CONTROLLER); add_to_modules_list(&access_controllers, &default_acl); init_module(&basic_auth, AUTH_METHOD); add_to_modules_list(&auth_methods, &basic_auth); init_module(&basic_simple_db, AUTHENTICATOR); add_to_modules_list(&authenticators, &basic_simple_db); return 1; } int post_init_modules() { int i; /* common modules */ for (i = 0; i < common_modules.modules_num ; i++) { if (((common_module_t *) common_modules.modules[i])-> post_init_module != NULL) ((common_module_t *) common_modules.modules[i])-> post_init_module(&CI_CONF); } /* service_handlers */ for (i = 0; i < service_handlers.modules_num; i++) { if (((service_handler_module_t *) service_handlers.modules[i])-> post_init_service_handler != NULL) ((service_handler_module_t *) service_handlers.modules[i])-> post_init_service_handler(&CI_CONF); } /* loggers? loggers do not have post init handlers .... */ /* access_controllers */ for (i = 0; i < access_controllers.modules_num; i++) { if (((access_control_module_t *) access_controllers.modules[i])-> post_init_access_controller != NULL) ((access_control_module_t *) access_controllers.modules[i])-> post_init_access_controller(&CI_CONF); } /* auth_methods */ for (i = 0; i < auth_methods.modules_num; i++) { if (((http_auth_method_t *) auth_methods.modules[i])-> post_init_auth_method != NULL) ((http_auth_method_t *) auth_methods.modules[i])-> post_init_auth_method(&CI_CONF); } /* authenticators */ for (i = 0; i < authenticators.modules_num; i++) { if (((authenticator_module_t *) authenticators.modules[i])-> post_init_authenticator != NULL) ((authenticator_module_t *) authenticators.modules[i])-> post_init_authenticator(&CI_CONF); } return 1; } int access_reset(); void log_reset(); #define RELEASE_MOD_LIST(mod) \ free(mod.modules); mod.modules = NULL; mod.list_size = 0; mod.modules_num=0; int release_modules() { int i; log_reset(); /*resetting logs- we are going to release loggers ... */ access_reset(); /* service_handlers */ for (i = 0; i < service_handlers.modules_num; i++) { if (((service_handler_module_t *) service_handlers.modules[i])-> release_service_handler != NULL) ((service_handler_module_t *) service_handlers.modules[i])-> release_service_handler(); } RELEASE_MOD_LIST(service_handlers); /* loggers? loggers do not have post init handlers .... */ for (i = 0; i < loggers.modules_num; i++) { if (((logger_module_t *) loggers.modules[i])->log_close != NULL) ((logger_module_t *) loggers.modules[i])->log_close(); } RELEASE_MOD_LIST(loggers); /* access_controllers */ for (i = 0; i < access_controllers.modules_num; i++) { if (((access_control_module_t *) access_controllers.modules[i])-> release_access_controller != NULL) ((access_control_module_t *) access_controllers.modules[i])-> release_access_controller(&CI_CONF); } RELEASE_MOD_LIST(access_controllers); /* auth_methods */ for (i = 0; i < auth_methods.modules_num; i++) { if (((http_auth_method_t *) auth_methods.modules[i])-> close_auth_method != NULL) ((http_auth_method_t *) auth_methods.modules[i])-> close_auth_method(&CI_CONF); } RELEASE_MOD_LIST(auth_methods); /* authenticators */ for (i = 0; i < authenticators.modules_num; i++) { if (((authenticator_module_t *) authenticators.modules[i])-> close_authenticator != NULL) ((authenticator_module_t *) authenticators.modules[i])-> close_authenticator(&CI_CONF); } RELEASE_MOD_LIST(authenticators); /* common modules */ for (i = common_modules.modules_num-1; i >= 0 ; i--) { if (((common_module_t *) common_modules.modules[i])-> close_module != NULL) ((common_module_t *) common_modules.modules[i])-> close_module(&CI_CONF); } RELEASE_MOD_LIST(common_modules); return 1; } c_icap-0.4.2/lookup_table.c0000664000175000017500000001663512567550777012542 00000000000000/* * Copyright (C) 2004-2010 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "lookup_table.h" #include "debug.h" #include "mem.h" /***********************************************************/ /* Global variables */ /*we can support up to 128 lookup table types, looks enough*/ const struct ci_lookup_table_type *lookup_tables_types[128]; int lookup_tables_types_num = 0; /*********************************************************************/ /*Lookuptable library functions */ struct ci_lookup_table_type *ci_lookup_table_type_register( struct ci_lookup_table_type *lt_type) { if(lookup_tables_types_num >= 128) { ci_debug_printf(1,"c-icap does not support more than 128 loookup table types"); return NULL; } lookup_tables_types[lookup_tables_types_num++]=lt_type; return lt_type; } void ci_lookup_table_type_unregister( struct ci_lookup_table_type *lt_type) { int i; for(i=0; lookup_tables_types[i] != lt_type && i < lookup_tables_types_num; i++); if(itype) == 0) return lookup_tables_types[i]; } return NULL; } static const void * lookup_table_get_row(struct ci_lookup_table *table, const void *key, const char *columns[], void ***vals); struct ci_lookup_table *ci_lookup_table_create_ext(const char *table, const ci_type_ops_t *key_ops, const ci_type_ops_t *val_ops, ci_mem_allocator_t *allocator) { char *ttype,*path,*args,*s; const struct ci_lookup_table_type *lt_type; struct ci_lookup_table *lt; char *stable = strdup(table); if(!stable){ /*A debug message.....*/ return NULL; } /*Normaly the table has the form tabletype:/path/{args}*/ s = index(stable,':'); if (!s) { /*Then it is a simple text file*/ ttype = "file"; path = stable; args = NULL; } else { ttype = stable; path = s+1; *s = '\0'; s = index(path,'{'); if (s) { *s = '\0'; /* path ends here */ args = s+1; /*args start here */ if ((s = index(args,'}'))) *s = '\0'; /*else args is all the remains string */ } else /*No args*/ args = NULL; } lt_type = ci_lookup_table_type_search(ttype); if (!lt_type || !lt_type->open) { ci_debug_printf(1,"Not lookuptable of type :%s!!!\n", ttype); free(stable); return NULL; } lt = malloc(sizeof(struct ci_lookup_table)); if(!lt) { ci_debug_printf(1,"memory allocation error!!"); free(stable); return NULL; } lt->path=strdup(path); if(args) lt->args=strdup(args); else lt->args=NULL; free(stable); lt->cols = -1; lt->key_ops = key_ops; lt->val_ops = val_ops; lt->type = lt_type->type; lt->open = lt_type->open; lt->close = lt_type->close; lt->search = lt_type->search; lt->get_row = lookup_table_get_row; lt->release_result = lt_type->release_result; lt->allocator = allocator; lt->_lt_type = lt_type; lt->data = NULL; return lt; } struct ci_lookup_table *ci_lookup_table_create(const char *table) { ci_mem_allocator_t *allocator; struct ci_lookup_table *lt; allocator = ci_create_os_allocator(); if(!allocator) return NULL; lt = ci_lookup_table_create_ext(table, &ci_str_ops, &ci_str_ops, allocator); if (!lt) ci_mem_allocator_destroy(allocator); return lt; } void ci_lookup_table_destroy(struct ci_lookup_table *lt) { if (!lt) return; lt->close(lt); free(lt->path); if(lt->args) free(lt->args); if(lt->allocator) ci_mem_allocator_destroy(lt->allocator); free(lt); } void * ci_lookup_table_open(struct ci_lookup_table *table) { if (!table->_lt_type || !table->open) { ci_debug_printf(1, "lookup_table of type %s is corrupted (\"open\" method missing)!\n", table->type); return NULL; } return table->open(table); } const char * ci_lookup_table_search(struct ci_lookup_table *table, const char *key, char ***vals) { if (!table->_lt_type || !table->search) { ci_debug_printf(1, "lookup_table of type %s is corrupted (\"search\" method missing)!\n", table->type); return NULL; } if (!ci_type_ops_is_string(table->key_ops) || !ci_type_ops_is_string(table->val_ops)) { ci_debug_printf(1, "lookup_table of type %s does not support search with string like keys!\n", table->type); return NULL; } return table->search(table, (void *)key, (void ***)vals); } void ci_lookup_table_release_result(struct ci_lookup_table *table, void **val) { if (!table->_lt_type || !table->release_result) { ci_debug_printf(1, "lookup_table of type %s is corrupted (\"release_result\" method missing)!\n", table->type); return; } return table->release_result(table, (void **)val); } const void * lookup_table_get_row(struct ci_lookup_table *table, const void *key, const char *columns[], void ***vals) { int i; if (!table->_lt_type) { ci_debug_printf(1, "lookup_table of type %s is corrupted!\n", table->type); return NULL; } if (!table->col_names || table->_lt_type->get_row) { ci_debug_printf(1, "lookup_table :%s does not support lookup on named columns\n", table->type); return NULL; } for (i=0; i < 1024 && columns[i] != NULL; i++) { if (NULL == ci_str_vector_search(table->col_names, columns[i])) { ci_debug_printf(1, "lookup_table :%s does not has column %s\n", table->type, columns[i]); return NULL; } } return table->_lt_type->get_row(table, key, columns, vals); } const char * ci_lookup_table_get_row(struct ci_lookup_table *table, const char *key, const char *columns[], char ***vals) { if ( !ci_type_ops_is_string(table->key_ops) || !ci_type_ops_is_string(table->val_ops)) { ci_debug_printf(1, "lookup_table of type %s does not support search with string like keys!\n", table->type); return NULL; } return (const char *) lookup_table_get_row(table, (const void *)key, columns, (void ***)vals); } extern struct ci_lookup_table_type file_table_type; extern struct ci_lookup_table_type hash_table_type; extern struct ci_lookup_table_type regex_table_type; CI_DECLARE_FUNC(void) init_internal_lookup_tables(){ ci_lookup_table_type_register(&file_table_type); ci_lookup_table_type_register(&hash_table_type); ci_lookup_table_type_register(®ex_table_type); } c_icap-0.4.2/lookup_file_table.c0000664000175000017500000003075612567550776013540 00000000000000/* * Copyright (C) 2004-2010 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "lookup_table.h" #include "hash.h" #include "debug.h" #include /******************************************************/ /* file lookup table implementation */ void *file_table_open(struct ci_lookup_table *table); void file_table_close(struct ci_lookup_table *table); void *file_table_search(struct ci_lookup_table *table, void *key, void ***vals); void file_table_release_result(struct ci_lookup_table *table_data,void **val); struct ci_lookup_table_type file_table_type={ file_table_open, file_table_close, file_table_search, file_table_release_result, NULL, "file" }; struct text_table_entry { void *key; void **vals; struct text_table_entry *next; }; struct text_table { struct text_table_entry *entries; struct ci_hash_table *hash_table; int rows; }; struct text_table_entry *alloc_text_table_entry (int val_num, ci_mem_allocator_t *allocator){ struct text_table_entry *e; int i; e = allocator->alloc(allocator, sizeof(struct text_table_entry)); e->key = NULL; e->next = NULL; if(!e) { ci_debug_printf(1,"Error allocating memory for table entry \n"); return NULL; } if (val_num>0) { e->vals = allocator->alloc(allocator, (val_num + 1)*sizeof(void *)); if(!e->vals) { allocator->free(allocator, e); e=NULL; ci_debug_printf(1,"Error allocating memory for values of table entry.\n"); return NULL; } for(i=0; i< val_num + 1; i++) e->vals[i] = NULL; } else e->vals = NULL; /*Only key */ return e; } void release_text_table_entry (struct text_table_entry *e, struct ci_lookup_table *table) { void **vals; int i; ci_mem_allocator_t *allocator = table->allocator; if (!e) return; if(e->vals) { vals=(void **)e->vals; for(i=0;vals[i]!=NULL;i++) table->val_ops->free(vals[i], allocator); allocator->free(allocator, e->vals); } if (e->key) table->key_ops->free(e->key, allocator); allocator->free(allocator, e); } int read_row(FILE *f, int cols, struct text_table_entry **e, struct ci_lookup_table *table) { char line[65536]; char *s,*val,*end; int row_cols,line_len,i; ci_mem_allocator_t *allocator = table->allocator; const ci_type_ops_t *key_ops = table->key_ops; const ci_type_ops_t *val_ops = table->val_ops; (*e)=NULL; if(!fgets(line,65535,f)) return 0; line[65535]='\0'; if((line_len=strlen(line))>65535) { line[64]='\0'; ci_debug_printf(1, "Too long line: %s...", line); return 0; } if(line[line_len-1]=='\n') line[line_len-1]='\0'; /*eat the newline char*/ /*Do a check for comments*/ s=line; while(*s==' ' || *s == '\t') s++; if (*s == '#') /*it is a comment*/ return 1; if (*s == '\0') /*it is a blank line */ return 1; if(cols<0) { /*the line should have the format key:val1, val2, ... */ if (!(s=index(line,':'))) { row_cols=1; } else { row_cols=2; while((s=index(s,','))) row_cols++,s++; } } else row_cols=cols; (*e) = alloc_text_table_entry(row_cols-1, allocator); if(!(*e)) { ci_debug_printf(1,"Error allocating memory for table entry:%s\n", line); return 0; } s=line; while(*s==' ' || *s == '\t') s++; val=s; end = NULL; if (row_cols > 1) end=index(s,':'); if (end == NULL) /*no ":" char or the only column is the key (row_cols <=1)*/ end=s+strlen(s); s=end+1; /*Now points to the end (*s='\0') or after the ':' */ end--; while(*end==' ' || *end=='\t') end--; *(end+1)='\0'; (*e)->key=key_ops->dup(val, allocator); if(!(*e)->key) { ci_debug_printf(1, "Error reading key in line:%s\n", line); release_text_table_entry((*e), table); (*e)=NULL; return -1; } if(row_cols > 1) { assert((*e)->vals); for (i=0; *s!='\0'; i++) { /*probably we have vals*/ if(i>=row_cols) { /*here we are leaving memory leak, I think qill never enter this if ...*/ ci_debug_printf(1, "Error in read_row of file lookup table!(line:%s)\n", line); release_text_table_entry((*e), table); (*e)=NULL; return -1; } while(*s==' ' || *s =='\t') s++; /*find the start of the string*/ val = s; end=s; while(*end!=',' && *end!='\0') end++; if (*end=='\0') s = end; else s = end + 1; end--; while(*end == ' ' || *end == '\t') end--; *(end+1)='\0'; (*e)->vals[i] = val_ops->dup(val, allocator); } (*e)->vals[i] = NULL; } return 1; } int load_text_table(char *filename, struct ci_lookup_table *table) { FILE *f; struct text_table_entry *e, *l = NULL; int rows, ret; struct text_table *text_table = (struct text_table *)table->data; if ((f = fopen(filename, "r")) == NULL) { ci_debug_printf(1, "Error opening file: %s\n", filename); return 0; } rows = 0; if (text_table->entries != NULL) /*if table is not empty try to find the last element*/ for (l = text_table->entries; l->next != NULL; l = l->next); while(0 < (ret=read_row(f, table->cols, &e, table))) { if (e) { e->next = NULL; if(text_table->entries==NULL) { text_table->entries = e; l = e; } else { l->next = e; l = e; } } rows++; } fclose(f); if(ret==-1) { ci_debug_printf(1, "Error loading file table %s: parse error on line %d\n", filename, rows+1); file_table_close(table); return 0; } text_table->rows = rows; return 1; } void *file_table_open(struct ci_lookup_table *table) { struct ci_mem_allocator *allocator = table->allocator; struct text_table *text_table=allocator->alloc(allocator, sizeof(struct text_table)); if(!text_table) return NULL; text_table->entries=NULL; table->data=(void *)text_table; if(!load_text_table(table->path, table)) { return (table->data=NULL); } text_table->hash_table = NULL; return text_table; } void file_table_close(struct ci_lookup_table *table) { int i; void **vals = NULL; struct text_table_entry *tmp; struct ci_mem_allocator *allocator = table->allocator; struct text_table *text_table = (struct text_table *)table->data; if(!text_table) { ci_debug_printf(1,"Closing a non open file lookup table?(%s)\n", table->path); return; } while(text_table->entries) { tmp = text_table->entries; text_table->entries = text_table->entries->next; if(tmp->vals) { vals=(void **)tmp->vals; for(i=0;vals[i]!=NULL;i++) table->val_ops->free(vals[i], allocator); allocator->free(allocator, tmp->vals); } table->key_ops->free(tmp->key, allocator); allocator->free(allocator, tmp); } allocator->free(allocator, text_table); table->data=NULL; } void *file_table_search(struct ci_lookup_table *table, void *key, void ***vals) { struct text_table_entry *e; struct text_table *text_table=(struct text_table *)table->data; if(!text_table) { ci_debug_printf(1,"Search a non open lookup table?(%s)\n", table->path); return NULL; } e=text_table->entries; *vals=NULL; while(e) { if (table->key_ops->compare((void *)e->key,key)==0) { *vals=(void **)e->vals; return (void *)e->key; } e = e->next; } return NULL; } void file_table_release_result(struct ci_lookup_table *table_data,void **val) { /*do nothing*/ } /******************************************************/ /* hash lookup table implementation */ void *hash_table_open(struct ci_lookup_table *table); void hash_table_close(struct ci_lookup_table *table); void *hash_table_search(struct ci_lookup_table *table, void *key, void ***vals); void hash_table_release_result(struct ci_lookup_table *table_data,void **val); struct ci_lookup_table_type hash_table_type={ hash_table_open, hash_table_close, hash_table_search, hash_table_release_result, NULL, "hash" }; void *hash_table_open(struct ci_lookup_table *table) { struct text_table_entry *e; struct text_table *text_table=file_table_open(table); if (!text_table) return NULL; /* build the hash table*/ ci_debug_printf(7, "Will build a hash for %d rows of data\n", text_table->rows); text_table->hash_table = ci_hash_build(text_table->rows, table->key_ops, table->allocator); if(!text_table->hash_table) { file_table_close(table); return NULL; } e=text_table->entries; while(e) { ci_hash_add(text_table->hash_table,e->key, e); e = e->next; } return text_table; } void hash_table_close(struct ci_lookup_table *table) { struct text_table *text_table = (struct text_table *)table->data; if (text_table && text_table->hash_table) { /*destroy the hash table */ ci_hash_destroy(text_table->hash_table); text_table->hash_table = NULL; } /*... and then call the file_table_close:*/ file_table_close(table); } void *hash_table_search(struct ci_lookup_table *table, void *key, void ***vals) { const struct text_table_entry *e; struct text_table *text_table = (struct text_table *)table->data; if(!text_table) { ci_debug_printf(1, "Search a non open hash lookup table?(%s)\n", table->path); return NULL; } *vals=NULL; e = ci_hash_search(text_table->hash_table, key); if(!e) return NULL; *vals = (void **)e->vals; return (void *)e->key; } void hash_table_release_result(struct ci_lookup_table *table_data,void **val) { /*do nothing*/ } /******************************************************/ /* regex lookup table implementation */ void *regex_table_open(struct ci_lookup_table *table); void regex_table_close(struct ci_lookup_table *table); void *regex_table_search(struct ci_lookup_table *table, void *key, void ***vals); void regex_table_release_result(struct ci_lookup_table *table_data,void **val); struct ci_lookup_table_type regex_table_type={ regex_table_open, regex_table_close, regex_table_search, regex_table_release_result, NULL, "regex" }; void *regex_table_open(struct ci_lookup_table *table) { #ifdef USE_REGEX struct text_table *text_table; if(table->key_ops != &ci_str_ops) { ci_debug_printf(1,"This type of table is not compatible with regex tables!\n"); return NULL; } table->key_ops = &ci_regex_ops; text_table=file_table_open(table); if (!text_table) return NULL; return text_table; #else ci_debug_printf(1,"regex lookup tables are not supported on this system!\n"); return NULL; #endif } void regex_table_close(struct ci_lookup_table *table) { #ifdef USE_REGEX /*just call the file_table_close:*/ file_table_close(table); #else ci_debug_printf(1,"regex lookup tables are not supported on this system!\n"); return NULL; #endif } void *regex_table_search(struct ci_lookup_table *table, void *key, void ***vals) { #ifdef USE_REGEX return file_table_search(table, key, vals); #else ci_debug_printf(1,"regex lookup tables are not supported on this system!\n"); return NULL; #endif } void regex_table_release_result(struct ci_lookup_table *table_data,void **val) { /*do nothing*/ } c_icap-0.4.2/util.c0000664000175000017500000001054512567550776011030 00000000000000/* * Copyright (C) 2004-2011 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include "array.h" #include "util.h" #include #include #include const char *ci_strnstr(const char *s, const char *find, size_t slen) { size_t len = strlen(find); if (len == 0) return NULL; while(len <= slen) { if (*s == *find && strncmp(s, find, len) == 0 ) return s; s++,slen--; } return NULL; } const char *ci_strcasestr(const char *str, const char *find) { const char *s, *c, *f; for (s = str; *s != '\0'; ++s) { for (f = find, c = s; ; ++f, ++c) { if (*f == '\0') /*find matched s*/ return s; if (*c == '\0') /*find is longer than the remaining string */ return NULL; if (tolower(*c) != tolower(*f)) break; } } return NULL; } const char *ci_strncasestr(const char *s, const char *find, size_t slen) { size_t len = strlen(find); if (len == 0) return NULL; while(len <= slen) { if (tolower(*s) == tolower(*find) && strncasecmp(s, find, len) == 0 ) return s; s++,slen--; } return NULL; } static const char *atol_err_erange = "ERANGE"; static const char *atol_err_conversion = "CONVERSION_ERROR"; static const char *atol_err_nonumber = "NO_DIGITS_ERROR"; long int ci_atol_ext(const char *str, const char **error) { char *e; long int val; errno = 0; val = strtol(str, &e, 10); if (error) { *error = NULL; if (errno == ERANGE && (val == LONG_MAX || val == LONG_MIN)) *error = atol_err_erange; else if (errno != 0 && val == 0) *error = atol_err_conversion; else if (e == str) *error = atol_err_nonumber; if (*error) return 0; } if (val) { if (*e == 'k' || * e == 'K') val = val * 1024; else if (*e == 'm' || * e == 'M') val = val * 1024 * 1024; } return val; } void ci_str_trim(char *str) { char *s, *e; if (!str) return; s = str; e = NULL; while (isspace(*s)){ e = s; while (*e != '\0'){ *e = *(e+1); e++; } } /*if (e) e--; else */ e = str+strlen(str); e--; while(isspace(*e) && e >= str) {*e = '\0'; --e;}; } char *ci_str_trim2(char *s) { char *e; if (!s) return NULL; while (isspace(*s)) ++s; e = s + strlen(s); e--; while(isspace(*e) && e >= s) {*e = '\0'; --e;}; return s; } char * ci_strerror(int error, char *buf, size_t buflen) { #if defined(STRERROR_R_CHAR_P) return strerror_r(error, buf, buflen); #elif defined(HAVE_STRERROR_R) if (strerror_r(error, buf, buflen) == 0) return buf; #else snprintf(buf, buflen, "%d", error); buf[buflen - 1] = '\0'; return buf; #endif } /* TODO: support escaped chars, */ ci_dyn_array_t *ci_parse_key_value_list(const char *str, char sep) { char *s, *e, *k, *v; ci_dyn_array_t *args_array; s = strdup(str); if (!s) return NULL; args_array = ci_dyn_array_new(1024); k = s; while (k) { if ((e = strchr(k , sep))) { *e = '\0'; e++; } if ((v = strchr(k, '='))) { *v = '\0'; ++v; } k = ci_str_trim2(k); if (v) v = ci_str_trim2(v); if (*k) { ci_dyn_array_add(args_array, k, v ? v : "", v ? strlen(v) + 1 : 1); } k = (e && *e) ? e : NULL; } return args_array; } c_icap-0.4.2/c-icap-config.in0000664000175000017500000000320712567550777012634 00000000000000#!/bin/sh prefix=@prefix@ PKGLIBDIR=@PKGLIBDIR@/ LIBDIR=@LIBDIR@/ CONFIGDIR=@SYSCONFDIR@/ DATADIR=@PKGDATADIR@/ #LOGDIR= SOCKDIR=@SOCKDIR@ INCDIR=@INCLUDEDIR@ INCDIR2=@PKGINCLUDEDIR@ VERSION=@PACKAGE_VERSION@ CICAPCFLAGS="@CFLAGS@" CICAPLDFLAGS= CICAPLIBS= CFLAGS="@MODULES_CFLAGS@ @CFLAGS@" LIBS=@MODULES_LIBADD@ LDFLAGS="" usage() { cat < #include "common.h" #include "c-icap.h" #include "net_io.h" #include "debug.h" #include "log.h" #include "commands.h" #include "cfg_param.h" #include "registry.h" struct schedule_data { char name[CMD_NM_SIZE]; time_t when; void *data; }; /*The list of commands*/ static ci_list_t *COMMANDS_LIST = NULL;; /* The list of request for ONDEMAND_CMD commands*/ static ci_list_t *COMMANDS_QUEUE = NULL; ci_thread_mutex_t COMMANDS_MTX; void commands_init() { ci_thread_mutex_init(&COMMANDS_MTX); COMMANDS_LIST = ci_list_create(64, sizeof(ci_command_t)); COMMANDS_QUEUE = ci_list_create(64, sizeof(struct schedule_data)); } void register_command(const char *name, int type, void (*command_action) (const char *name, int type, const char **argv)) { if (! (type & ALL_PROC_CMD)) { ci_debug_printf(1, "Can not register command %s ! Wrong type\n", name ); return; } ci_command_t cmd; strncpy(cmd.name, name, CMD_NM_SIZE); cmd.name[CMD_NM_SIZE - 1] = '\0'; cmd.type = type; cmd.data = NULL; cmd.command_action = command_action; ci_thread_mutex_lock(&COMMANDS_MTX); ci_list_push(COMMANDS_LIST, &cmd); ci_thread_mutex_unlock(&COMMANDS_MTX); ci_debug_printf(5, "Command %s registered\n", name); } void register_command_extend(const char *name, int type, void *data, void (*command_action) (const char *name, int type, void *data)) { if (type != CHILD_START_CMD && type != CHILD_STOP_CMD && type != ONDEMAND_CMD) { ci_debug_printf(1, "Can not register extend command %s ! wrong type\n", name ); return; } ci_command_t cmd; strncpy(cmd.name, name, CMD_NM_SIZE); cmd.name[CMD_NM_SIZE - 1] = '\0'; cmd.type = type; cmd.data = data; cmd.command_action_extend = command_action; ci_thread_mutex_lock(&COMMANDS_MTX); ci_list_push(COMMANDS_LIST, &cmd); ci_thread_mutex_unlock(&COMMANDS_MTX); ci_debug_printf(5, "Extend command %s registered\n", name); } void commands_reset() { if (COMMANDS_QUEUE) { ci_list_destroy(COMMANDS_QUEUE); COMMANDS_QUEUE = ci_list_create(64, sizeof(struct schedule_data)); } if (COMMANDS_LIST) { ci_list_destroy(COMMANDS_LIST); COMMANDS_LIST = ci_list_create(64, sizeof(ci_command_t)); } } /* Currently we are using the following functions which defined in cfg_param.c file These functions must moved to a utils.c file ... */ char **split_args(char *args); void free_args(char **argv); int cb_check_command(void *data, const void *obj) { const ci_command_t **rcommand = (const ci_command_t **)data; const ci_command_t *cur_item = (const ci_command_t *)obj; if (*rcommand && strcmp((*rcommand)->name, cur_item->name) == 0) { *rcommand = cur_item; return 1; } return 0; } ci_command_t *find_command(const char *cmd_line) { int len; char *s; ci_command_t tmpCmd; ci_command_t *cmd; if (COMMANDS_LIST == NULL) { ci_debug_printf(5, "None command registered\n"); return NULL; } s = strchr(cmd_line, ' '); if (s) len = s - cmd_line; else len = strlen(cmd_line); if (len && len < CMD_NM_SIZE) { strncpy(tmpCmd.name, cmd_line, len); tmpCmd.name[len] = '\0'; cmd = &tmpCmd; ci_list_iterate(COMMANDS_LIST, &cmd, cb_check_command); if(cmd != &tmpCmd) /*We found an cmd stored in list. Return it*/ return cmd; } return NULL; } int execute_command(ci_command_t * command, char *cmdline, int exec_type) { char **args; if (!command) return 0; args = split_args(cmdline); command->command_action(args[0], exec_type, (const char **)(args + 1)); free_args(args); return 1; } static int exec_cmd_step(void *data, const void *cmd) { int cmd_type = *((int *)data); ci_command_t *command = (ci_command_t *)cmd; ci_debug_printf(7, "Check command:%s, type: %d \n", command->name, command->type); if (command->type == cmd_type) { ci_debug_printf(5, "Execute command:%s \n", command->name); command->command_action_extend (command->name, command->type, command->data); } return 0; } static int execute_child_commands (int cmd_type) { ci_debug_printf(5, "Going to execute child commands\n"); if (COMMANDS_LIST == NULL) { ci_debug_printf(5, "None command registered\n"); return 0; } ci_list_iterate(COMMANDS_LIST, &cmd_type, exec_cmd_step); return 1; } int commands_execute_start_child() { return execute_child_commands(CHILD_START_CMD); } int commands_execute_stop_child() { return execute_child_commands(CHILD_STOP_CMD); } void ci_command_register_ctl_cmd(const char *name, int type, void (*command_action)(const char *name,int type, const char **argv)) { register_command(name, type, command_action); } void ci_command_register_action(const char *name, int type, void *data, void (*command_action) (const char *name, int type, void *data)) { register_command_extend(name, type, data, command_action); } void ci_command_schedule_on(const char *name, void *data, time_t time) { struct schedule_data sch; memset(&sch, 0, sizeof(struct schedule_data)); strncpy(sch.name, name, CMD_NM_SIZE); sch.name[CMD_NM_SIZE - 1] = '\0'; sch.when = time; sch.data = data; if (ci_list_search(COMMANDS_QUEUE, &sch)) { ci_debug_printf(7, "command %s already scheduled for execution on %ld, ignore\n", name, time); return; } ci_thread_mutex_lock(&COMMANDS_MTX); ci_list_push(COMMANDS_QUEUE, &sch); ci_thread_mutex_unlock(&COMMANDS_MTX); ci_debug_printf(9, "command %s scheduled for execution\n", name); } void ci_command_schedule(const char *name, void *data, time_t afterSecs) { time_t tm; time(&tm); tm += afterSecs; ci_command_schedule_on(name, data, tm); } static int cb_check_queue(void *data, const void *item) { struct schedule_data *sch = (struct schedule_data *)item; time_t tm = *((time_t *)data); if (sch->when < tm) { ci_command_t *cmd = find_command(sch->name); if (cmd) { ci_debug_printf(9, "Execute command:%s \n", cmd->name); cmd->command_action_extend (cmd->name, cmd->type, (sch->data ? sch->data : cmd->data)); } ci_thread_mutex_lock(&COMMANDS_MTX); ci_list_remove(COMMANDS_QUEUE, sch); ci_thread_mutex_unlock(&COMMANDS_MTX); } return 0; } void commands_exec_scheduled() { time_t tm; ci_debug_printf(10, "Going to execute child commands\n"); if (COMMANDS_LIST == NULL) { ci_debug_printf(10, "None command registered\n"); } if (!COMMANDS_QUEUE) return; time(&tm); ci_list_iterate(COMMANDS_QUEUE, &tm, cb_check_queue); } c_icap-0.4.2/mem.c0000664000175000017500000006301212567550777010627 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include #include #include #include "ci_threads.h" #include "debug.h" #include "mem.h" #include int ci_buffers_init(); /*General Functions */ ci_mem_allocator_t *default_allocator = NULL; int MEM_ALLOCATOR_POOL = -1; int PACK_ALLOCATOR_POOL = -1; static size_t sizeof_pack_allocator(); ci_mem_allocator_t *ci_create_pool_allocator(int items_size); CI_DECLARE_FUNC(int) mem_init() { int ret = -1; ret = ci_buffers_init(); default_allocator = ci_create_os_allocator(); if (!default_allocator && ret ==-1) ret = 0; MEM_ALLOCATOR_POOL = ci_object_pool_register("ci_mem_allocator_t", sizeof(ci_mem_allocator_t)); assert(MEM_ALLOCATOR_POOL >=0); PACK_ALLOCATOR_POOL = ci_object_pool_register("pack_allocator_t", sizeof_pack_allocator()); assert(PACK_ALLOCATOR_POOL >=0); return ret; } void mem_reset() { } void ci_mem_allocator_destroy(ci_mem_allocator_t *allocator) { allocator->destroy(allocator); /*space for ci_mem_allocator_t struct is not always allocated using malloc */ if (allocator->must_free == 1) free(allocator); else if (allocator->must_free == 2) ci_object_pool_free(allocator); /* else if (allocator->must_free == 0) user is responsible to release the struct */ } /******************/ static ci_mem_allocator_t *alloc_mem_allocator_struct() { ci_mem_allocator_t *alc; if (MEM_ALLOCATOR_POOL < 0) { alc = (ci_mem_allocator_t *) malloc(sizeof(ci_mem_allocator_t)); alc->must_free = 1; } else { alc = ci_object_pool_alloc(MEM_ALLOCATOR_POOL); alc->must_free = 2; } return alc; } /*******************************************************************/ /* Buffers pool api functions */ #define BUF_SIGNATURE 0xAA55 struct mem_buffer_block { uint16_t sig; int ID; union { double __align; char ptr[1]; } data; }; #define offsetof(type,member) ((size_t) &((type*)0)->member) #define PTR_OFFSET offsetof(struct mem_buffer_block,data.ptr[0]) ci_mem_allocator_t *short_buffers[16]; ci_mem_allocator_t *long_buffers[16]; int ci_buffers_init() { int i; ci_mem_allocator_t *buf64_pool, *buf128_pool, *buf256_pool,*buf512_pool, *buf1024_pool; ci_mem_allocator_t *buf2048_pool, *buf4096_pool, *buf8192_pool, *buf16384_pool, *buf32768_pool; buf64_pool = ci_create_pool_allocator(64+PTR_OFFSET); buf128_pool = ci_create_pool_allocator(128+PTR_OFFSET); buf256_pool = ci_create_pool_allocator(256+PTR_OFFSET); buf512_pool = ci_create_pool_allocator(512+PTR_OFFSET); buf1024_pool = ci_create_pool_allocator(1024+PTR_OFFSET); buf2048_pool = ci_create_pool_allocator(2048+PTR_OFFSET); buf4096_pool = ci_create_pool_allocator(4096+PTR_OFFSET); buf8192_pool = ci_create_pool_allocator(8192+PTR_OFFSET); buf16384_pool = ci_create_pool_allocator(16384+PTR_OFFSET); buf32768_pool = ci_create_pool_allocator(32768+PTR_OFFSET); short_buffers[0] = buf64_pool; short_buffers[1] = buf128_pool; short_buffers[2] = short_buffers[3] = buf256_pool; short_buffers[4] = short_buffers[5] = short_buffers[6] = short_buffers[7] = buf512_pool; for(i=8; i<16;i++) short_buffers[i] = buf1024_pool; long_buffers[0] = buf2048_pool; long_buffers[1] = buf4096_pool; long_buffers[2] = long_buffers[3] = buf8192_pool; long_buffers[4] = long_buffers[5] = long_buffers[6] = long_buffers[7] = buf16384_pool; for(i=8; i<16;i++) long_buffers[i] = buf32768_pool; return 1; } int short_buffer_sizes[16] = { 64, 128, 256,256, 512, 512, 512, 512, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024 }; int long_buffer_sizes[16] = { 2048, 4096, 8192, 8192, 16384, 16384, 16384, 16384, 32768, 32768, 32768, 32768, 32768, 32768, 32768, 32768 }; void ci_buffers_destroy() { int i; for(i=0; i<16; i++) { if (short_buffers[i] != NULL) ci_mem_allocator_destroy(short_buffers[i]); } } void *ci_buffer_alloc(int block_size) { int type, size; struct mem_buffer_block *block = NULL; size = block_size + PTR_OFFSET; type = (block_size-1) >> 6; if (type< 16 && short_buffers[type] != NULL) { block = short_buffers[type]->alloc(short_buffers[type], size); } else if(type < 512) { type = type >> 5; if (long_buffers[type]!= NULL) { block = long_buffers[type]->alloc(long_buffers[type], size); } } if(!block) block = (struct mem_buffer_block *)malloc(size); if (!block) { ci_debug_printf(1, "Failed to allocate space for buffer of size:%d\n", block_size); return NULL; } block->sig = BUF_SIGNATURE; block->ID = block_size; ci_debug_printf(8, "Geting buffer from pool %d:%d\n", block_size, type); return (void *)block->data.ptr; } size_t ci_buffer_blocksize(const void *data) { const struct mem_buffer_block *block; int type; size_t buffer_block_size = 0; block = (const struct mem_buffer_block *)(data-PTR_OFFSET); if (block->sig != BUF_SIGNATURE) { ci_debug_printf(1,"ci_buffer_blocksize: ERROR, %p is not internal buffer. This is a bug!!!!\n", data); return 0; } type = (block->ID - 1) >> 6; if (type< 16 && short_buffers[type] != NULL) { buffer_block_size = short_buffer_sizes[type]; } else if(type < 512) { type = type >> 5; if (long_buffers[type]!= NULL) { buffer_block_size = long_buffer_sizes[type]; } } if (!buffer_block_size) buffer_block_size = block->ID; return buffer_block_size; } void * ci_buffer_realloc(void *data, int block_size) { int buffer_size = 0; struct mem_buffer_block *block; if (!data) return ci_buffer_alloc(block_size); block = (struct mem_buffer_block *)(data-PTR_OFFSET); if (block->sig != BUF_SIGNATURE) { ci_debug_printf(1,"ci_buffer_realloc: ERROR, %p is not internal buffer. This is a bug!!!!\n", data); return NULL; } buffer_size = ci_buffer_blocksize(data); assert(buffer_size > 0); ci_debug_printf(8, "Current block size for realloc: %d, requested block size: %d. The initial size: %d\n", buffer_size, block_size, block->ID); /*If no block_size created than our buffer actual size probably requires a realloc.....*/ if (block_size > buffer_size) { ci_debug_printf(10, "We are going to allocate a bigger block of size: %d\n", block_size); data = ci_buffer_alloc(block_size); if (!data) return NULL; ci_debug_printf(10, "Preserve data of size: %d\n", block->ID); memcpy(data, block->data.ptr, block->ID); ci_buffer_free(block->data.ptr); } else { /*we neeed to update block->ID to the new requested size...*/ block->ID = block_size; } return data; } void ci_buffer_free(void *data) { int block_size, type; struct mem_buffer_block *block; if (!data) return; block = (struct mem_buffer_block *)(data-PTR_OFFSET); if (block->sig != BUF_SIGNATURE) { ci_debug_printf(1,"ci_buffer_free: ERROR, %p is not internal buffer. This is a bug!!!!\n", data); return; } block_size = block->ID; type = (block_size-1) >> 6; if (type < 16 && short_buffers[type] != NULL) { short_buffers[type]->free(short_buffers[type], block); ci_debug_printf(8, "Store buffer to short pool %d:%d\n", block_size, type); } else if(type < 512) { type = type >> 5; if (long_buffers[type]!= NULL) long_buffers[type]->free(long_buffers[type], block); else free(block); ci_debug_printf(8, "Store buffer to long pool %d:%d\n", block_size, type); } else { free(block); } } /*******************************************************************/ /*Object pools */ #define OBJ_SIGNATURE 0x55AA ci_mem_allocator_t **object_pools = NULL; int object_pools_size=0; int object_pools_used=0; int ci_object_pools_init() { return 1; } void ci_object_pools_destroy() { int i; for(i=0;i< object_pools_used; i++) { if (object_pools[i] != NULL) ci_mem_allocator_destroy(object_pools[i]); } } #define STEP 128 int ci_object_pool_register(const char *name, int size) { int ID, i; ID = -1; /*search for an empty position on object_pools and assign here?*/ if(object_pools == NULL) { object_pools = malloc(STEP*sizeof(ci_mem_allocator_t *)); object_pools_size = STEP; ID = 0; } else { for(i=0; i= object_pools_used || id < 0) { /*A error message ....*/ return; } if(object_pools[id]) { ci_mem_allocator_destroy(object_pools[id]); object_pools[id] = NULL; } } void *ci_object_pool_alloc(int id) { struct mem_buffer_block *block = NULL; if(id >= object_pools_used || id < 0 || !object_pools[id]) { /*A error message ....*/ ci_debug_printf(1, "Invalid object pool %d. This is a BUG!\n", id); return NULL; } block = object_pools[id]->alloc(object_pools[id], 1/*A small size smaller than obj size*/); if(!block) { ci_debug_printf(2, "Failed to allocate object from pool %d\n", id); return NULL; } ci_debug_printf(8, "Allocating from objects pool object %d\n", id); block->sig = OBJ_SIGNATURE; block->ID = id; return (void *)block->data.ptr; } void ci_object_pool_free(void *ptr) { struct mem_buffer_block *block = (struct mem_buffer_block *)(ptr-PTR_OFFSET); if (block->sig != OBJ_SIGNATURE) { ci_debug_printf(1,"ci_object_pool_free: ERROR, %p is not internal buffer. This is a bug!!!!\n", ptr); return; } if(block->ID > object_pools_used || block->ID < 0 || !object_pools[block->ID]) { ci_debug_printf(1,"ci_object_pool_free: ERROR, %p is pointing to corrupted mem? This is a bug!!!!\n", ptr); return; } ci_debug_printf(8, "Storing to objects pool object %d\n", block->ID); object_pools[block->ID]->free(object_pools[block->ID], block); } /*******************************************************************/ /*A simple allocator implementation which uses the system malloc */ static void *os_allocator_alloc(ci_mem_allocator_t *allocator,size_t size) { return malloc(size); } static void os_allocator_free(ci_mem_allocator_t *allocator,void *p) { free(p); } static void os_allocator_reset(ci_mem_allocator_t *allocator) { /*nothing to do*/ } static void os_allocator_destroy(ci_mem_allocator_t *allocator) { /*nothing to do*/ } ci_mem_allocator_t *ci_create_os_allocator() { ci_mem_allocator_t *allocator = alloc_mem_allocator_struct(); if(!allocator) return NULL; allocator->alloc = os_allocator_alloc; allocator->free = os_allocator_free; allocator->reset = os_allocator_reset; allocator->destroy = os_allocator_destroy; allocator->data = NULL; allocator->name = NULL; allocator->type = OS_ALLOC; return allocator; } /************************************************************/ /* The serial allocator implementation */ typedef struct serial_allocator{ void *memchunk; void *curpos; void *endpos; struct serial_allocator *next; } serial_allocator_t; static serial_allocator_t *serial_allocator_build(int size) { serial_allocator_t *serial_alloc; void *buffer; size = _CI_ALIGN(size); /*The serial_allocator and mem_allocator structures will be allocated in the buffer */ if (size < sizeof(serial_allocator_t) + sizeof(ci_mem_allocator_t)) return NULL; buffer = ci_buffer_alloc(size); serial_alloc = buffer; /*The allocated block size maybe is larger, than the requested. Lets fix size to actual block size: */ size = ci_buffer_blocksize(buffer); serial_alloc->memchunk = buffer + sizeof(serial_allocator_t); size -= sizeof(serial_allocator_t); serial_alloc->curpos = serial_alloc->memchunk; serial_alloc->endpos = serial_alloc->memchunk + size; serial_alloc->next = NULL; return serial_alloc; } static void *serial_allocation(serial_allocator_t *serial_alloc, size_t size) { int max_size; void *mem; size = _CI_ALIGN(size); /*round size to a correct alignment size*/ max_size = serial_alloc->endpos - serial_alloc->memchunk; if (size > max_size) return NULL; while (size > (serial_alloc->endpos - serial_alloc->curpos)) { if (serial_alloc->next == NULL) { serial_alloc->next = serial_allocator_build(max_size); if (!serial_alloc->next) return NULL; } serial_alloc = serial_alloc->next; } mem = serial_alloc->curpos; serial_alloc->curpos += size; return mem; } static void *serial_allocator_alloc(ci_mem_allocator_t *allocator,size_t size) { serial_allocator_t *serial_alloc = (serial_allocator_t *)allocator->data; if(!serial_alloc) return NULL; return serial_allocation(serial_alloc, size); } static void serial_allocator_free(ci_mem_allocator_t *allocator,void *p) { /* We can not free :-) */ } static void serial_allocator_reset(ci_mem_allocator_t *allocator) { serial_allocator_t *serial_alloc, *sa; void *tmp; serial_alloc = (serial_allocator_t *)allocator->data; serial_alloc->curpos = serial_alloc->memchunk + _CI_ALIGN(sizeof(ci_mem_allocator_t)); sa = serial_alloc->next; serial_alloc->next = NULL; /*release any other allocated chunk*/ while (sa) { tmp = (void *)sa; ci_buffer_free(tmp); sa = sa->next; } } static void serial_allocator_destroy(ci_mem_allocator_t *allocator) { serial_allocator_t *cur, *next; if(!allocator->data) return; cur = (serial_allocator_t *)allocator->data; next = cur->next; while (cur) { ci_buffer_free((void *)cur); cur = next; if (next) next = next->next; } } ci_mem_allocator_t *ci_create_serial_allocator(int size) { ci_mem_allocator_t *allocator; serial_allocator_t *sdata= serial_allocator_build(size); /*Allocate space for ci_mem_allocator_t from our serial allocator ...*/ allocator = serial_allocation(sdata, sizeof(ci_mem_allocator_t)); if(!allocator) { ci_buffer_free((void *)sdata); return NULL; } allocator->alloc = serial_allocator_alloc; allocator->free = serial_allocator_free; allocator->reset = serial_allocator_reset; allocator->destroy = serial_allocator_destroy; allocator->data = sdata; allocator->name = NULL; allocator->type = SERIAL_ALLOC; /*It is allocated in our buffer space...*/ allocator->must_free = 0; return allocator; } /****************************************************************/ typedef struct pack_allocator{ void *memchunk; void *curpos; void *endpos; void *end; int must_free; } pack_allocator_t; /*Api functions for pack allocator:*/ void *ci_pack_allocator_alloc_unaligned(ci_mem_allocator_t *allocator, size_t size) { int max_size; void *mem; pack_allocator_t *pack_alloc; assert(allocator->type == PACK_ALLOC); pack_alloc = (pack_allocator_t *)allocator->data; if(!pack_alloc) return NULL; max_size = pack_alloc->endpos - pack_alloc->curpos; if (size > max_size) return NULL; mem = pack_alloc->curpos; pack_alloc->curpos += size; return mem; } void *ci_pack_allocator_alloc(ci_mem_allocator_t *allocator,size_t size) { size = _CI_ALIGN(size); /*round size to a correct alignment size*/ return ci_pack_allocator_alloc_unaligned(allocator, size); } void *ci_pack_allocator_alloc_from_rear(ci_mem_allocator_t *allocator, int size) { int max_size; void *mem; pack_allocator_t *pack_alloc; assert(allocator->type == PACK_ALLOC); pack_alloc = (pack_allocator_t *)allocator->data; if(!pack_alloc) return NULL; size = _CI_ALIGN(size); /*round size to a correct alignment size*/ max_size = pack_alloc->endpos - pack_alloc->curpos; if (size > max_size) return NULL; pack_alloc->endpos -= size; /*Allocate block from the end of memory block*/ mem = pack_alloc->endpos; return mem; } void ci_pack_allocator_free(ci_mem_allocator_t *allocator,void *p) { /* We can not free :-) */ } void ci_pack_allocator_reset(ci_mem_allocator_t *allocator) { pack_allocator_t *pack_alloc; assert(allocator->type == PACK_ALLOC); pack_alloc = (pack_allocator_t *)allocator->data; pack_alloc->curpos = pack_alloc->memchunk; pack_alloc->endpos = pack_alloc->end; } void ci_pack_allocator_destroy(ci_mem_allocator_t *allocator) { pack_allocator_t *pack_alloc; assert(allocator->type == PACK_ALLOC); pack_alloc = (pack_allocator_t *)allocator->data; if(pack_alloc->must_free != 0) { ci_object_pool_free(allocator->data); allocator->data = NULL; } } /*If "off" is not aligned return the first smaller aligned offset*/ #define _ALIGNED_OFFSET(off) (off != _CI_ALIGN(off) ? _CI_ALIGN(off - _CI_NBYTES_ALIGNMENT) : off) ci_mem_allocator_t *init_pack_allocator(ci_mem_allocator_t *allocator, pack_allocator_t *pack_alloc, char *memblock, size_t size, int free) { /*We may not be able to use all of the memblock size. We need to support allocating memory space from the end, so we need to have aligned the pack_alloc->end to correctly calculate memory block offsets from the end in ci_pack_allocator_alloc_from_rear function. */ size = _ALIGNED_OFFSET(size); pack_alloc->memchunk = memblock; pack_alloc->curpos =pack_alloc->memchunk; pack_alloc->end = pack_alloc->memchunk + size; pack_alloc->endpos = pack_alloc->end; pack_alloc->must_free = free; allocator->alloc = ci_pack_allocator_alloc; allocator->free = ci_pack_allocator_free; allocator->reset = ci_pack_allocator_reset; allocator->destroy = ci_pack_allocator_destroy; allocator->data = pack_alloc; allocator->name = NULL; allocator->type = PACK_ALLOC; allocator->must_free = free; return allocator; } ci_mem_allocator_t *ci_create_pack_allocator(char *memblock, size_t size) { ci_mem_allocator_t *allocator; pack_allocator_t *pack_alloc; pack_alloc = ci_object_pool_alloc(PACK_ALLOCATOR_POOL); if(!pack_alloc) return NULL; allocator = alloc_mem_allocator_struct(); if(!allocator) { ci_object_pool_free(pack_alloc); return NULL; } return init_pack_allocator(allocator, pack_alloc, memblock, size, 2); } /*similar to the above but allocates required space for pack_allocator on the given memblock*/ ci_mem_allocator_t *ci_create_pack_allocator_on_memblock(char *memblock, size_t size) { ci_mem_allocator_t *allocator; /*We need to allocate space on memblock for internal structures*/ if (size <= (_CI_ALIGN(sizeof(pack_allocator_t)) + _CI_ALIGN(sizeof(ci_mem_allocator_t)))) return NULL; pack_allocator_t *pack_alloc = (pack_allocator_t *)memblock; memblock += _CI_ALIGN(sizeof(pack_allocator_t)); size -= _CI_ALIGN(sizeof(pack_allocator_t)); allocator = (ci_mem_allocator_t *)memblock; memblock += _CI_ALIGN(sizeof(ci_mem_allocator_t)); size -= _CI_ALIGN(sizeof(ci_mem_allocator_t)); return init_pack_allocator(allocator, pack_alloc, memblock, size, 0); } int ci_pack_allocator_data_size(ci_mem_allocator_t *allocator) { assert(allocator->type == PACK_ALLOC); pack_allocator_t *pack_alloc = (pack_allocator_t *)allocator->data; return (int) (pack_alloc->curpos - pack_alloc->memchunk) + (pack_alloc->end - pack_alloc->endpos); } size_t ci_pack_allocator_required_size() { return _CI_ALIGN(sizeof(pack_allocator_t)) + _CI_ALIGN(sizeof(ci_mem_allocator_t)); } static size_t sizeof_pack_allocator() {return sizeof(pack_allocator_t);} void ci_pack_allocator_set_start_pos(ci_mem_allocator_t *allocator, void *p) { pack_allocator_t *pack_alloc; assert(allocator->type == PACK_ALLOC); pack_alloc = (pack_allocator_t *)allocator->data; assert(p >= pack_alloc->memchunk); pack_alloc->curpos = p; } void ci_pack_allocator_set_end_pos(ci_mem_allocator_t *allocator, void *p) { pack_allocator_t *pack_alloc; assert(allocator->type == PACK_ALLOC); pack_alloc = (pack_allocator_t *)allocator->data; assert(p <= pack_alloc->end); if (p == NULL) pack_alloc->endpos = pack_alloc->end; else pack_alloc->endpos = p; } /****************************************************************/ struct mem_block_item { void *data; struct mem_block_item *next; }; struct pool_allocator { int items_size; int strict; int alloc_count; int hits_count; ci_thread_mutex_t mutex; struct mem_block_item *free; struct mem_block_item *allocated; }; static struct pool_allocator *pool_allocator_build(int items_size, int strict) { struct pool_allocator *palloc; palloc = (struct pool_allocator *)malloc(sizeof(struct pool_allocator)); if(!palloc) { return NULL; } palloc->items_size = items_size; palloc->strict = strict; palloc->free = NULL; palloc->allocated = NULL; palloc->alloc_count = 0; palloc->hits_count = 0; ci_thread_mutex_init(&palloc->mutex); return palloc; } static void *pool_allocator_alloc(ci_mem_allocator_t *allocator,size_t size) { struct mem_block_item *mem_item; void *data = NULL; struct pool_allocator *palloc = (struct pool_allocator *)allocator->data; if(size > palloc->items_size) return NULL; ci_thread_mutex_lock(&palloc->mutex); if(palloc->free) { mem_item=palloc->free; palloc->free=palloc->free->next; data=mem_item->data; mem_item->data=NULL; palloc->hits_count++; } else { mem_item = malloc(sizeof(struct mem_block_item)); mem_item->data=NULL; data = malloc(palloc->items_size); palloc->alloc_count++; } mem_item->next=palloc->allocated; palloc->allocated = mem_item; ci_thread_mutex_unlock(&palloc->mutex); ci_debug_printf(8, "pool hits:%d allocations: %d\n", palloc->hits_count, palloc->alloc_count); return data; } static void pool_allocator_free(ci_mem_allocator_t *allocator,void *p) { struct mem_block_item *mem_item; struct pool_allocator *palloc = (struct pool_allocator *)allocator->data; ci_thread_mutex_lock(&palloc->mutex); if(!palloc->allocated) { /*Yes can happen! after a reset but users did not free all objects*/ free(p); } else { mem_item=palloc->allocated; palloc->allocated = palloc->allocated->next; mem_item->data = p; mem_item->next = palloc->free; palloc->free = mem_item; } ci_thread_mutex_unlock(&palloc->mutex); } static void pool_allocator_reset(ci_mem_allocator_t *allocator) { struct mem_block_item *mem_item, *cur; struct pool_allocator *palloc = (struct pool_allocator *)allocator->data; ci_thread_mutex_lock(&palloc->mutex); if(palloc->allocated) { mem_item = palloc->allocated; while(mem_item!=NULL) { cur = mem_item; mem_item = mem_item->next; free(cur); } } palloc->allocated = NULL; if(palloc->free) { mem_item = palloc->free; while(mem_item!=NULL) { cur = mem_item; mem_item = mem_item->next; free(cur->data); free(cur); } } palloc->free = NULL; ci_thread_mutex_unlock(&palloc->mutex); } static void pool_allocator_destroy(ci_mem_allocator_t *allocator) { pool_allocator_reset(allocator); struct pool_allocator *palloc = (struct pool_allocator *)allocator->data; ci_thread_mutex_destroy(&palloc->mutex); free(palloc); } ci_mem_allocator_t *ci_create_pool_allocator(int items_size) { struct pool_allocator *palloc; ci_mem_allocator_t *allocator; palloc = pool_allocator_build(items_size, 0); /*Use always malloc for ci_mem_alocator struct.*/ allocator = (ci_mem_allocator_t *) malloc(sizeof(ci_mem_allocator_t)); if (!allocator) return NULL; allocator->alloc = pool_allocator_alloc; allocator->free = pool_allocator_free; allocator->reset = pool_allocator_reset; allocator->destroy = pool_allocator_destroy; allocator->data = palloc; allocator->name = NULL; allocator->type = POOL_ALLOC; allocator->must_free = 1; return allocator; } c_icap-0.4.2/configure.ac0000664000175000017500000005403212601746523012156 00000000000000dnl Process this file with autoconf to produce a configure script. dnl AC_INIT(c_icap,m4_normalize(m4_include([VERSION.m4]))) AC_INIT(c_icap,0.4.2) CICAPLIB_VERSION=4:2:0 AC_SUBST(CICAPLIB_VERSION) dnl CICAPLIB_VERSION is the libtool current[:revision[:age]] version info dnl libtool directions about version info dnl - library source code has changed since the last update c:r:a => c:r+1:a dnl - interfaces have been added, removed, or changed c:r:a => c+1:0:a dnl - interfaces have been added c:r:a => c:r:a+1 dnl - interfaces have been removed c:r:a => c:r:0 AC_CONFIG_SRCDIR(aserver.c) AM_MAINTAINER_MODE AM_CONFIG_HEADER(autoconf.h) AM_INIT_AUTOMAKE([subdir-objects]) AC_PROG_AWK AC_PROG_CC AM_PROG_CC_C_O AC_C_BIGENDIAN AC_DISABLE_STATIC AC_LIBTOOL_DLOPEN AC_LIBTOOL_WIN32_DLL AC_PROG_LIBTOOL AC_SUBST(LIBTOOL_DEPS) dnl Define c-icap version C_ICAP_HEX_VERSION=`echo $PACKAGE_VERSION | $AWK -f $srcdir/build/c_icap_version.awk` AC_SUBST(C_ICAP_HEX_VERSION) AC_CANONICAL_HOST AC_CANONICAL_TARGET dnl Checks for OS specific flags and posix threads libraries..... case "$target_os" in linux*) CFLAGS="-D_REENTRANT $CFLAGS" THREADS_LDADD="-lpthread" THREADS_LDFLAGS="" ;; solaris2.*) CFLAGS="-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS $CFLAGS" LIBS="-lsocket -lnsl -lrt $LIBS" THREADS_LDADD="-lpthread" THREADS_LDFLAGS="" ;; freebsd5*) ## If I understand how all those threading models works correctly ## in FreeBSD I will make an option in configure script ## --with-freebsd-threads={c_r,pthreads,linuxthreads,thr} ## If I am correct I must compile c-icap with the way ## external libraries are compiled. (The clamav uses -lc_r and I had problems ## using a different threading model) ## FreeBSD linuxthreads flags # CFLAGS="-D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads $CFLAGS" # THREADS_LDADD="-llthread -lgcc_r" # THREADS_LDFLAGS="-L/usr/local/lib" ## FreeBSD Standard threads CFLAGS="-pthread -D_THREAD_SAFE $CFLAGS" THREADS_LDADD="-XCClinker -lc_r" THREADS_LDFLAGS="" ## FreeBSD has pthreads rwlocks from version 3 (I think) # AC_DEFINE(HAVE_PTHREADS_RWLOCK,1,[Define HAVE_PTHREADS_RWLOCK if pthreads library supports rwlocks]) ## 1:1 threads # CFLAGS="-D_THREAD_SAFE $CFLAGS" # THREADS_LDADD="-XCClinker -lthr" # THREADS_LDFLAGS="" ;; freebsd6*) CFLAGS="-D_THREAD_SAFE $CFLAGS" THREADS_LDADD="-XCClinker -lthr" THREADS_LDFLAGS="" ;; cygwin*) CFLAGS="-D_REENTRANT $CFLAGS" THREADS_LDADD="-lpthread" THREADS_LDFLAGS=""; iscygwin="yes" ;; *) CFLAGS="-D_REENTRANT $CFLAGS" THREADS_LDADD="-lpthread" THREADS_LDFLAGS="" ;; esac TEST_LIBS="$TEST_LIBS $THREADS_LDADD" AC_SUBST(THREADS_LDADD) AC_SUBST(THREADS_LDFLAGS) if test "x$GCC" != "x" ; then AC_USE_SYSTEM_EXTENSIONS fi CFLAGS="$CFLAGS -Wall" AC_CACHE_CHECK([for __attribute__((visibility("default")))], ac_cv_default_visibility_attribute, [ echo 'int __attribute__ ((visibility ("default"))) foo_visible (void) { return 1; } int foo_invisible(void) {return 1;}' > conftest.c ac_cv_default_visibility_attribute=no if AC_TRY_COMMAND(${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then if grep '\.hidden.*foo_invisible' conftest.s >/dev/null && ! grep '\.hidden.*foo_visible' conftest.s >/dev/null; then ac_cv_default_visibility_attribute=yes fi # Else try to detect visibility for Sun solaris: # CC -xldscope={global|hidden} # and use __global/__hidden inside C code # elif fi rm -f conftest.* ]) INVISIBILITY_CFLAG="" VISIBILITY_ATTR="0" if test $ac_cv_default_visibility_attribute = yes; then AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE, 1, [Define if __attribute__((visibility("default"))) is supported.]) INVISIBILITY_CFLAG="-fvisibility=hidden" VISIBILITY_ATTR="1" fi AC_SUBST(INVISIBILITY_CFLAG) AC_SUBST(VISIBILITY_ATTR) AC_ARG_ENABLE(large_files, [ --enable-large-files Enable large files support], [ if test $enableval = "yes"; then large_file_support="yes" else large_file_support="no" fi ], [ large_file_support="yes" ] ) echo "checking whether large file support should enabled:"$large_file_support if test $large_file_support = "yes"; then CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64" #here I must put a check if the -D_FILE_OFFSET_BITS makes the off_t an 64bit integer # and if not supported warning the user #Possibly checks for systems which supports large files using different defines.... #later ....... fi USE_IPV6="0" AC_ARG_ENABLE(ipv6, [ --enable-ipv6 Enable ipv6 support], [ if test $enableval = "yes"; then ipv6_support="yes" AC_DEFINE(HAVE_IPV6,1,[Define HAVE_IPV6 if OS supports ipv6]) USE_IPV6="1" fi ], [ ipv6_support="no" ] ) AC_SUBST(USE_IPV6) AC_ARG_ENABLE(sysvipc, [ --enable-sysvipc Enable SYSV/IPC for shared memory if supported], [ if test $enableval = "yes"; then sysvipc="yes" else sysvipc="no" fi ], [ sysvipc="yes" ] ) USE_COMPAT="0" AC_MSG_CHECKING([Keep library compatibility]) AC_ARG_ENABLE(lib_compat, [ --enable-lib-compat Enable library compatibility with older c-icap versions], [ if test $enableval = "yes"; then lib_compat="yes" AC_MSG_RESULT(yes) USE_COMPAT="1" fi ], [ lib_compat="no" AC_MSG_RESULT(no) ] ) AC_SUBST(USE_COMPAT) # Checks for programs AC_CHECK_PROG(has_doxygen, doxygen, "yes", "no") if test a"$has_doxygen" = "ayes"; then doxygen_bin=doxygen else doxygen_bin="echo Doxygen is not installed /" fi AC_SUBST(doxygen_bin) # Checks for libraries AC_ARG_WITH(perl, [ --with-perl Path to perl binary], [ case "$withval" in yes) perlbin="perl" ;; no ) perlbin=""; perlcore=""; ;; * ) perlbin=$withval ;; esac ], [ perlbin=""; perlcore=""; ] ) if test a"$perlbin" != a; then perlcore=`$perlbin -MConfig -e 'print $Config{archlib}'`/CORE; perllib=`$perlbin -MConfig -e 'print $Config{libs}'`; perlccflags=`$perlbin -MConfig -e 'print $Config{ccflags}'`; perlldflags=`$perlbin -MConfig -e 'print $Config{ccdlflags}'`; fi AC_SUBST(perlcore) AC_SUBST(perllib) AC_SUBST(perlccflags) AC_SUBST(perlldflags) AC_CHECK_LIB(dl,dlopen,DL_ADD_FLAG=" -ldl") AC_SUBST(DL_ADD_FLAG) AC_ARG_WITH(zlib, [ --with-zlib Path to zlib library], [ case "$withval" in yes) zlib=yes; ;; no) zlib=no; ;; *) zlib=$withval; ;; esac ], [ zlib=yes] ) if test a"$zlib" != "ano"; then if test a"$zlib" != "ayes"; then OLDCFLAGS=$CFLAGS OLDLDFLAGS=$LDFLAGS CFLAGS="$CFLAGS -I$zlib/include" LDFLAGS="$LDFLAGS -L$zlib/lib" AC_CHECK_LIB(z,inflate,[ZLIB_ADD_LDADD="-L$zlib/lib -lz";ZLIB_ADD_FLAG="-I$zlib/include";AC_DEFINE(HAVE_ZLIB,1,[Define HAVE_ZLIB if zlib installed])],[zlib=no]) CFLAGS=$OLDCFLAGS LDFLAGS=$OLDLDFLAGS AC_SUBST(ZLIB_ADD_LDADD) AC_SUBST(ZLIB_ADD_FLAG) else AC_CHECK_LIB(z,inflate,[ZLIB_ADD_LDADD=" -lz";AC_DEFINE(HAVE_ZLIB,1,[Define HAVE_ZLIB if zlib installed])],[zlib=no]) AC_SUBST(ZLIB_ADD_LDADD) fi fi if test a"$zlib" = "ano"; then AC_MSG_WARN("zlib required for the c-icap's internal filetype recognizer!") fi AC_ARG_WITH(bzlib, [ --with-bzlib Path to bzlib library], [ case "$withval" in yes) bzlib=yes; ;; no) bzlib=no; ;; *) bzlib=$withval; ;; esac ], [ bzlib=yes] ) if test a"$bzlib" != "ano"; then if test a"$bzlib" != "ayes"; then OLDCFLAGS=$CFLAGS OLDLDFLAGS=$LDFLAGS CFLAGS="$CFLAGS -I$bzlib/include" LDFLAGS="$LDFLAGS -L$bzlib/lib" AC_CHECK_LIB(bz2,BZ2_bzDecompressInit,[BZLIB_ADD_LDADD="-L$bzlib/lib -lbz2";BZLIB_ADD_FLAG="-I$bzlib/include";AC_DEFINE(HAVE_BZLIB,1,[Define HAVE_BZLIB if bzlib installed])],[bzlib=no]) CFLAGS=$OLDCFLAGS LDFLAGS=$OLDLDFLAGS AC_SUBST(BZLIB_ADD_LDADD) AC_SUBST(BZLIB_ADD_FLAG) else AC_CHECK_LIB(bz2,BZ2_bzDecompressInit,[BZLIB_ADD_LDADD=" -lbz2";AC_DEFINE(HAVE_BZLIB,1,[Define HAVE_BZLIB if bzlib installed])],[bzlib=no]) AC_SUBST(BZLIB_ADD_LDADD) fi fi if test a"$bzlib" = "ano"; then AC_MSG_WARN("bzlib required for the c-icap's internal filetype recognizer!") fi libdb="yes" libdbpath="" AC_ARG_WITH(bdb, [ --with-bdb Where to find Berkeley DB library ], [ case "$withval" in yes) libdb="yes" ;; no ) libdb="no" ;; * ) libdb="yes" libdbpath=$withval ;; esac ], ) if test a"$libdb" != "ano"; then if test a"$libdbpath" = "a"; then # Save old LDFLAGS and LIBS OLDLDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS" OLDLIBS=$LIBS LIBS="-ldb $OLDLIBS" echo -n "checking for Berkeley DB under standard directories... " AC_LINK_IFELSE( [ #include int main(){ int major,minor,patch; if (!db_version(&major,&minor,&patch)) return -1; return 0; } ], [BDB_ADD_LDADD=" -ldb"; libdb="yes"; echo "yes"], [libdb="no"; echo "no"] ) AC_SUBST(BDB_ADD_LDADD) #restore LDFLAGS LDFLAGS=$OLDLDFLAGS LIBS=$OLDLIBS else # Save old CFLAGS/LDFLAGS/LIBS OLDCFLAGS=$CFLAGS OLDLDFLAGS=$LDFLAGS OLDLIBS=$LIBS CFLAGS="-I$libdbpath/include $CFLAGS" LDFLAGS="-L$libdbpath/lib $LDFLAGS" LIBS="-ldb $OLDLIBS" echo -n "checking for Berkeley DB under $libdbpath... " AC_LINK_IFELSE( [ #include int main(){ int major,minor,patch; if (!db_version(&major,&minor,&patch)) return -1; return 0; } ], [BDB_ADD_LDADD="-L$libdbpath/lib -ldb"; BDB_ADD_FLAG="-I$libdbpath/include";libdb="yes"; echo "yes"], [libdb="no"; echo "no"] ) #restore CFLAGS/LDFLAGS CFLAGS=$OLDCFLAGS LDFLAGS=$OLDLDFLAGS LIBS=$OLDLIBS fi if test a"$libdb" = "ano"; then # Here we still was not able to find a working Berkeley DB library. # We are going to see if we can found a Berkeley DB located under a # libdbpath/include/db4x and lbdbpath/lib/db4x directories. if test a"$libdbpath" = "a"; then # if libdbpath is not given try with libdbpat="/usr" libdbpath="/usr" fi # Save old CFLAGS/LDFLAGS OLDCFLAGS=$CFLAGS OLDLDFLAGS=$LDFLAGS OLDLIBS=$LIBS LIBS="-ldb $OLDLIBS" for DBVER in 54 53 52 51 50 49 48 47 46 45 44 43 42; do if test -d $libdbpath/include/db$DBVER; then echo -n "checking for Berleley DB under $libdbpath/include/db$DBVER and $libdbpath/lib/db$DBVER... " CFLAGS="-I$libdbpath/include/db$DBVER $OLDCFLAGS" LDFLAGS="-L$libdbpath/lib/db$DBVER $OLDLDFLAGS" AC_LINK_IFELSE( [ #include int main(){ int major,minor,patch; if (!db_version(&major,&minor,&patch)) return -1; return 0; } ], [echo yes;BDB_ADD_LDADD="-L$libdbpath/lib/db$DBVER -ldb"; BDB_ADD_FLAG="-I$libdbpath/include/db$DBVER";libdb="yes";], [libdb="no"; echo "no";] ) fi if test a"$libdb" = "ayes"; then break; fi done #restore CFLAGS/LDFLAGS CFLAGS=$OLDCFLAGS LDFLAGS=$OLDLDFLAGS LIBS=$OLDLIBS fi AC_SUBST(BDB_ADD_LDADD) AC_SUBST(BDB_ADD_FLAG) fi if test a"$libdb" = "ayes"; then AC_DEFINE(HAVE_BDB, 1, [Define HAVE_BDB if berkeley DB is installed]) fi libldap="yes" AC_ARG_WITH(ldap, [ --with-ldap Where to find LDAP libraries ], [ case "$withval" in yes) libldap="yes" ;; no ) libldap="no" ;; * ) libldap=$withval ;; esac ], ) if test a"$libldap" != "ano"; then if test a"$libldap" != "ayes"; then OLDCFLAGS=$CFLAGS OLDLDFLAGS=$LDFLAGS CFLAGS="$CFLAGS -I$libldap/include" LDFLAGS="$LDFLAGS -L$libldap/lib" AC_CHECK_LIB(ldap, ldap_search_ext_s, [LDAP_ADD_LDADD="-L$libldap/lib -lldap"; LDAP_ADD_FLAG="-I$libldap/include"; AC_DEFINE(HAVE_LDAP, 1, [Define HAVE_LDAP if LDAP libraries are installed])], [libldap="no"] ) CFLAGS=$OLDCFLAGS LDFLAGS=$OLDLDFLAGS AC_SUBST(LDAP_ADD_LDADD) AC_SUBST(LDAP_ADD_FLAG) else AC_CHECK_LIB(ldap, ldap_search_ext_s, [LDAP_ADD_LDADD="-lldap"; AC_DEFINE(HAVE_LDAP, 1, [Define HAVE_LDAP if LDAP libraries are installed])], [libldap="no"] ) AC_SUBST(LDAP_ADD_LDADD) fi fi # Detect memcached library libmemcached="yes" libmemcachedpath="" AC_ARG_WITH(memcached, [ --with-memcached Where to find Memcached library ], [ case "$withval" in yes) libmemcached="yes" ;; no ) libmemcached="no" ;; * ) libmemcachedpath=$withval libmemcached="yes" ;; esac ], ) if test a"$libmemcached" != "ano"; then OLDCPPFLAGS=$CPPFLAGS OLDCXXFLAGS=$CXXFLAGS if test a"$libmemcachedpath" != "a"; then CPPFLAGS="-l$libmemcachedpath/include $CPPFLAGS" CXXFLAGS="-l$libmemcachedpath/include $CXXFLAGS" MEMCACHED_LDFLAGS="-L$libmemcachedpath/lib" MEMCACHED_CFLAGS="-I$libmemcachedpath/include" fi AC_CHECK_HEADERS(libmemcached/memcached.h, [libmemcached="yes"],[libmemcached="no"]) CPPFLAGS=$OLDCPPFLAGS CXXFLAGS=$OLDCXXFLAGS fi AC_SUBST(MEMCACHED_LDFLAGS) AC_SUBST(MEMCACHED_CFLAGS) # Check for header files AC_HEADER_STDC AC_CHECK_HEADERS(strings.h unistd.h sys/stat.h limits.h) SYS_TYPES_H="0" AC_CHECK_HEADERS(sys/types.h, [AC_DEFINE(HAVE_SYS_TYPES_H,1,[Define HAVE_SYS_TYPES_H if you have the header file.]) SYS_TYPES_H="1" ] ) AC_SUBST(SYS_TYPES_H) INTTYPES_H="0" AC_CHECK_HEADERS(inttypes.h, [AC_DEFINE(HAVE_INTTYPES_H,1,[Define HAVE_INTTYPES_H if you have the header file.]) INTTYPES_H="1" ] ) AC_SUBST(INTTYPES_H) # Check for PCRE regex library AC_ARG_WITH(pcre, [ --with-pcre Path to PCRE library], [ case "$withval" in yes) pcre=yes; ;; no) pcre=no; ;; *) pcre=$withval; ;; esac ], [ pcre=yes] ) if test a"$pcre" != "ano"; then if test a"$pcre" != "ayes"; then OLDCFLAGS=$CFLAGS OLDLDFLAGS=$LDFLAGS CFLAGS="$CFLAGS -I$pcre/include" LDFLAGS="$LDFLAGS -L$pcre/lib" AC_CHECK_HEADERS(pcre.h, AC_CHECK_LIB(pcre, pcre_exec,[PCRE_ADD_LDADD="-L$pcre/lib -lpcre";PCRE_ADD_FLAG="-I$pcre/include";AC_DEFINE(HAVE_PCRE,1,[Define HAVE_PCRE if pcre installed])],[pcre=no]), [pcre=no] ) CFLAGS=$OLDCFLAGS LDFLAGS=$OLDLDFLAGS AC_SUBST(PCRE_ADD_LDADD) AC_SUBST(PCRE_ADD_FLAG) else AC_CHECK_HEADERS(pcre.h, AC_CHECK_LIB(pcre, pcre_exec,[PCRE_ADD_LDADD=" -lpcre";AC_DEFINE(HAVE_PCRE,1,[Define HAVE_PCRE if pcre installed])],[pcre=no]), [pcre=no] ) AC_SUBST(PCRE_ADD_LDADD) fi fi posix_regex=no AC_CHECK_HEADERS(regex.h, [posix_regex=yes;AC_DEFINE(HAVE_REGEX,1,[Define HAVE_REGEX if regex.h exists (posix regular expressions - maybe more tests needed)])], [posix_regex=no] ) USE_REGEX=0 if test a"$pcre" = "ayes" -o a"$posix_regex" = "ayes"; then USE_REGEX=1 fi AC_SUBST(USE_REGEX) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST DEFINE_SIZE_T="0" AC_CHECK_TYPE(size_t,,[DEFINE_SIZE_T="1"]) AC_SUBST(DEFINE_SIZE_T) DEFINE_OFF_T="0" AC_CHECK_TYPE(off_t,,[DEFINE_OFF_T="1"]) AC_SUBST(DEFINE_OFF_T) AC_CHECK_SIZEOF(off_t) DEFINE_SIZE_OFF_T=$ac_cv_sizeof_off_t AC_SUBST(DEFINE_SIZE_OFF_T) AC_CHECK_SIZEOF(void *) DEFINE_SIZE_VOID_P=$ac_cv_sizeof_void_p AC_SUBST(DEFINE_SIZE_VOID_P) DEFINE_UINT8="0" AC_CHECK_TYPE(uint8_t,,[DEFINE_UINT8="1"]) AC_SUBST(DEFINE_UINT8) DEFINE_INT8="0" AC_CHECK_TYPE(int8_t,,[DEFINE_INT8="1"]) AC_SUBST(DEFINE_INT8) DEFINE_UINT64="0" AC_CHECK_TYPE(uint64_t,,[DEFINE_UINT64="1"]) AC_SUBST(DEFINE_UINT64) DEFINE_INT64="0" AC_CHECK_TYPE(int64_t,,[DEFINE_INT64="1"]) AC_SUBST(DEFINE_INT64) #some type size (currently they are not used) AC_CHECK_SIZEOF(short) DEFINE_SIZEOFF_SHORT=$ac_cv_sizeof_short AC_CHECK_SIZEOF(int) DEFINE_SIZEOFF_INT=$ac_cv_sizeof_int AC_CHECK_SIZEOF(long) DEFINE_SIZEOFF_LONG=$ac_cv_sizeof_long AC_CHECK_SIZEOF(long long) DEFINE_SIZEOFF_LONG_LONG=$ac_cv_sizeof_long_long # Checks for library functions. #Here we are changing the LIBS variable and save the current value to OLD_LIBS variable EXTRALIBS="" OLD_LIBS="$LIBS" LIBS="$LIBS $TEST_LIBS" #AC_FUNC_VPRINTF AC_CHECK_FUNCS(nanosleep, AC_DEFINE(HAVE_NANOSLEEP,1,[Define HAVE_NANOSLEEP if nanosleep exists]) ) AC_CHECK_FUNCS(inet_aton, AC_DEFINE(HAVE_INET_ATON,1,[Define HAVE_INET_ATON if inet_aton exists]) ) AC_CHECK_FUNCS(strnstr, AC_DEFINE(HAVE_STRNSTR,1,[Define HAVE_STRNSTR if strnstr exists]) ) AC_CHECK_FUNCS(strcasestr, AC_DEFINE(HAVE_STRCASESTR,1,[Define HAVE_STRCASESTR if strcasestr exists]) ) AC_CHECK_FUNCS(strncasestr, AC_DEFINE(HAVE_STRNCASESTR,1,[Define HAVE_STRNCASESTR if strncasestr exists]) ) AC_FUNC_STRERROR_R #sysv ipc SYSV_IPC="0" AC_CHECK_HEADERS(sys/ipc.h, [AC_DEFINE(HAVE_SYSV_IPC,1,[Define HAVE_SYSV_IPC if sys/ipc.h exists (maybe more tests needed)]) SYSV_IPC="1" ] ) AC_SUBST(SYSV_IPC) POSIX_MAPPED_FILES="0" AC_CHECK_FUNCS(mmap munmap, [AC_DEFINE(HAVE_POSIX_MAPPED_FILES,1,[Define HAVE_POSIX_MAPPED_FILES if mmap and munmap exists]) POSIX_MAPPED_FILES="1" ] ) AC_SUBST(POSIX_MAPPED_FILES) dnl Checking if union semun exists in this system. AC_MSG_CHECKING([if union semun defined]) AC_TRY_COMPILE( [ #include #include #include ], [union semun a_semun;], AC_DEFINE(HAVE_UNION_SEMUN,1,[Define HAVE_UNION_SEMUN if union semun defined in ipc]) AC_MSG_RESULT(yes), AC_MSG_RESULT(no), ) dnl Checking if interprocess posix semaphores works.... AC_CACHE_CHECK([if posix 1003.1b interprocess semaphores works], ac_cv_10031b_ipc_sem, [AC_TRY_RUN([ #include #include int main(int argc,char **argv){ sem_t s; pid_t pid; int status; if(sem_init(&s,1,1)!=0){ return -1; } if((pid=fork())==0){ if(sem_post(&s)<0){ exit(-1); } exit(0); } else { waitpid(pid,&status,0); if(WEXITSTATUS(status)!=0) exit(-1); } sem_destroy(&s); exit(0); } ], ac_cv_10031b_ipc_sem=yes, ac_cv_10031b_ipc_sem=no, [AC_MSG_ERROR([cross-compiling, presetting ac_cv_10031b_ipc_sem=(yes|no) will help])] ) ] ) AS_IF( [test $ac_cv_10031b_ipc_sem = yes], [AC_DEFINE(HAVE_POSIX_SEMAPHORES,1,[Define HAVE_POSIX_SEMAPHORES if posix 1003.1b semaphores works]) POSIX_SEMAPHORES="1" ],[ POSIX_SEMAPHORES="0"] ) AC_SUBST(POSIX_SEMAPHORES) dnl Checking for file locking AC_CACHE_CHECK([if fcntl file locking works], ac_cv_fcntl, [AC_TRY_RUN([ #include #include int main(int argc,char **argv){ struct flock fl; int fd; fd=open("autoconf.h.in",O_RDWR); fl.l_type=F_WRLCK; fl.l_whence=SEEK_SET; fl.l_start=0; fl.l_len=0; if(fcntl(fd,F_SETLKW,&fl)<0){ close(fd); return -1; } close(fd); return 0; } ], ac_cv_fcntl=yes, ac_cv_fcntl=no, [AC_MSG_ERROR([cross-compiling, presetting ac_cv_fcntl=(yes|no) will help])] ) ] ) AS_IF( [test $ac_cv_fcntl = yes], [AC_DEFINE(HAVE_POSIX_FILE_LOCK,1,[Define HAVE_POSIX_FILE_LOCK if posix fcntl file locking works]) POSIX_FILE_LOCK="1" ],[ POSIX_FILE_LOCK="0" ] ) AC_SUBST(POSIX_FILE_LOCK) AC_MSG_CHECKING([if posix shared mem works]) AC_TRY_COMPILE( [ #include #include #include ], [int fd = shm_open("foo", O_CREAT|O_RDWR, S_IRUSR | S_IWUSR); if (fd < 0) return 0; if (shm_unlink("foo") < 0) return 0; ], AC_DEFINE(HAVE_POSIX_SHARED_MEM, 1, [Define HAVE_POSIX_SHARED_MEM if shm_open/shm_unlink functions implemented]) [AC_MSG_RESULT(yes) POSIX_SHARED_MEM="1" ], [AC_MSG_RESULT(no) POSIX_SHARED_MEM="0" ], ) if test a"$POSIX_SHARED_MEM" = "a1"; then # Linux and solaris define the shm_open in -rt library. # This library already included in LIBS for solaris case "$target_os" in linux*) EXTRALIBS="$EXTRALIBS -lrt" ;; *) esac fi AC_SUBST(POSIX_SHARED_MEM) #pthread_rwlock PTHREADS_RWLOCK="0" AC_MSG_CHECKING([if have pthread_rwlock]) AC_TRY_COMPILE( [#include ], [pthread_rwlock_t lock;], AC_DEFINE(HAVE_PTHREADS_RWLOCK,1,[Define HAVE_PTHREADS_RWLOCK if pthreads library supports rwlocks]) PTHREADS_RWLOCK="1" AC_MSG_RESULT(yes), AC_MSG_RESULT(no), ) AC_SUBST(PTHREADS_RWLOCK) #We are pouting back real LIBS variable LIBS=$OLD_LIBS LIBS="$LIBS $EXTRALIBS" #Configure common flags MODULES_LIBADD="" if test a"$iscygwin" != a; then MODULES_LIBADD="-L../../ -licapapi" fi MODULES_CFLAGS="$INVISIBILITY_CFLAG -DCI_BUILD_MODULE" AC_SUBST(MODULES_LIBADD) AC_SUBST(MODULES_CFLAGS) #general parameters AM_CONDITIONAL(ISCYGWIN,[test a"$iscygwin" != a]) # Now determine which modules will going to build ..... AM_CONDITIONAL(USE_REGEX, [test a"$pcre" = "ayes" -o a"$posix_regex" = "ayes"]) AM_CONDITIONAL(USEPERL,[test a"$perlcore" != a]) AM_CONDITIONAL(USEBDB, [test a"$libdb" != ano]) AM_CONDITIONAL(USELDAP, [test a"$libldap" != ano]) AM_CONDITIONAL(USEMEMCACHED, [test a"$libmemcached" != ano]) AC_OUTPUT([ include/c-icap-conf.h Makefile c-icap.conf utils/Makefile services/Makefile services/echo/Makefile services/ex-206/Makefile modules/Makefile tests/Makefile docs/Makefile docs/man/Makefile ]) c_icap-0.4.2/c-icap.magic0000664000175000017500000000633112567550777012044 00000000000000# In this file defined the types of files and the groups of file types. # The predefined data types, which are not included in this file, # are ASCII, ISO-8859, EXT-ASCII, UTF (not implemented yet), HTML # which are belongs to TEXT predefined group and BINARY which # belongs to DATA predefined group. # # The line format of magic file is: # # offset:Magic:Type:Short Description:Group1[:Group2[:Group3]...] # # CURRENT GROUPS are :TEXT DATA EXECUTABLE ARCHIVE GRAPHICS STREAM DOCUMENT 0:MZ:MSEXE:DOS/W32 executable/library/driver:EXECUTABLE 0:LZ:DOSEXE:MS-DOS executable:EXECUTABLE 0:\177ELF:ELF:ELF unix executable:EXECUTABLE 0:\312\376\272\276:JavaClass:Compiled Java class:EXECUTABLE #Archives 0:Rar!:RAR:Rar archive:ARCHIVE 0:PK\003\004:ZIP:Zip archive:ARCHIVE 0:PK00PK\003\004:ZIP:Zip archive:ARCHIVE 0:\037\213:GZip:Gzip compressed file:ARCHIVE 0:BZh:BZip:BZip compressed file:ARCHIVE 0:SZDD:Compress.exe:MS Copmress.exe'd compressed data:ARCHIVE 0:\037\235:Compress:UNIX compress:ARCHIVE 0:MSCF:MSCAB:Microsoft cabinet file:ARCHIVE 257:ustar:TAR:Tar archive file:ARCHIVE 0:\355\253\356\333:RPM:Linux RPM file:ARCHIVE 0:\170\237\076\042:TNEF:Transport Neutral Encapsulation Format:ARCHIVE 20:\xDC\xA7\xC4\xFD:ZOO:Zoo archiver:ARCHIVE 2:-lh:LHA:Lha archiver:ARCHIVE #Other type of Archives 0:ITSF:MSCHM:MS Windows Html Help:ARCHIVE 0:!\012debian:debian:Debian package:ARCHIVE # Graphics 0:GIF8:GIF:GIF image data:GRAPHICS 0:BM:BMP:BMP image data:GRAPHICS 0:\377\330:JPEG:JPEG image data:GRAPHICS 0:\211PNG:PNG:PNG image data:GRAPHICS 0:\000\000\001\000:ICO:MS Windows icon resource:GRAPHICS 0:FWS:SWF:Shockwave Flash data:GRAPHICS 0:CWS:SWF:Shockwave Flash data:GRAPHICS #STREAM 0:\000\000\001\263:MPEG:MPEG video stream:STREAM 0:\000\000\001\272:MPEG::STREAM 0:RIFF:RIFF:RIFF video/audio stream:STREAM 0:OggS:OGG:Ogg Stream:STREAM 0:ID3:MP3:MP3 audio stream:STREAM 0:\377\373:MP3:MP3 audio stream:STREAM 0:\377\372:MP3:MP3 audio stream:STREAM 0:\060\046\262\165\216\146\317:ASF:WMA/WMV/ASF:STREAM 0:.ra\0375:RAF:Real audio stream:STREAM 0:.RMF:RMF:Real Media File:STREAM 0:OggS:OGG:Ogg stream data:STREAM 8:AIFF:AIFF:AIFF audio data:STREAM 8:AIFC:AIFF:AIFF-C audio data:STREAM 8:8SVX:AIFF:IFF/8SVX audio data:STREAM 0:MOVI:SGI:SGI video format:STREAM 4:moov:QTFF:Quick time video format:STREAM 4:mdat:QTFF:Quick time video format:STREAM 4:wide:QTFF:Quick time video format:STREAM 4:skip:QTFF:Quick time video format:STREAM 4:free:QTFF:Quick time video format:STREAM 8:isom:MP4:MP4 Apple video format:STREAM 8:mp41:MP4:MP4 Apple video format:STREAM 8:mp42:MP4:MP4 Apple video format:STREAM 8:mmp44:MP4:MP4 Apple video format:STREAM 8:M4A:MP4:MP4 Apple video format:STREAM 8:3gp:3GPP:3GPP Apple video format:STREAM 8:avc1:3GPP:3GPP Apple video format:STREAM #Responce from stream server :-) 0:ICY 200 OK:ShouthCast:Shouthcast audio stream:STREAM #Documents 0:\320\317\021\340\241\261:MSOFFICE:MS Office Document:DOCUMENT 0:\376\067\0\043:MSOFFICE:MS Office Document:DOCUMENT 0:\333\245-\000\000\000:MSOFFICE:MS Office Document:DOCUMENT 0:\208\207\017\224\161\177\026\225\000:MSOFFICE::DOCUMENT 4:Standard Jet DB:MSOFFICE:MS Access Database:DOCUMENT 0:%PDF-:PDF:PDF document:DOCUMENT 0:%!:PS:PostScript document:DOCUMENT 0:\004%!:PS:PostScript document:DOCUMENT c_icap-0.4.2/net_io.c0000664000175000017500000001324312567550777011327 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include #include "net_io.h" #include "debug.h" #include "net_io.h" #ifdef USE_IPV6 void ci_fill_sockaddr(ci_sockaddr_t * addr) { addr->ci_sin_family = addr->sockaddr.ss_family; if (addr->ci_sin_family == AF_INET6) { addr->ci_sin_port = ((struct sockaddr_in6 *) &(addr->sockaddr))->sin6_port; addr->ci_sin_addr = &(((struct sockaddr_in6 *) &(addr->sockaddr))->sin6_addr); addr->ci_inaddr_len = sizeof(struct in6_addr); } else { addr->ci_sin_port = ((struct sockaddr_in *) &(addr->sockaddr))->sin_port; addr->ci_sin_addr = &(((struct sockaddr_in *) &(addr->sockaddr))->sin_addr); addr->ci_inaddr_len = sizeof(struct in_addr); } } void ci_copy_sockaddr(ci_sockaddr_t * dest, ci_sockaddr_t * src) { memcpy(dest, src, sizeof(ci_sockaddr_t)); if (dest->ci_sin_family == AF_INET6) dest->ci_sin_addr = &(((struct sockaddr_in6 *) &(dest->sockaddr))->sin6_addr); else dest->ci_sin_addr = &(((struct sockaddr_in *) &(dest->sockaddr))->sin_addr); } #else void ci_fill_sockaddr(ci_sockaddr_t * addr) { addr->ci_sin_family = addr->sockaddr.sin_family; addr->ci_sin_port = addr->sockaddr.sin_port; addr->ci_sin_addr = &(addr->sockaddr.sin_addr); addr->ci_inaddr_len = sizeof(struct in_addr); } void ci_copy_sockaddr(ci_sockaddr_t * dest, ci_sockaddr_t * src) { memcpy(dest, src, sizeof(ci_sockaddr_t)); dest->ci_sin_addr = &(dest->sockaddr.sin_addr); } #endif void ci_fill_ip_t(ci_ip_t *ip_dest, ci_sockaddr_t *src) { ip_dest->family = src->ci_sin_family; memcpy(&ip_dest->address,src->ci_sin_addr,sizeof(ci_in_addr_t)); #ifdef USE_IPV6 if(ip_dest->family == AF_INET6) ci_ipv6_inaddr_hostnetmask(ip_dest->netmask); else ci_ipv4_inaddr_hostnetmask(ip_dest->netmask); #else ci_ipv4_inaddr_hostnetmask(ip_dest->netmask); #endif } #ifdef USE_IPV6 void ci_sockaddr_set_port(ci_sockaddr_t * addr, int port) { if (addr->sockaddr.ss_family == AF_INET) { ((struct sockaddr_in *) &(addr->sockaddr))->sin_port = htons(port); addr->ci_sin_port = ((struct sockaddr_in6 *) &(addr->sockaddr))->sin6_port; } else { ((struct sockaddr_in6 *) &(addr->sockaddr))->sin6_port = htons(port); addr->ci_sin_port = ((struct sockaddr_in *) &(addr->sockaddr))->sin_port; } } #else void ci_sockaddr_set_port(ci_sockaddr_t * addr, int port) { addr->sockaddr.sin_port = htons(port); addr->ci_sin_port = addr->sockaddr.sin_port; } #endif const char *ci_sockaddr_t_to_ip(ci_sockaddr_t * addr, char *ip, int maxlen) { return ci_inet_ntoa(addr->ci_sin_family, addr->ci_sin_addr, ip, maxlen); } /* Needed check in configure.in for inet_pton and inet_ntop ? For Linux and Solaris exists. But I did not found these functions in win32 for example . */ int ci_inet_aton(int af, const char *cp, void *addr) { #ifdef USE_IPV6 return inet_pton(af, cp, addr); #else #ifdef HAVE_INET_ATON return inet_aton(cp, (struct in_addr *) addr); #else ((struct in_addr *) addr)->s_addr = inet_addr(cp); if (((struct in_addr *) addr)->s_addr == 0xffffffff && strcmp(cp, "255.255.255.255") != 0) return 0; /*0xffffffff =255.255.255.255 which is a valid address */ return 1; #endif #endif /*USE_IPV6 */ } const char *ci_inet_ntoa(int af, const void *src, char *dst, int cnt) { #ifdef USE_IPV6 return inet_ntop(af, src, dst, cnt); #else unsigned char *addr_bytes; addr_bytes = (unsigned char *) src; snprintf(dst, cnt, "%d.%d.%d.%d", addr_bytes[0], addr_bytes[1], addr_bytes[2], addr_bytes[3]); dst[cnt - 1] = '\0'; return (const char *) dst; #endif } void ci_copy_connection(ci_connection_t * dest, ci_connection_t * src) { dest->fd = src->fd; ci_copy_sockaddr(&dest->claddr, &src->claddr); ci_copy_sockaddr(&dest->srvaddr, &src->srvaddr); } int ci_host_to_sockaddr_t(const char *servername, ci_sockaddr_t * addr, int proto) { int ret = 0; struct addrinfo hints, *res; memset(&hints, 0, sizeof(hints)); hints.ai_family = proto; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = 0; if ((ret = getaddrinfo(servername, NULL, &hints, &res)) != 0) { ci_debug_printf(5, "Error geting addrinfo:%s\n", gai_strerror(ret)); return 0; } //fill the addr..... and memcpy(&(addr->sockaddr), res->ai_addr, CI_SOCKADDR_SIZE); freeaddrinfo(res); ci_fill_sockaddr(addr); return 1; } /** * Close and free the given connection */ void ci_connection_destroy(ci_connection_t *connection) { if ( connection ) { if ( connection->fd >= 0 ) close(connection->fd); free(connection); } } c_icap-0.4.2/c-icap.conf0000664000175000017500000005475512601747556011716 00000000000000# # This file contains the default settings for c-icap # # # TAG: PidFile # Format: PidFile pid_file # Description: # The file to store the pid of the main process of the c-icap server. # Default: # PidFile /var/run/c-icap/c-icap.pid PidFile /var/run/c-icap/c-icap.pid # TAG: CommandsSocket # Format: CommandsSocket socket_file # Description: # The path of file to use as control socket for c-icap # Default: # CommandsSocket /var/run/c-icap/c-icap.ctl CommandsSocket /var/run/c-icap/c-icap.ctl # TAG: Timeout # Format: Timeout seconds # Description: # The time in seconds after which a connection without activity # can be cancelled. # Default: # Timeout 300 Timeout 300 # TAG: MaxKeepAliveRequests # Format: MaxKeepAliveRequests number # Description: # The maximum number of requests can be served by one connection # Set it to -1 for no limit # Default: # MaxKeepAliveRequests 100 MaxKeepAliveRequests 100 # TAG: KeepAliveTimeout # Format: KeepAliveTimeout seconds # Description: # The maximum time in seconds waiting for a new requests before a # connection will be closed. # If the value is set to -1, there is no timeout. # Default: # KeepAliveTimeout 600 KeepAliveTimeout 600 # TAG: StartServers # Format: StartServers number # Description: # The initial number of server processes. Each server process # generates a number of threads, which serve the requests. # Default: # StartServers 3 StartServers 3 # TAG: MaxServers # Format: MaxServers number # Description: # The maximum allowed number of server processes. # Default: # MaxServers 10 MaxServers 10 # TAG: MinSpareThreads # Format: MinSpareThreads number # Description: # If the number of the available threads is less than number, # the c-icap server starts a new child. # Default: # MinSpareThreads 10 MinSpareThreads 10 # TAG: MaxSpareThreads # Format: MaxSpareThreads number # Description: # If the number of the available threads is more than number then # the c-icap server kills a child. # Default: # MaxSpareThreads 20 MaxSpareThreads 20 # TAG: ThreadsPerChild # Format: ThreadsPerChild number # Description: # The number of threads per child process. # Default: # ThreadsPerChild 10 ThreadsPerChild 10 # TAG: MaxRequestsPerChild # Format: MaxRequestsPerChild number # Description: # The maximum number of requests that a child process can serve. # After this number has been reached, process dies. The goal of this # parameter is to minimize the risk of memory leaks and increase the # stability of c-icap. It can be disabled by setting its value to 0. # Default: # MaxRequestsPerChild 0 MaxRequestsPerChild 0 # TAG: InterProcessSharedMemScheme # Format: InterProcessSharedMemScheme posix | mmap | sysv # Description: # The interprocess shared mem scheme to use. Available schemes: # posix Use posix shared memory (shm_open interface) # mmap Use anonymous mmaped files as shared memory # sysv use the sysv ipc shared memory # Default: # InterProcessSharedMemScheme posix # TAG: InterProcessLockingScheme # Format: InterProcessSharedMemScheme file | sysv | posix # Description: # The interprocess locking scheme to use. Available schemes: # file Use lock file # sysv Use the sysv ipc semaphores # posix Use posix semaphores: Use it with caution you may experienced # locking problems if one or more processes crashed. # Default: # InterProcessLockingScheme file # TAG: Port # Format: Port port # Description: # The port number that the c-icap server uses to listen to requests. # Default: # Port 1344 Port 1344 # TAG: User # Format: User username # Description: # The user owning c-icap's processes. By default, the owner is the # user who runs the program. # Default: # No value # Example: # User wwwrun # TAG: Group # Format: Group groupname # Description: # The group of users owning c-icap's processes, which, by default # is the group of the current user. # Default: # No value # Example: # Group nogroup # TAG: ServerAdmin # Format: ServerAdmin admin_mail # Description: # The Administrator of this server. Used when displaying information # about this server (logs, info service, etc) # Default: # No value ServerAdmin you@your.address # TAG: ServerName # Format: ServerName aServerName # Description: # A name for this server. Used when displaying information about this # server (logs, info service, etc) # Default: # No value ServerName YourServerName # TAG: TmpDir # Format: TmpDir dir # Description: # dir is the location of temporary files. # Default: # TmpDir /var/tmp TmpDir /var/tmp # TAG: MaxMemObject # Format: MaxMemObject bytes # Description: # The maximum memory size in bytes taken by an object which # is processed by c-icap . If the size of an object's body is # larger than the maximum size a temporary file is used. # Default: # MaxMemObject 131072 MaxMemObject 131072 # TAG: DebugLevel # Format: DebugLevel level # Description: # The level of debugging information to be logged. # The acceptable range of levels is between 0 and 10. # Default: # DebugLevel 1 DebugLevel 1 # TAG: Pipelining # Format: Pipelining on|off # Description: # Enable or disable ICAP requests pipelining # Default: # Pipelining on Pipelining on # TAG: SupportBuggyClients # FORMAT: SupportBuggyClients on|off # Description: # Try to handle requests from buggy clients, for example ICAP requests # missing "\r\n" sequences # Default: # SupportBuggyClients off SupportBuggyClients off # TAG: Allow204As200okZeroEncaps # Format: Allow204As200okZeroEncaps # Description: # When used the c-icap instead of allow 204 return "200 OK" responses # with zero encapsulated entities. # Default: # No set # TAG: ModulesDir # Format: ModulesDir dir # Description: # The location of modules # Default: # ModulesDir /usr/local/c-icap-0.4.x/lib/c_icap ModulesDir /usr/local/c-icap-0.4.x/lib/c_icap # TAG: ServicesDir # Format: ServicesDir dir # Description: # The location of services # Default: # ServicesDir /usr/local/c-icap-0.4.x/lib/c_icap ServicesDir /usr/local/c-icap-0.4.x/lib/c_icap # TAG: TemplateDir # Format: TemplateDir dir # Description: # The location of the text templates used by c-icap and its services, # categorized by language and services/modules # Default: # No value # Example: TemplateDir /usr/local/c-icap-0.4.x/share/c_icap/templates/ # TAG: TemplateDefaultLanguage # Format: TemplateDefaultLanguage lang # Description: # Sets the default language to use for text templates # Default: # TemplateDefaultLanguage en TemplateDefaultLanguage en #TemplateReloadTime 360 #TemplateCacheSize 20 #TemplateMemBufSize 8192 # TAG: LoadMagicFile # Format: LoadMagicFile path # Description: # Load a c-icap magic file. A magic file contains various # data type definitions. Look inside default c-icap.magic file # for more informations. # It can be used more than once to use multiple magic files. # Default: # LoadMagicFile /usr/local/c-icap-0.4.x/etc/c-icap.magic LoadMagicFile /usr/local/c-icap-0.4.x/etc/c-icap.magic # TAG: RemoteProxyUsers # Format: RemoteProxyUsers onoff # Description: # Set it to on if you want to use username provided by the proxy server. # This is the recomended way to use users in c-icap. # If the RemoteProxyUsers is off and c-icap configured to use users or # groups the internal authentication mechanism will be used. # Default: # RemoteProxyUsers off RemoteProxyUsers off # TAG: RemoteProxyUserHeader # Format: RemoteProxyUserHeader Header # Description: # Used to specify the icap header used by the proxy server to send # the authenticated client username to c-icap server # Default: # RemoteProxyUserHeader X-Authenticated-User RemoteProxyUserHeader X-Authenticated-User # TAG: RemoteProxyUserHeaderEncoded # Format: RemoteProxyUserHeaderEncoded onoff # Description: # Set it to off if the RemoteProxyUserHeader is not base64 encoded # Default: # RemoteProxyUserHeaderEncoded on RemoteProxyUserHeaderEncoded on # TAG: AuthMethod # Format: AuthMethod Method Authenticator # Description: # Used to define the internal authentication mechanism to use. This # feature is not well tested and may cause problems. It is better to use # RemoteProxyUser configuration. # Method is the authentication method to use (basic, digest, etc). # Currently only basic authentication method is implemented as build in # module # Authenticator currently can only be "basic_simple_db" # It can be considered as a user/password store and can be # implemented as external module. The basic_simple_db is implemented as # build it module # Default: # No set # Example: # AuthMethod basic basic_simple_db # TAG: basic.Realm # Format: basic.Realm ARealm # Description: # Specify the basic method realm # Default: # basic.Realm "Basic authentication" # Example: # basic.Realm "c-icap server authentication" # TAG: basic_simple_db.UsersDB # Format: basic_simple_db.UsersDB LookupTable # Description: # Specify the lookup table where the usernames/passwords pairs # are stored. The paswords must be unencrypted # For more information about c-icap lookup tables read c-icap server # manual page # Default: # No value # Example: # basic_simple_db.UsersDB hash:/usr/local/c-icap/etc/c-icap-users.txt # TAG: GroupSourceByGroup # Format: GroupSourceByGroup LookupTable # Description: # Defines a lookup table where the groups of users are stored indexed # by group. It can be used more than once. # For more information about c-icap lookup tables read c-icap server # manual page # Default: # No set # Example: # GroupSourceByGroup hash:/usr/local/c-icap/etc/c-icap-groups.txt # TAG: GroupSourceByUser # Format: GroupSourceByUser LookupTable # Description: # Defines a lookup table where the groups of users are stored indexed # by user. It can be used more than once. # For more information about c-icap lookup tables read c-icap server # manual page # Default: # No set # Example: # GroupSourceByUser hash:/usr/local/c-icap/etc/c-icap-user-groups.txt # TAG: acl # Format: acl name type[{param}] value1 [value2] [...] # Description: # Supported acl types are: # acl aclname service service1 ... # The servicename # acl aclname type OPTIONS|RESPMOD|REQMOD ... # The icap method # acl aclname port port1 ... # The icap server port # acl aclname src ip1/netmask1 ... # The client ip address # acl aclname srvip ip1/netmask1 ... # The c-icap server ip address # acl aclname icap_header{HeaderName} value1 ... # Matches the icap header HeaderName with value1 ... # The values are in regex form: /avalue/flags # acl aclname icap_resp_header{HeaderName} value1 ... # The icap response header # The values are in regex form: /avalue/flags # acl aclname http_req_header{HeaderName} value1 ... # The http request header # The values are in regex form: /avalue/flags # acl aclname http_resp_header{HeaderName} value1 ... # The http response header # The values are in regex form: /avalue/flags # acl aclname data_type type1 ... # The data type as recognized by the internal data type # recognizer. The types are defined in c-icap.magic file # acl aclname auth username|* ... # The authenticated users. Using * instead of username means # all users. # acl aclname group group1 ... # if the user of request belongs to given groups # acl content_length{>|<|=} value1 ... # The content length of body data if the related information # included in http headers. # The parameter can take the value <, > or = to specify that # the acl will match if content length is less, greater or # equal to acl values. # acl time value1 .... # It checks agains current time. The values format is: # [DAY[,DAY,[..]]][/][HH:MM-HH:MM] # The DAY can be one of the following: # S - Sunday # M - Monday # T - Tuesday # W - Wednesday # H - Thursday # F - Friday # A - Saturday # acl http_client_ip ip1[/netmask1] ... # The HTTP client ip address, if it is available. # Default: # None set # Examples: # acl OPTIONS type OPTIONS # acl RESPMOD type RESPMOD # acl REQMOD type REQMOD # acl ALLREQUESTS type OPTIONS RESPMOD REQMOD # acl XHEAD icap_header{X-Test} /value/ # acl ECHO service echo # acl localnet src 192.168.1.0/255.255.255.0 # acl localhost src 127.0.0.1/255.255.255.255 # acl all src 0.0.0.0/0.0.0.0 # acl BigObjects content_length{>} 5000000 # acl WorkingHours time M,T,W,H,F/8:00-18:00 # acl FreeHour time Sunday,Saturday/8:00-23:59 M,T,W,H,F/18:01-23:59 M,T,W,H,F/0:00-7.59 # TAG: icap_access # Format: icap_access allow|deny [!]acl1 ... # Description: # Allowing or denying ICAP access based on defined access lists # Default: # None set # Example: # icap_access deny XHEAD # #Allow OPTIONS method for all: # icap_access allow localnet OPTIONS # #Require authentication for all users from local network: # icap_access allow AUTH localnet # icap_access deny all # TAG: client_access # Format: client_access allow|deny acl1 [acl2] [...] # Description: # Allowing or denying connections on c-icap based on # defined access lists. Only the acl types src, srvip and port # can be used. # Default: # None set # Example: # client_access allow all # TAG: LogFormat # Format: LogFormat Name Format # Description: # Name is a name for this log format. # Format is a string with embedded % format codes. % format codes # has the following form: # % [-] [width] [{argument}] formatcode # if - is specified then the output is left aligned # if width specified then the field is exactly width size # some formatcodes support arguments given as {argument} # # Format codes: # %a: Remote IP-Address # %la: Local IP Address # %lp: Local port # %>a: Http Client IP Address. Only supported if the proxy # client supports the "X-Client-IP" header # %ho: Modified Http request header. Supports header name # as argument. If no argument given the first line returned # %huo: Modified Http request url # %ih: Icap request header. Supports header name # as argument. If no argument given the first line returned # %count - 1); /*Return the pos in the REGISTRIES array*/ } void ci_registry_clean() { ci_ptr_dyn_array_t *registry = NULL; char buf[1024]; if (!REGISTRIES) return; while((registry = (ci_ptr_dyn_array_t *)ci_ptr_array_pop_value(REGISTRIES, buf, sizeof(buf))) != NULL) { ci_debug_printf(4, "Registry %s removed\n", buf); ci_ptr_dyn_array_destroy(registry); } ci_ptr_array_destroy(REGISTRIES); REGISTRIES = NULL; } int ci_registry_iterate(const char *name, void *data, int (*fn)(void *data, const char *label, const void *)) { const ci_ptr_dyn_array_t *registry = NULL; if (!REGISTRIES || (registry = ci_ptr_array_search(REGISTRIES, name)) == NULL) { ci_debug_printf(1, "Registry '%s' does not exist!\n", name); return 0; } ci_ptr_dyn_array_iterate(registry, data, fn); return 1; } int ci_registry_add_item(const char *name, const char *label, const void *obj) { ci_ptr_dyn_array_t *registry = NULL; if (!REGISTRIES || (registry = ci_ptr_array_search(REGISTRIES, name)) == NULL) { ci_debug_printf(3, "Registry '%s' does not exist create it\n", name); if (ci_registry_create(name) < 0) return 0; registry = ci_ptr_array_search(REGISTRIES, name); } if (ci_ptr_dyn_array_add(registry, label, (void *)obj)) return ++REG_ITEMS_COUNT; return 0; } const void * ci_registry_get_item(const char *name, const char *label) { ci_ptr_dyn_array_t *registry = NULL; if (!REGISTRIES || (registry = ci_ptr_array_search(REGISTRIES, name)) == NULL) { ci_debug_printf(1, "Registry '%s' does not exist!\n", name); return NULL; } return ci_ptr_dyn_array_search(registry, label); } struct check_reg_data { const char *name; int found; int count; }; static int check_reg(void *data, const char *name, const void *val) { struct check_reg_data *rdata = (struct check_reg_data *) data; rdata->count++; if (strcmp(rdata->name, name) == 0) { rdata->found = 1; return 1; /*Found the registry, return !=0 to stop iteration*/ } return 0; } int ci_registry_get_id(const char *name) { struct check_reg_data rdata; rdata.name = name; rdata.found = 0; rdata.count = 0; if (REGISTRIES) ci_ptr_array_iterate(REGISTRIES, &rdata, check_reg); if (rdata.found) return (rdata.count - 1); else return -1; } int ci_registry_id_iterate(int reg_id, void *data, int (*fn)(void *data, const char *label, const void *)) { const ci_ptr_dyn_array_t *registry = NULL; const ci_array_item_t *ai; if (!REGISTRIES || (ai = ci_ptr_array_get_item(REGISTRIES, reg_id)) == NULL || (registry = ai->value) == NULL) { ci_debug_printf(1, "Registry with id='%d' does not exist!\n", reg_id); return 0; } ci_ptr_dyn_array_iterate(registry, data, fn); return 1; } const void * ci_registry_id_get_item(int reg_id, const char *label) { const ci_ptr_dyn_array_t *registry = NULL; const ci_array_item_t *ai; if (!REGISTRIES || (ai = ci_ptr_array_get_item(REGISTRIES, reg_id)) == NULL || (registry = ai->value) == NULL) { ci_debug_printf(1, "Registry with id='%d' does not exist!\n", reg_id); return 0; } return ci_ptr_dyn_array_search(registry, label); } c_icap-0.4.2/types_ops.c0000664000175000017500000004045212567550776012100 00000000000000/* * Copyright (C) 2004-2010 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include "net_io.h" #include "mem.h" #include "lookup_table.h" #include "cfg_param.h" #include "filetype.h" #include "debug.h" #if defined(USE_REGEX) #include "ci_regex.h" #endif /*string operators */ void *stringdup(const char *str, ci_mem_allocator_t *allocator) { char *new_s = allocator->alloc(allocator,strlen(str)+1); if(new_s) strcpy(new_s, str); return new_s; } int stringcmp(const void *key1,const void *key2) { if (!key2) return -1; return strcmp((const char *)key1,(const char *)key2); } int stringequal(const void *key1,const void *key2) { if (!key2) return 0; return strcmp((const char *)key1,(const char *)key2)==0; } size_t stringlen(const void *key) { return strlen((const char *)key)+1; } void stringfree(void *key, ci_mem_allocator_t *allocator) { allocator->free(allocator, key); } const ci_type_ops_t ci_str_ops = { stringdup, stringfree, stringcmp, stringlen, stringequal, }; int string_ext_cmp(const void *key1,const void *key2) { if (!key2) return -1; if (strcmp((const char *)key1, "*") == 0) return 0; return strcmp((const char *)key1,(const char *)key2); } int string_ext_equal(const void *key1,const void *key2) { if (!key2) return 0; if (strcmp((const char *)key1, "*") == 0) return 1; return strcmp((const char *)key1,(const char *)key2)==0; } const ci_type_ops_t ci_str_ext_ops = { stringdup, stringfree, string_ext_cmp, stringlen, string_ext_equal, }; /*int32 operators*/ void *int32_dup(const char *str, ci_mem_allocator_t *allocator) { int32_t *i; char *e = NULL; i = allocator->alloc(allocator, sizeof(int32_t)); if (i) { *i = strtol(str, &e, 10); if (*e == 'K' || *e == 'k') *i = *i * 1000; else if (*e == 'M' || *e == 'm') *i = *i * 1000000; else if (*e == 'G' || *e == 'g') *i = *i * 1000000000; } return (void *)i; } int int32_cmp(const void *key1,const void *key2) { int32_t k1, k2; k1 = *(int32_t *)key1; k2 = *(int32_t *)key2; if (k1 < k2) return -1; if (k1 > k2) return 1; return 0; } int int32_equal(const void *key1,const void *key2) { int32_t k1,k2; k1 = *(int32_t *)key1; k2 = *(int32_t *)key2; return k1 == k2; } size_t int32_len(const void *key) { return (size_t)4; } void int32_free(void *key, ci_mem_allocator_t *allocator) { /*nothing*/ allocator->free(allocator, key); } const ci_type_ops_t ci_int32_ops = { int32_dup, int32_free, int32_cmp, int32_len, int32_equal }; /*uint64 operators*/ void *uint64_dup(const char *str, ci_mem_allocator_t *allocator) { uint64_t *i; char *e = NULL; i = allocator->alloc(allocator, sizeof(uint64_t)); if (i) { *i = strtoll(str, &e, 10); if (*e == 'K' || *e == 'k') *i = *i * 1000; else if (*e == 'M' || *e == 'm') *i = *i * 1000000; else if (*e == 'G' || *e == 'g') *i = *i * 1000000000; } return (void *)i; } int uint64_cmp(const void *key1,const void *key2) { uint64_t k1,k2; k1 = *(uint64_t *)key1; k2 = *(uint64_t *)key2; if (k1 < k2) return -1; if (k1 > k2) return 1; return 0; } int uint64_equal(const void *key1,const void *key2) { uint64_t k1,k2; k1 = *(uint64_t *)key1; k2 = *(uint64_t *)key2; return k1 == k2; } void uint64_free(void *key, ci_mem_allocator_t *allocator) { allocator->free(allocator, key); } size_t uint64_len(const void *key) { return (size_t)sizeof(uint64_t); } const ci_type_ops_t ci_uint64_ops = { uint64_dup, uint64_free, uint64_cmp, uint64_len, uint64_equal }; /*regular expresion operator definition */ #if defined(USE_REGEX) /*We only need the preg field which holds the compiled regular expression but keep the uncompiled string too just for debuging reasons */ struct ci_acl_regex { char *str; int flags; ci_regex_t preg; }; /*Parse the a regular expression in the form: /regexpression/flags where flags nothing or 'i'. Examples: /^\{[a-z| ]*\}/i /^some test.*t/ */ void *regex_dup(const char *str, ci_mem_allocator_t *allocator) { struct ci_acl_regex *reg; char *newstr; int flags, recursive; newstr = ci_regex_parse(str, &flags, &recursive); if(!newstr) { ci_debug_printf(1,"Parse error, while parsing regex: '%s')!\n", str); return NULL; } reg = allocator->alloc(allocator,sizeof(struct ci_acl_regex)); if(!reg) { ci_debug_printf(1,"Error allocating memory for regex_dup (1)!\n"); free(newstr); return NULL; } if ((reg->preg = ci_regex_build(newstr, flags)) == NULL) { ci_debug_printf(1, "Error compiling regular expression :%s (%s)\n", str, newstr); allocator->free(allocator, reg); free(newstr); return NULL; } reg->str = newstr; reg->flags = flags; return reg; } int regex_cmp(const void *key1, const void *key2) { struct ci_acl_regex *reg=(struct ci_acl_regex *)key1; if (!key2) return -1; return (ci_regex_apply(reg->preg, (const char *)key2, strlen(key2), 0, NULL, NULL) == 0 ? 1 : 0); } int regex_equal(const void *key1, const void *key2) { struct ci_acl_regex *reg=(struct ci_acl_regex *)key1; if (!key2) return 0; return ci_regex_apply(reg->preg, (const char *)key2, strlen(key2), 0, NULL, NULL) != 0; } size_t regex_len(const void *key) { return strlen(((const struct ci_acl_regex *)key)->str); } void regex_free(void *key, ci_mem_allocator_t *allocator) { struct ci_acl_regex *reg=(struct ci_acl_regex *)key; ci_regex_free(reg->preg); allocator->free(allocator, reg->str); allocator->free(allocator, reg); } const ci_type_ops_t ci_regex_ops = { regex_dup, regex_free, regex_cmp, regex_len, regex_equal }; #endif /*filetype operators*/ void *datatype_dup(const char *str, ci_mem_allocator_t *allocator) { int type; unsigned int *val = allocator->alloc(allocator,sizeof(unsigned int)); if ((type = ci_magic_type_id(str)) >= 0) { *val = type; } else if ( (type = ci_magic_group_id(str)) >= 0) { *val = type; *val = *val << 16; } else { allocator->free(allocator, val); val = NULL; } return (void *)val; } int datatype_cmp(const void *key1, const void *key2) { unsigned int type = *(unsigned int *)key1; if (!key2) return -1; if ( (0xFFFF0000 & type) == 0) return (*(unsigned int *)key1 - *(unsigned int *)key2); else { /*type is group check if key2 belongs to group*/ type = type >> 16; if (ci_magic_group_check(*(unsigned int *)key2, type)) return 0; else return 1; } } int datatype_equal(const void *key1, const void *key2) { unsigned int type = *(unsigned int *)key1; if (!key2) return 0; if ( (0xFFFF0000 & type) == 0) return *(unsigned int *)key1 == *(unsigned int *)key2; else { /*type is group check if key2 belongs to group*/ type = type >> 16; if (ci_magic_group_check(*(unsigned int *)key2, (int)type)) return 1; else return 0; } } size_t datatype_len(const void *key) { return sizeof(unsigned int); } void datatype_free(void *key, ci_mem_allocator_t *allocator) { /*nothing*/ allocator->free(allocator, key); } const ci_type_ops_t ci_datatype_ops = { datatype_dup, datatype_free, datatype_cmp, datatype_len, datatype_equal }; /*IP operators*/ #ifdef HAVE_IPV6 void ci_list_ipv4_to_ipv6(); #define ci_ipv4_inaddr_is_zero(addr) ((addr).ipv4_addr.s_addr==0) #define ci_ipv4_inaddr_are_equal(addr1,addr2) ((addr1).ipv4_addr.s_addr == (addr2).ipv4_addr.s_addr) #define ci_ipv4_inaddr_zero(addr) ((addr).ipv4_addr.s_addr=0) #define ci_ipv6_inaddr_is_zero(addr) ( ci_in6_addr_u32(addr)[0]==0 && \ ci_in6_addr_u32(addr)[1]==0 && \ ci_in6_addr_u32(addr)[2]==0 && \ ci_in6_addr_u32(addr)[3]==0) #define ci_ipv6_inaddr_are_equal(addr1,addr2) ( ci_in6_addr_u32(addr1)[0]==ci_in6_addr_u32(addr2)[0] && \ ci_in6_addr_u32(addr1)[1]==ci_in6_addr_u32(addr2)[1] && \ ci_in6_addr_u32(addr1)[2]==ci_in6_addr_u32(addr2)[2] && \ ci_in6_addr_u32(addr1)[3]==ci_in6_addr_u32(addr2)[3]) #define ci_ipv6_inaddr_is_v4mapped(addr) (ci_in6_addr_u32(addr)[0]==0 &&\ ci_in6_addr_u32(addr)[1]==0 && \ ci_in6_addr_u32(addr)[2]== htonl(0xFFFF)) #define ci_ipv4_inaddr_check_net(addr1,addr2,mask) (((addr1).ipv4_addr.s_addr & (mask).ipv4_addr.s_addr)==((addr2).ipv4_addr.s_addr & (mask).ipv4_addr.s_addr)) #define ci_ipv6_inaddr_check_net(addr1,addr2,mask) ((ci_in6_addr_u32(addr1)[0] & ci_in6_addr_u32(mask)[0])==(ci_in6_addr_u32(addr2)[0] & ci_in6_addr_u32(mask)[0]) &&\ (ci_in6_addr_u32(addr1)[1] & ci_in6_addr_u32(mask)[1])==(ci_in6_addr_u32(addr2)[1] & ci_in6_addr_u32(mask)[1]) && \ (ci_in6_addr_u32(addr1)[2] & ci_in6_addr_u32(mask)[2])==(ci_in6_addr_u32(addr2)[2] & ci_in6_addr_u32(mask)[2]) && \ (ci_in6_addr_u32(addr1)[3] & ci_in6_addr_u32(mask)[3])==(ci_in6_addr_u32(addr2)[3] & ci_in6_addr_u32(mask)[3])) #define ci_ipv4_in_ipv6_check_net(addr1, addr2, mask) (ci_in6_addr_u32(addr2)[0]==0 && \ ci_in6_addr_u32(addr2)[1]==0 && \ ci_in6_addr_u32(addr2)[2]== htonl(0xFFFF) && \ ((addr1).ipv4_addr.s_addr & (mask).ipv4_addr.s_addr)==(ci_in6_addr_u32(addr2)[3] & (mask).ipv4_addr.s_addr)) #define ci_ipv6_in_ipv4_check_net(addr1, addr2, mask) (ci_in6_addr_u32(addr1)[0]==0 && \ ci_in6_addr_u32(addr1)[1]==0 && \ ci_in6_addr_u32(addr1)[2]== htonl(0xFFFF) && \ (ci_in6_addr_u32(addr1)[3] & (mask).ipv4_addr.s_addr) == ((addr2).ipv4_addr.s_addr & (mask).ipv4_addr.s_addr)) /*We can do this because ipv4_addr in practice exists in s6_addr[0]*/ #define ci_inaddr_ipv4_to_ipv6(addr)( ci_in6_addr_u32(addr)[3]=(addr).ipv4_addr.s_addr,\ ci_in6_addr_u32(addr)[0]=0, \ ci_in6_addr_u32(addr)[1]=0, \ ci_in6_addr_u32(addr)[2]= htonl(0xFFFF)) #define ci_netmask_ipv4_to_ipv6(addr)(ci_in6_addr_u32(addr)[3]=(addr).ipv4_addr.s_addr, \ ci_in6_addr_u32(addr)[0]= htonl(0xFFFFFFFF), \ ci_in6_addr_u32(addr)[1]= htonl(0xFFFFFFFF), \ ci_in6_addr_u32(addr)[2]= htonl(0xFFFFFFFF)) #else /*if no HAVE_IPV6 */ #define ci_ipv4_inaddr_is_zero(addr) ((addr).s_addr==0) #define ci_ipv4_inaddr_are_equal(addr1,addr2) ((addr1).s_addr == (addr2).s_addr) #define ci_ipv4_inaddr_check_net(addr1,addr2,mask) (((addr1).s_addr & (mask).s_addr)==((addr2).s_addr & (mask).s_addr)) #define ci_ipv4_inaddr_hostnetmask(addr)((addr).s_addr=htonl(0xFFFFFFFF)) #define ci_ipv4_inaddr_zero(addr) ((addr).s_addr=0) #endif /*ifdef HAVE_IPV6 */ void *ip_dup(const char *value, ci_mem_allocator_t *allocator){ int socket_family, len; ci_ip_t *ip; char str_addr[CI_IPLEN+1], str_netmask[CI_IPLEN+1]; char *pstr; ci_in_addr_t address, netmask; ci_inaddr_zero(address); ci_inaddr_zero(netmask); #ifdef HAVE_IPV6 if(strchr(value,':')) socket_family = AF_INET6; else #endif socket_family = AF_INET; if ((pstr=strchr(value,'/'))){ len=(pstr-value); if (len >= CI_IPLEN){ ci_debug_printf(1,"Invalid ip address (len>%d): %s\n", CI_IPLEN, value); return NULL; } strncpy(str_addr,value,len); str_addr[len] = '\0'; if(!ci_inet_aton(socket_family, str_addr, &address)){ ci_debug_printf(1,"Invalid ip address in network %s definition\n", value); return NULL; } strncpy(str_netmask, pstr+1, CI_IPLEN); str_netmask[CI_IPLEN] = '\0'; if(!ci_inet_aton(socket_family, str_netmask, &netmask)){ ci_debug_printf(1,"Invalid netmask in network %s definition\n", value); return NULL; } } else { /*No netmask defined is a host ip*/ if(!ci_inet_aton(socket_family, value, &address)){ ci_debug_printf(1,"Invalid ip address: %s\n", value); return NULL; } #ifdef HAVE_IPV6 if(socket_family==AF_INET) ci_ipv4_inaddr_hostnetmask(netmask); else ci_ipv6_inaddr_hostnetmask(netmask); #else ci_ipv4_inaddr_hostnetmask(netmask); #endif } ip= allocator->alloc(allocator, sizeof(ci_ip_t)); ip->family = socket_family; ci_inaddr_copy(ip->address, address); ci_inaddr_copy(ip->netmask, netmask); return ip; } void ip_free(void *data, ci_mem_allocator_t *allocator) { allocator->free(allocator, data); } size_t ip_len(const void *key) { return sizeof(ci_ip_t); } int ip_cmp(const void *ref_key, const void *key_check) { /*Not implemented*/ return 0; } int ip_equal(const void *ref_key, const void *key_check) { const ci_ip_t *ip_ref = (const ci_ip_t *)ref_key; const ci_ip_t *ip_check = (const ci_ip_t *)key_check; char buf[128],buf1[128],buf2[128]; if (!ip_check) return 0; ci_debug_printf(9,"going to check addresses ip address: %s %s/%s\n", ci_inet_ntoa(ip_check->family,&ip_check->address, buf, 128), ci_inet_ntoa(ip_ref->family,&ip_ref->address, buf1, 128), ci_inet_ntoa(ip_ref->family,&ip_ref->netmask, buf2, 128) ); #ifdef HAVE_IPV6 if(ip_check->family == AF_INET){ if(ip_ref->family == AF_INET) return ci_ipv4_inaddr_check_net(ip_ref->address, ip_check->address, ip_ref->netmask); //else add->family == AF_INET6 return ci_ipv6_in_ipv4_check_net(ip_ref->address, ip_check->address, ip_ref->netmask); } //else assuming ip_check->family == AF_INET6 if(ip_ref->family == AF_INET6) return ci_ipv6_inaddr_check_net(ip_ref->address, ip_check->address, ip_ref->netmask); //else ip->family == AF_INET return ci_ipv4_in_ipv6_check_net(ip_ref->address, ip_check->address, ip_ref->netmask); #else return ci_ipv4_inaddr_check_net(ip_ref->address, ip_check->address, ip_ref->netmask); #endif } int ip_sockaddr_cmp(const void *ref_key, const void *key_check) { /*Not implemented*/ return 1; } int ip_sockaddr_equal(const void *ref_key, const void *key_check) { const ci_ip_t *ip_ref = (const ci_ip_t *)ref_key; const ci_sockaddr_t *ip_check = (const ci_sockaddr_t *)key_check; char buf[128],buf1[128],buf2[128]; if (!ip_check) return 0; ci_debug_printf(9,"going to check addresses ip address: %s %s/%s\n", ci_inet_ntoa(ip_check->ci_sin_family,ip_check->ci_sin_addr, buf, 128), ci_inet_ntoa(ip_ref->family,&ip_ref->address, buf1, 128), ci_inet_ntoa(ip_ref->family,&ip_ref->netmask, buf2, 128) ); #ifdef HAVE_IPV6 if(ip_check->ci_sin_family == AF_INET){ if(ip_ref->family == AF_INET) return ci_ipv4_inaddr_check_net(ip_ref->address, *(ci_in_addr_t *)ip_check->ci_sin_addr, ip_ref->netmask); //else add->family == AF_INET6 return ci_ipv6_in_ipv4_check_net(ip_ref->address, *(ci_in_addr_t *)ip_check->ci_sin_addr, ip_ref->netmask); } //else assuming ip_check->ci_sin_family == AF_INET6 if(ip_ref->family == AF_INET6) return ci_ipv6_inaddr_check_net(ip_ref->address, *(ci_in_addr_t *)ip_check->ci_sin_addr, ip_ref->netmask); //else ip->family == AF_INET return ci_ipv4_in_ipv6_check_net(ip_ref->address, *(ci_in_addr_t *)ip_check->ci_sin_addr, ip_ref->netmask); #else return ci_ipv4_inaddr_check_net(ip_ref->address, *(ci_in_addr_t *)ip_check->ci_sin_addr, ip_ref->netmask); #endif } const ci_type_ops_t ci_ip_ops = { ip_dup, ip_free, ip_cmp, ip_len, ip_equal }; const ci_type_ops_t ci_ip_sockaddr_ops = { ip_dup, ip_free, ip_sockaddr_cmp, ip_len, ip_sockaddr_equal }; c_icap-0.4.2/missing0000755000175000017500000001533012601747524011265 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2013 Free Software Foundation, Inc. # Originally written 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, see . # 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 case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: c_icap-0.4.2/winnt_server.c0000664000175000017500000006564712567550776012615 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include #include "net_io.h" #include "proc_mutex.h" #include "debug.h" #include "log.h" #include "request.h" #include "ci_threads.h" #include "proc_threads_queues.h" #include "cfg_param.h" #include #include typedef struct server_decl { int srv_id; ci_thread_t srv_pthread; struct connections_queue *con_queue; ci_request_t *current_req; int served_requests; int served_requests_no_reallocation; } server_decl_t; ci_thread_mutex_t threads_list_mtx; server_decl_t **threads_list = NULL; ci_thread_cond_t free_server_cond; ci_thread_mutex_t counters_mtx; struct childs_queue childs_queue; child_shared_data_t *child_data; struct connections_queue *con_queue; /*Interprocess accepting mutex ....*/ ci_proc_mutex_t accept_mutex; ci_thread_t worker_thread; TCHAR *C_ICAP_CMD = TEXT("c-icap.exe -c"); extern int KEEPALIVE_TIMEOUT; extern int MAX_SECS_TO_LINGER; extern int MAX_REQUESTS_BEFORE_REALLOCATE_MEM; extern struct ci_server_conf CI_CONF; ci_socket LISTEN_SOCKET; #define hard_close_connection(connection) ci_hard_close(connection->fd) #define close_connection(connection) ci_linger_close(connection->fd,MAX_SECS_TO_LINGER) #define check_for_keepalive_data(fd) ci_wait_for_data(fd,KEEPALIVE_TIMEOUT,wait_for_read) static void exit_normaly() { int i = 0; server_decl_t *srv; ci_debug_printf(1, "Suppose that all children have already exited...\n"); while ((srv = threads_list[i]) != NULL) { if (srv->current_req) { close_connection(srv->current_req->connection); ci_request_destroy(srv->current_req); } free(srv); threads_list[i] = NULL; i++; } free(threads_list); dettach_childs_queue(&childs_queue); log_close(); } static void cancel_all_threads() { int i = 0; // ci_thread_mutex_lock(&threads_list_mtx); ci_thread_cond_broadcast(&(con_queue->queue_cond)); //What about childs that serve a request? while (threads_list[i] != NULL) { ci_debug_printf(1, "Cancel server %d, thread_id %d (%d)\n", threads_list[i]->srv_id, threads_list[i]->srv_pthread, i); ci_thread_join(threads_list[i]->srv_pthread); i++; } // ci_threadmutex_unlock(&threads_list_mtx); } server_decl_t *newthread(struct connections_queue *con_queue) { int i = 0; server_decl_t *serv; serv = (server_decl_t *) malloc(sizeof(server_decl_t)); serv->srv_id = 0; // serv->srv_pthread=pthread_self(); serv->con_queue = con_queue; serv->served_requests = 0; serv->served_requests_no_reallocation = 0; serv->current_req = NULL; return serv; } int thread_main(server_decl_t * srv) { ci_connection_t con; char clientname[CI_MAXHOSTNAMELEN + 1]; int ret, request_status = 0; //*********************** // thread_signals(); //************************* // srv->srv_id=getpid(); //Setting my pid ... // srv->srv_pthread=pthread_self(); for (;;) { if (child_data->to_be_killed) { ci_debug_printf(1, "Thread exiting.....\n"); return 1; //Exiting thread..... } if ((ret = get_from_queue(con_queue, &con)) == 0) { wait_for_queue(con_queue); //It is better that the wait_for_queue to be //moved into the get_from_queue continue; } if (ret < 0) { //An error has occured ci_debug_printf(1, "Error getting from connections queue\n"); break; } ci_netio_init(con.fd); ret = 1; if (srv->current_req == NULL) srv->current_req = newrequest(&con); else ret = recycle_request(srv->current_req, &con); if (srv->current_req == NULL || ret == 0) { ci_sockaddr_t_to_host(&(con.claddr), clientname, CI_MAXHOSTNAMELEN); ci_debug_printf(1, "Request from %s denied...\n", clientname); hard_close_connection((&con)); continue; /*The request rejected. Log an error and continue ... */ } ci_thread_mutex_lock(&counters_mtx); (child_data->freeservers)--; (child_data->usedservers)++; ci_thread_mutex_unlock(&counters_mtx); do { if ((request_status = process_request(srv->current_req)) < 0) { ci_debug_printf(1, "Process request timeout or interupted....\n"); break; // } srv->served_requests++; srv->served_requests_no_reallocation++; /*Increase served requests. I dont like this. The delay is small but I don't like... */ ci_thread_mutex_lock(&counters_mtx); (child_data->requests)++; ci_thread_mutex_unlock(&counters_mtx); log_access(srv->current_req, request_status); // break; //No keep-alive ...... if (child_data->to_be_killed) return 1; //Exiting thread..... ci_debug_printf(1, "Keep-alive:%d\n", srv->current_req->keepalive); if (srv->current_req->keepalive && check_for_keepalive_data(srv->current_req->connection-> fd) > 0) { ci_request_reset(srv->current_req); ci_debug_printf(1, "Server %d going to serve new request from client (keep-alive) \n", srv->srv_id); } else break; } while (1); if (srv->current_req) { if (request_status < 0) hard_close_connection(srv->current_req->connection); else close_connection(srv->current_req->connection); } if (srv->served_requests_no_reallocation > MAX_REQUESTS_BEFORE_REALLOCATE_MEM) { ci_debug_printf(1, "Max requests reached, reallocate memory and buffers .....\n"); ci_request_destroy(srv->current_req); srv->current_req = NULL; srv->served_requests_no_reallocation = 0; } ci_thread_mutex_lock(&counters_mtx); (child_data->freeservers)++; (child_data->usedservers)--; ci_thread_mutex_unlock(&counters_mtx); ci_thread_cond_signal(&free_server_cond); } return 1; } /*TODO: Reuse of sockets created during this function. To do this, call of DiconnectEx function needed instead of closesocket function and AcceptEx and overlapped operations must used. The connections queue needs a small redesign maybe with lists instead of connections array....*/ int worker_main(ci_socket sockfd) { ci_connection_t conn; int claddrlen = sizeof(struct sockaddr_in); // char clientname[300]; int haschild = 1, jobs_in_queue = 0; int pid = 0, error; for (;;) { //Global for if (!ci_proc_mutex_lock(&accept_mutex)) { if (child_data->to_be_killed) return 1; continue; } child_data->idle = 0; pid = (int) child_data->pid; ci_debug_printf(1, "Child %d getting requests now ...\n", pid); do { //Getting requests while we have free servers..... ci_debug_printf(1, "In accept loop..................\n"); error = 0; if (((conn.fd = accept(sockfd, (struct sockaddr *) &(conn.claddr.sockaddr), &claddrlen)) == INVALID_SOCKET) && // if(((conn.fd = WSAAccept(sockfd, (struct sockaddr *)&(conn.claddr), &claddrlen,NULL,NULL)) == INVALID_SOCKET ) && (error = WSAGetLastError())) { ci_debug_printf(1, "error accept .... %d\nExiting server ....\n", error); exit(-1); //For the moment ....... } ci_debug_printf(1, "Accepting one connection...\n"); claddrlen = sizeof(conn.srvaddr.sockaddr); getsockname(conn.fd, (struct sockaddr *) &(conn.srvaddr.sockaddr), &claddrlen); ci_fill_sockaddr(&conn.claddr); ci_fill_sockaddr(&conn.srvaddr); icap_socket_opts(sockfd, MAX_SECS_TO_LINGER); if ((jobs_in_queue = put_to_queue(con_queue, &conn)) == 0) { ci_debug_printf(1, "ERROR!!!!!!NO AVAILABLE SERVERS!!!!!!!!!\n"); // child_data->to_be_killed=GRACEFULLY; ci_debug_printf(1, "Jobs in Queue: %d, Free servers: %d, Used Servers: %d, Requests: %d\n", jobs_in_queue, child_data->freeservers, child_data->usedservers, child_data->requests); } ci_thread_mutex_lock(&counters_mtx); haschild = (child_data->freeservers ? 1 : 0); ci_thread_mutex_unlock(&counters_mtx); (child_data->connections)++; //NUM of Requests.... } while (haschild); child_data->idle = 1; ci_proc_mutex_unlock(&accept_mutex); ci_thread_mutex_lock(&counters_mtx); if (child_data->freeservers == 0) { ci_debug_printf(1, "Child %d waiting for a thread to accept more connections ...\n", pid); ci_thread_cond_wait(&free_server_cond, &counters_mtx); } ci_thread_mutex_unlock(&counters_mtx); } } void child_main(ci_socket sockfd) { int claddrlen = sizeof(ci_sockaddr_t); ci_thread_t thread; int i, retcode, haschild = 1, jobs_in_queue = 0; int pid = 0; char op; HANDLE hStdin; DWORD dwRead; // child_signals(); // pid=getpid(); hStdin = GetStdHandle(STD_INPUT_HANDLE); if ((hStdin == INVALID_HANDLE_VALUE)) ExitProcess(1); ci_thread_mutex_init(&threads_list_mtx); ci_thread_mutex_init(&counters_mtx); ci_thread_cond_init(&free_server_cond); threads_list = (server_decl_t **) malloc((CI_CONF.THREADS_PER_CHILD + 1) * sizeof(server_decl_t *)); con_queue = init_queue(CI_CONF.THREADS_PER_CHILD); for (i = 0; i < CI_CONF.THREADS_PER_CHILD; i++) { if ((threads_list[i] = newthread(con_queue)) == NULL) { exit(-1); // FATAL error..... } retcode = ci_thread_create(&thread, (void *(*)(void *)) thread_main, (void *) threads_list[i]); } threads_list[CI_CONF.THREADS_PER_CHILD] = NULL; ci_debug_printf(1, "Threads created ....\n"); retcode = ci_thread_create(&worker_thread, (void *(*)(void *)) worker_main, (void *) (sockfd)); //Listen for events from main server better.............. while (ReadFile(hStdin, &op, 1, &dwRead, NULL)) { printf("Operation Read: %c\n", op); if (op == 'q') goto end_child_main; } ci_thread_join(worker_thread); end_child_main: cancel_all_threads(); exit_normaly(); } //#define MULTICHILD #undef MULTICHILD #ifdef MULTICHILD int create_child(PROCESS_INFORMATION * pi, HANDLE * pipe) { STARTUPINFO si; SECURITY_ATTRIBUTES saAttr; HANDLE hChildStdinRd, hChildStdinWr, hChildStdinWrDup, hSaveStdin; ZeroMemory(&si, sizeof(si)); si.cb = sizeof(si); ZeroMemory(pi, sizeof(PROCESS_INFORMATION)); // Set the bInheritHandle flag so pipe handles are inherited. saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); saAttr.bInheritHandle = TRUE; saAttr.lpSecurityDescriptor = NULL; // Save the handle to the current STDIN. hSaveStdin = GetStdHandle(STD_INPUT_HANDLE); // Create a pipe for the child process's STDIN. if (!CreatePipe(&hChildStdinRd, &hChildStdinWr, &saAttr, 0)) { printf("Stdin pipe creation failed\n"); return 0; } // Set a read handle to the pipe to be STDIN. if (!SetStdHandle(STD_INPUT_HANDLE, hChildStdinRd)) { printf("Redirecting Stdin failed"); return 0; } // Duplicate the write handle to the pipe so it is not inherited. if (!DuplicateHandle(GetCurrentProcess(), hChildStdinWr, GetCurrentProcess(), &hChildStdinWrDup, 0, FALSE, // not inherited DUPLICATE_SAME_ACCESS)) { ci_debug_printf(1, "DuplicateHandle failed"); return 0; } CloseHandle(hChildStdinWr); *pipe = hChildStdinWrDup; ci_debug_printf(1, "Going to start a child...\n"); // Start the child process. if (!CreateProcessW(NULL, // No module name (use command line). C_ICAP_CMD, // Command line. NULL, // Process handle not inheritable. NULL, // Thread handle not inheritable. TRUE, // Set handle inheritance to TRUE. 0, // No creation flags. NULL, // Use parent's environment block. NULL, // Use parent's starting directory. &si, // Pointer to STARTUPINFO structure. pi) // Pointer to PROCESS_INFORMATION structure. ) { ci_debug_printf(1, "CreateProcess failed. (error:%d)\n", GetLastError()); return 0; } if (!SetStdHandle(STD_INPUT_HANDLE, hSaveStdin)) printf("Re-redirecting Stdin failed\n"); ci_debug_printf(1, "OK created....\n"); return 1; } int send_handles(DWORD child_ID, HANDLE pipe, HANDLE child_handle, SOCKET sock_fd, HANDLE accept_mtx, HANDLE shmem_id, HANDLE shmem_mtx, int qsize) { DWORD dwWritten; HANDLE dupmutex; HANDLE dupshmem, dupshmemmtx; WSAPROTOCOL_INFO sock_info; memset(&sock_info, 0, sizeof(sock_info)); if (WSADuplicateSocket(sock_fd, child_ID, &sock_info) != 0) { ci_debug_printf(1, "Error socket duplicating:%d\n", WSAGetLastError()); } DuplicateHandle(GetCurrentProcess(), accept_mtx, child_handle, &dupmutex, SYNCHRONIZE, FALSE, 0); DuplicateHandle(GetCurrentProcess(), shmem_id, child_handle, &dupshmem, SYNCHRONIZE, FALSE, DUPLICATE_SAME_ACCESS); DuplicateHandle(GetCurrentProcess(), shmem_mtx, child_handle, &dupshmemmtx, SYNCHRONIZE, FALSE, DUPLICATE_SAME_ACCESS); if (!WriteFile(pipe, &child_handle, sizeof(HANDLE), &dwWritten, NULL) || dwWritten != sizeof(HANDLE)) { ci_debug_printf(1, "Error sending handles\n"); return 0; } if (!WriteFile(pipe, &pipe, sizeof(HANDLE), &dwWritten, NULL) || dwWritten != sizeof(HANDLE)) { ci_debug_printf(1, "Error sending handles\n"); return 0; } if (!WriteFile(pipe, &dupmutex, sizeof(HANDLE), &dwWritten, NULL) || dwWritten != sizeof(HANDLE)) { ci_debug_printf(1, "Error sending handles\n"); return 0; } if (!WriteFile(pipe, &dupshmem, sizeof(HANDLE), &dwWritten, NULL) || dwWritten != sizeof(HANDLE)) { ci_debug_printf(1, "Error sending handles\n"); return 0; } if (!WriteFile(pipe, &dupshmemmtx, sizeof(HANDLE), &dwWritten, NULL) || dwWritten != sizeof(HANDLE)) { ci_debug_printf(1, "Error sending handles\n"); return 0; } if (!WriteFile(pipe, &qsize, sizeof(int), &dwWritten, NULL) || dwWritten != sizeof(int)) { ci_debug_printf(1, "Error sending handles\n"); return 0; } if (!WriteFile (pipe, &sock_info, sizeof(WSAPROTOCOL_INFO), &dwWritten, NULL) || dwWritten != sizeof(WSAPROTOCOL_INFO)) { ci_debug_printf(1, "Error sending handles\n"); return 0; } // sprintf(buf,"%d:%d:%d:%d:%d",child_handle,dupmutex,dupshmem,dupshmemmtx,qsize); // WriteFile(pipe, buf, strlen(buf)+1, &dwWritten, NULL); return 1; } HANDLE start_child(ci_socket fd) { HANDLE child_pipe; PROCESS_INFORMATION pi; if (!create_child(&pi, &child_pipe)) return 0; printf("For child %d Writing to pipe:%d\n", pi.hProcess, child_pipe); send_handles(pi.dwProcessId, child_pipe, pi.hProcess, fd, accept_mutex, childs_queue.shmid, childs_queue.queue_mtx, childs_queue.size); return pi.hProcess; } int do_child() { HANDLE hStdin, child_handle, parent_pipe; DWORD dwRead; WSAPROTOCOL_INFO sock_info; ci_socket sock_fd; hStdin = GetStdHandle(STD_INPUT_HANDLE); if ((hStdin == INVALID_HANDLE_VALUE)) ExitProcess(1); // ReadFile(hStdin, buf, 512, &dwRead, NULL); // printf("Reading \"%s\" from server\n",buf); // sscanf(buf,"%d:%d:%d:%d:%d",&child_handle,&accept_mutex, // &(childs_queue.shmid),&(childs_queue.queue_mtx), // &(childs_queue.size)); if (!ReadFile(hStdin, &child_handle, sizeof(HANDLE), &dwRead, NULL) || dwRead != sizeof(HANDLE)) { ci_debug_printf(1, "Error reading handles.....\n"); exit(0); } if (!ReadFile(hStdin, &parent_pipe, sizeof(HANDLE), &dwRead, NULL) || dwRead != sizeof(HANDLE)) { ci_debug_printf(1, "Error reading handles.....\n"); exit(0); } if (!ReadFile(hStdin, &accept_mutex, sizeof(HANDLE), &dwRead, NULL) || dwRead != sizeof(HANDLE)) { ci_debug_printf(1, "Error reading handles.....\n"); exit(0); } if (!ReadFile(hStdin, &(childs_queue.shmid), sizeof(HANDLE), &dwRead, NULL) || dwRead != sizeof(HANDLE)) { ci_debug_printf(1, "Error reading handles.....\n"); exit(0); } if (!ReadFile (hStdin, &(childs_queue.queue_mtx), sizeof(HANDLE), &dwRead, NULL) || dwRead != sizeof(HANDLE)) { ci_debug_printf(1, "Error reading handles.....\n"); exit(0); } if (!ReadFile(hStdin, &(childs_queue.size), sizeof(int), &dwRead, NULL) || dwRead != sizeof(int)) { ci_debug_printf(1, "Error reading handles.....\n"); exit(0); } if (!ReadFile (hStdin, &(sock_info), sizeof(WSAPROTOCOL_INFO), &dwRead, NULL) || dwRead != sizeof(WSAPROTOCOL_INFO)) { ci_debug_printf(1, "Error reading handles.....\n"); exit(0); } if ((sock_fd = WSASocket(FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, &(sock_info), 0, 0)) == INVALID_SOCKET) { ci_debug_printf(1, "Error in creating socket :%d\n", WSAGetLastError()); return 0; } if (!attach_childs_queue(&childs_queue)) { ci_debug_printf(1, "Error in new child .....\n"); return 0; } ci_debug_printf(1, "Shared memory attached....\n"); child_data = register_child(&childs_queue, child_handle, CI_CONF.THREADS_PER_CHILD, parent_pipe); ci_debug_printf(1, "child registered ....\n"); child_main(sock_fd); exit(0); } #endif int tell_child_to_die(HANDLE pipe) { DWORD dwWritten; char op = 'q'; if (!WriteFile(pipe, &op, 1, &dwWritten, NULL) || dwWritten != 1) { return 0; } return 1; } int tell_child_to_restart(HANDLE pipe) { DWORD dwWritten; char op = 'r'; if (!WriteFile(pipe, &op, 1, &dwWritten, NULL) || dwWritten != 1) { return 0; } return 1; } ci_thread_mutex_t control_process_mtx; int wait_achild_to_die() { DWORD i, count, ret; HANDLE died_child, *child_handles = malloc(sizeof(HANDLE) * childs_queue.size); child_shared_data_t *ach; while (1) { ci_thread_mutex_lock(&control_process_mtx); for (i = 0, count = 0; i < (DWORD) childs_queue.size; i++) { if (childs_queue.childs[i].pid != 0) child_handles[count++] = childs_queue.childs[i].pid; } if (count == 0) { Sleep(100); continue; } ci_thread_mutex_unlock(&control_process_mtx); ret = WaitForMultipleObjects(count, child_handles, TRUE, INFINITE); if (ret == WAIT_TIMEOUT) { ci_debug_printf(1, "What !@#$%^&!!!!! No Timeout exists!!!!!!"); continue; } if (ret == WAIT_FAILED) { ci_debug_printf(1, "Wait failed. Try again!!!!!!"); continue; } ci_thread_mutex_lock(&control_process_mtx); died_child = child_handles[ret]; ci_debug_printf(1, "Child with handle %d died, lets clean-up the queue\n", died_child); ach = get_child_data(&childs_queue, died_child); CloseHandle(ach->pipe); remove_child(&childs_queue, died_child); CloseHandle(died_child); ci_thread_mutex_unlock(&control_process_mtx); } } //int check_for_died_child(struct childs_queue *childs_queue){ int check_for_died_child(DWORD msecs) { DWORD i, count, ret; // HANDLE died_child,*child_handles=malloc(sizeof(HANDLE)*childs_queue.size); HANDLE died_child, child_handles[MAXIMUM_WAIT_OBJECTS]; child_shared_data_t *ach; for (i = 0, count = 0; i < (DWORD) childs_queue.size; i++) { if (childs_queue.childs[i].pid != (HANDLE) 0) { child_handles[count++] = childs_queue.childs[i].pid; } if (count == MAXIMUM_WAIT_OBJECTS) break; } if (count == 0) { ci_debug_printf(1, "Oups no children! waiting for a while.....\n!"); Sleep(1000); return 0; } ci_debug_printf(1, "Objects :%d (max:%d)\n", count, MAXIMUM_WAIT_OBJECTS); ret = WaitForMultipleObjects(count, child_handles, FALSE, msecs); // ret=WaitForSingleObject(child_handles[0],msecs); if (ret == WAIT_TIMEOUT) { ci_debug_printf(1, "Operation timeout, no died child....\n"); return 0; } if (ret == WAIT_FAILED) { ci_debug_printf(1, "Wait failed. Try again!!!!!!"); return 0; } died_child = child_handles[ret]; ci_debug_printf(1, "Child with handle %d died, lets clean-up the queue\n", died_child); ach = get_child_data(&childs_queue, died_child); CloseHandle(ach->pipe); remove_child(&childs_queue, died_child); CloseHandle(died_child); return 1; } int init_server(int port, int *family) { LISTEN_SOCKET = icap_init_server(port, family, MAX_SECS_TO_LINGER); if (LISTEN_SOCKET == CI_SOCKET_ERROR) return 0; return 1; } int start_server() { #ifdef MULTICHILD int child_indx, i; HANDLE child_handle; ci_thread_t mon_thread; int childs, freeservers, used, maxrequests; ci_proc_mutex_init(&accept_mutex); ci_thread_mutex_init(&control_process_mtx); if (!create_childs_queue(&childs_queue, CI_CONF.MAX_SERVERS)) { log_server(NULL, "Can't init shared memory.Fatal error, exiting!\n"); ci_debug_printf(1, "Can't init shared memory.Fatal error, exiting!\n"); exit(0); } for (i = 0; i < CI_CONF.START_SERVERS + 2; i++) { child_handle = start_child(LISTEN_SOCKET); } /*Start died childs monitor thread*/ /* ci_thread_create(&mon_thread, (void *(*)(void *))wait_achild_to_die, (void *)NULL); */ while (1) { if (check_for_died_child(5000)) continue; // Sleep(5000); childs_queue_stats(&childs_queue, &childs, &freeservers, &used, &maxrequests); ci_debug_printf(1, "Server stats: \n\t Children:%d\n\t Free servers:%d\n\tUsed servers:%d\n\tRequests served:%d\n", childs, freeservers, used, maxrequests); if ((freeservers <= CI_CONF.MIN_SPARE_THREADS && childs < CI_CONF.MAX_SERVERS) || childs < CI_CONF.START_SERVERS) { ci_debug_printf(1, "Going to start a child .....\n"); child_handle = start_child(LISTEN_SOCKET); } else if (freeservers >= CI_CONF.MAX_SPARE_THREADS && childs > CI_CONF.START_SERVERS) { ci_thread_mutex_lock(&control_process_mtx); if ((child_indx = find_an_idle_child(&childs_queue)) < 0) continue; childs_queue.childs[child_indx].to_be_killed = GRACEFULLY; tell_child_to_die(childs_queue.childs[child_indx].pipe); ci_thread_mutex_unlock(&control_process_mtx); ci_debug_printf(1, "Going to stop child %d .....\n", childs_queue.childs[child_indx].pid); } } /* for(i=0;ipid = 0; child_data->freeservers = CI_CONF.THREADS_PER_CHILD; child_data->usedservers = 0; child_data->requests = 0; child_data->connections = 0; child_data->to_be_killed = 0; child_data->idle = 1; child_main(LISTEN_SOCKET); #endif return 1; } c_icap-0.4.2/TODO0000664000175000017500000000006412567550777010373 00000000000000 TODOS: 1) SNMP support (Maybe agentx client....) c_icap-0.4.2/txtTemplate.c0000664000175000017500000003367012567550776012372 00000000000000/* * Copyright (C) 2007,2010 Trever L. Adams * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ // Additionally, you may use this file under LGPL 2 or (at your option) later #include #include #include #include #include #include #include #include #include #include #include "common.h" #include "body.h" #include "c-icap.h" #include "service.h" #include "header.h" #include "request.h" #include "debug.h" #include "txtTemplate.h" #include "simple_api.h" typedef struct { char *TEMPLATE_NAME; char *SERVICE_NAME; char *LANGUAGE; ci_membuf_t *data; time_t last_used; time_t loaded; time_t modified; int locked; int must_free; int non_cached; } txtTemplate_t; const char *TEMPLATE_DIR = NULL; const char *TEMPLATE_DEF_LANG = "en"; int TEMPLATE_RELOAD_TIME = 360; // Default time is one hour, this variable is in seconds txtTemplate_t *templates = NULL; int txtTemplateInited = 0; int TEMPLATE_CACHE_SIZE = 20; // How many templates can be cached int TEMPLATE_MEMBUF_SIZE = 8192; // Max memory for txtTemplate to expand template into txt static ci_thread_mutex_t templates_mutex; // Caller should free returned pointer static void makeTemplatePathFileName(char *path, int path_len, const char *service_name, const char *page_name, const char *lang) { snprintf(path, path_len, "%s/%s/%s/%s", TEMPLATE_DIR, service_name, lang, page_name); path[path_len-1]='\0'; } int ci_txt_template_init(void) { int i; templates = malloc(TEMPLATE_CACHE_SIZE * sizeof(txtTemplate_t)); if(templates == NULL) { ci_debug_printf(1, "Unable to allocate memory in in inittxtTemplate for template storage!\n"); return -1; } for (i = 0; i < TEMPLATE_CACHE_SIZE; i++) { // The following three elements are critical to be cleared, // the rest can be left unintialized templates[i].data = NULL; templates[i].loaded = 0; templates[i].locked = 0; templates[i].must_free = 0; templates[i].non_cached = 0; } txtTemplateInited = 1; ci_thread_mutex_init(&templates_mutex); return 1; } void ci_txt_template_set_dir(const char *dir) { TEMPLATE_DIR = dir; } void ci_txt_template_set_default_lang(const char *lang) { TEMPLATE_DEF_LANG = lang; } static int templateExpired(txtTemplate_t *template) { char path[CI_MAX_PATH]; struct stat file; time_t current_time; time(¤t_time); if (current_time - template->loaded >= TEMPLATE_RELOAD_TIME) { makeTemplatePathFileName(path, CI_MAX_PATH, template->SERVICE_NAME, template->TEMPLATE_NAME, template->LANGUAGE); if (stat(path, &file) < 0) { ci_debug_printf(1, "Can not found the text template file %s!", path); return 0; } if (file.st_mtime > template->modified) { ci_debug_printf(4, "templateFind: found: %s, %s, %s updated on disk, expired.\n", template->SERVICE_NAME, template->LANGUAGE, template->TEMPLATE_NAME); return 1; } } return 0; } //templates_mutex should be locked by caller! static void templateFree(txtTemplate_t *template) { assert(template != NULL); if (template->data == NULL) return; if (template->TEMPLATE_NAME) free(template->TEMPLATE_NAME); if (template->SERVICE_NAME) free(template->SERVICE_NAME); if (template->LANGUAGE) free(template->LANGUAGE); template->TEMPLATE_NAME = template->SERVICE_NAME = template->LANGUAGE = NULL; ci_membuf_free(template->data); template->data = NULL; } static void template_release(txtTemplate_t *template) { int must_free = 0; if (!template) return; /*It is not in cached list release allocated memory*/ if (template->non_cached) { templateFree(template); free(template); return; } if (template->must_free || templateExpired(template)) { must_free = 1; } /*It is in templates cache just unlock it*/ ci_thread_mutex_lock(&templates_mutex); template->locked--; if(template->locked < 0) template->locked = 0; if (must_free && template->locked ==0) templateFree(template); else template->must_free = must_free; ci_thread_mutex_unlock(&templates_mutex); } //templates_mutex should not be locked by caller! void ci_txt_template_reset(void) { int i = 0; ci_thread_mutex_lock(&templates_mutex); for (i = 0; i < TEMPLATE_CACHE_SIZE; i++) { templateFree(&templates[i]); } ci_thread_mutex_unlock(&templates_mutex); } /*this function is not thread safe. Will be called only in main threads at shutdown.*/ void ci_txt_template_close(void) { int i; if (!templates) return; for (i = 0; i < TEMPLATE_CACHE_SIZE; i++) { templateFree(&templates[i]); } free(templates); templates = NULL; ci_thread_mutex_destroy(&templates_mutex); } //templates_mutex should be locked by caller! static txtTemplate_t *templateFind(const char *SERVICE_NAME, const char *TEMPLATE_NAME, const char *LANGUAGE) { int i = 0; // We don't lock here as it should be locked elsewhere for (i = 0; i < TEMPLATE_CACHE_SIZE; i++) { if (templates[i].data != NULL && templates[i].must_free == 0) { if (strcmp(templates[i].SERVICE_NAME, SERVICE_NAME) == 0 && strcmp(templates[i].TEMPLATE_NAME, TEMPLATE_NAME) == 0 && strcmp(templates[i].LANGUAGE, LANGUAGE) == 0) { ci_debug_printf(4, "templateFind: found: %s, %s, %s in cache at index %d\n", SERVICE_NAME, LANGUAGE, TEMPLATE_NAME, i); return &templates[i]; } } } return NULL; } //templates_mutex should be locked by caller! static txtTemplate_t *templateFindFree(void) { time_t oldest = 0; txtTemplate_t *useme = NULL; int i = 0; // We don't lock here as it should be locked elsewhere // First we try to find an unused template slot for (i = 0; i < TEMPLATE_CACHE_SIZE; i++) if (templates[i].data == NULL) return &templates[i]; // We didn't find one, so look for most unused for (i = 0; i < TEMPLATE_CACHE_SIZE; i++) { if (templates[i].last_used < oldest && templates[i].locked <= 0) { oldest = templates[i].last_used; useme = &templates[i]; } } if (useme != NULL) if (useme->data != NULL) templateFree(useme); return useme; } static txtTemplate_t *templateTryLoadText(const ci_request_t * req, const char *service_name, const char *page_name, const char *lang) { int fd; char path[CI_MAX_PATH]; char buf[4096]; struct stat file; ssize_t len; ci_membuf_t *textbuff = NULL; txtTemplate_t *tempTemplate = NULL; time_t current_time; time(¤t_time); // Protect the template cache structure ci_thread_mutex_lock(&templates_mutex); tempTemplate = templateFind(service_name, page_name, lang); if (tempTemplate != NULL) { tempTemplate->last_used = current_time; tempTemplate->locked++; ci_thread_mutex_unlock(&templates_mutex); // unlock the templates structure return tempTemplate; } ci_thread_mutex_unlock(&templates_mutex); // We didn't go into the if, release the lock makeTemplatePathFileName(path, CI_MAX_PATH, service_name, page_name, lang); ci_debug_printf(9, "templateTryLoadText: %s\n", path); fd = open(path, O_RDONLY); if (fd < 0) { ci_debug_printf(4, "templateTryLoadText: '%s': %s\n", path, strerror(errno)); return NULL; } fstat(fd, &file); /* TODO: do not allow txttemplates bigger than 64k */ textbuff = ci_membuf_new_sized(file.st_size + 1); if (!textbuff) { ci_debug_printf(1, "templateTryLoadText: membuf allocation failed!\n"); return NULL; } while ((len = read(fd, buf, sizeof(buf))) > 0) { ci_membuf_write(textbuff, buf, len, 0); } close(fd); if (len < 0) { ci_debug_printf(4, "templateTryLoadText: failed to fully read: '%s': %s\n", path, strerror(errno)); ci_membuf_free(textbuff); return NULL; } ci_membuf_write(textbuff, "\0", 1, 1); // terminate the string for safety // Protect the template cache structure ci_thread_mutex_lock(&templates_mutex); // Find free template tempTemplate = templateFindFree(); if (tempTemplate != NULL) { tempTemplate->locked++; tempTemplate->non_cached = 0; } else { ci_debug_printf(4, "templateTryLoadText: Unable to find free template slot.\n"); tempTemplate = malloc(sizeof(txtTemplate_t )); if (!tempTemplate) { ci_debug_printf(1, "templateTryLoadText: memory allocation error!\n"); ci_thread_mutex_unlock(&templates_mutex); ci_membuf_free(textbuff); return NULL; } tempTemplate->non_cached = 1; } tempTemplate->SERVICE_NAME = strdup(service_name); tempTemplate->TEMPLATE_NAME = strdup(page_name); tempTemplate->LANGUAGE = strdup(lang); tempTemplate->data = textbuff; tempTemplate->loaded = current_time; tempTemplate->modified = file.st_mtime; tempTemplate->last_used = current_time; tempTemplate->must_free = 0; // Unlock the template cache structure ci_thread_mutex_unlock(&templates_mutex); return tempTemplate; } static txtTemplate_t *templateLoadText(const ci_request_t * req, const char *service_name, const char *page_name) { const char *acceptLangHeader; const char *s; char preferred[32]; int i; txtTemplate_t *template = NULL; if ((acceptLangHeader = ci_http_request_get_header((ci_request_t *)req, "Accept-Language")) != NULL) { s = acceptLangHeader; ci_debug_printf(4, "templateLoadText: Languages are: '%s'\n", s); while ( *s != '\0') { while (*s != '\0' && isspace(*s)) s++; /* eat spaces*/ for(i=0; *s != '\0' && *s != ',' && *s!= ';' && !isspace(*s) && i < sizeof(preferred) - 1; i++,s++) preferred[i] = *s; /*Copy the language part*/ preferred[i] = '\0'; ci_debug_printf(6, "Try load the error message on language:%s\n", preferred); template = templateTryLoadText(req, service_name, page_name, preferred); if (template != NULL) { return template; } /* This is a bad idea, as currently implemented it allows frequent disk accesses. Symlinks en_GB -> en, en_US->en, etc. are probably the right answer. On thinking about it, these shouldn't trash the cash to badly.*/ /* else { str2 = strchr(preferred, '-'); if(str2) str2[0] = '\0'; ci_debug_printf(4, "templateLoadText: trying base of preferred language: '%s'\n", preferred); template = templateTryLoadText(req, service_name, page_name, preferred); if (template != NULL) { return template; } } */ while (*s != '\0' && *s != ',') s++; /*ignore the qvalue part(at least for now)*/ if (*s == ',') s++; } } ci_debug_printf(4, "templateLoadText: Accept-Language header not found or was empty!\n"); return templateTryLoadText(req, service_name, page_name, TEMPLATE_DEF_LANG); } // Caller should release the returned buffer when they have finished with it. ci_membuf_t *ci_txt_template_build_content(const ci_request_t *req, const char *SERVICE_NAME, const char *TEMPLATE_NAME, struct ci_fmt_entry *user_table) { ci_membuf_t *content; char templpath[CI_MAX_PATH]; txtTemplate_t *template = NULL; content = ci_membuf_new_sized(TEMPLATE_MEMBUF_SIZE); if (!content) { ci_debug_printf(1, "Failed to allocate buffer to load template!"); return NULL; } /*templateLoadText also locks the template*/ template = templateLoadText(req, SERVICE_NAME, TEMPLATE_NAME); if (template) { content->endpos = ci_format_text((ci_request_t *)req, template->data->buf, content->buf, content->bufsize, user_table); ci_membuf_write(content, "\0", 1, 1); // terminate the string for safety (????) if (template->LANGUAGE) ci_membuf_attr_add(content, "lang", template->LANGUAGE, strlen(template->LANGUAGE) + 1); template_release(template); } else { makeTemplatePathFileName(templpath, CI_MAX_PATH, SERVICE_NAME, TEMPLATE_NAME, TEMPLATE_DEF_LANG); content->endpos = snprintf(content->buf, content->bufsize, "ERROR: Unable to find specified template: %s\n", templpath); if (content->endpos > content->bufsize) content->endpos = content->bufsize; ci_membuf_attr_add(content, "lang", TEMPLATE_DEF_LANG, strlen(TEMPLATE_DEF_LANG) + 1); ci_debug_printf(1, "ERROR: Unable to find specified template: %s\n", templpath); } return content; } c_icap-0.4.2/request_common.c0000664000175000017500000013172012567550776013112 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include #include #include #include #include "debug.h" #include "request.h" #include "simple_api.h" static void * _os_malloc(int size) { return malloc(size); } static void _os_free(void *ptr) { free(ptr); } void *(*__intl_malloc)(int) = _os_malloc; void (*__intl_free)(void *) = _os_free; /* struct buf functions*/ void ci_buf_init(struct ci_buf *buf) { buf->buf = NULL; buf->size = 0; buf->used = 0; } void ci_buf_reset(struct ci_buf *buf) { buf->used = 0; } int ci_buf_mem_alloc(struct ci_buf *buf, int size) { if (!(buf->buf = __intl_malloc(size * sizeof(char)))) return 0; buf->size = size; buf->used = 0; return size; } void ci_buf_mem_free(struct ci_buf *buf) { __intl_free(buf->buf); buf->buf = NULL; buf->size = 0; buf->used = 0; } int ci_buf_write(struct ci_buf *buf, char *data, int len) { if (len > (buf->size - buf->used)) return -1; memcpy(buf->buf + buf->used, data, len); buf->used += len; return len; } int ci_buf_reset_size(struct ci_buf *buf, int req_size) { if (buf->size > req_size) return req_size; if (buf->buf) __intl_free(buf->buf); return ci_buf_mem_alloc(buf, req_size); } void ci_request_t_pack(ci_request_t * req, int is_request) { ci_encaps_entity_t **elist, *e; char buf[256]; req->packed = 1; if (is_request && req->preview >= 0) { sprintf(buf, "Preview: %d", req->preview); ci_headers_add(req->request_header, buf); } elist = req->entities; if (elist[0] != NULL) elist[0]->start = 0; if (elist[1] != NULL) { elist[1]->start = sizeofencaps(elist[0]); } if (elist[2] != NULL) { elist[2]->start = sizeofencaps(elist[1]) + elist[1]->start; } if (elist[0] == NULL) { sprintf(buf, "Encapsulated: null-body=0"); } else if (elist[2] != NULL) { sprintf(buf, "Encapsulated: %s=%d, %s=%d, %s=%d", ci_encaps_entity_string(elist[0]->type), elist[0]->start, ci_encaps_entity_string(elist[1]->type), elist[1]->start, ci_encaps_entity_string(elist[2]->type), elist[2]->start); } else if (elist[1] != NULL) { sprintf(buf, "Encapsulated: %s=%d, %s=%d", ci_encaps_entity_string(elist[0]->type), elist[0]->start, ci_encaps_entity_string(elist[1]->type), elist[1]->start); } else { /*Only req->entities[0] exists */ sprintf(buf, "Encapsulated: %s=%d", ci_encaps_entity_string(elist[0]->type), elist[0]->start); } if(is_request) ci_headers_add(req->request_header, buf); else ci_headers_add(req->response_header, buf); while ((e = *elist++) != NULL) { if (e->type == ICAP_REQ_HDR || e->type == ICAP_RES_HDR) ci_headers_pack((ci_headers_list_t *) e->entity); } /*e_list is not usable now !!!!!!! */ if(is_request) ci_headers_pack(req->request_header); else ci_headers_pack(req->response_header); } void ci_request_pack(ci_request_t *req){ ci_request_t_pack(req, 1); } void ci_response_pack(ci_request_t *req){ ci_request_t_pack(req, 0); } /* Valid forms of encapsulated entities REQMOD request encapsulated_list: [reqhdr] reqbody REQMOD response encapsulated_list: {[reqhdr] reqbody} | {[reshdr] resbody} RESPMOD request encapsulated_list: [reqhdr] [reshdr] resbody RESPMOD response encapsulated_list: [reshdr] resbody OPTIONS request encapsulated_list: [optbody] OPTIONS response encapsulated_list: optbody TODO: The following function must chech request and if the encapsulated entity is valid must put it to the right position in req->entities ......... */ //alloc_an_entity ci_encaps_entity_t *ci_request_alloc_entity(ci_request_t * req, int type, int val) { ci_encaps_entity_t *e = NULL; if (type > ICAP_OPT_BODY || type < 0) { // return NULL; } if (req->trash_entities[type]) { e = req->trash_entities[type]; req->trash_entities[type] = NULL; e->type = type; e->start = val; if (e->type == ICAP_REQ_HDR || e->type == ICAP_RES_HDR) { if (e->entity) ci_headers_reset((ci_headers_list_t *)e->entity); } ci_debug_printf(8, "Get entity from trash....\n"); return e; } //Else there is no available entity to trash_entities so make a new.... ci_debug_printf(8, "Allocate a new entity of type %d\n", type); return mk_encaps_entity(type, val); } int ci_request_release_entity(ci_request_t * req, int pos) { int type = 0; if (!req->entities[pos]) return 0; type = req->entities[pos]->type; if (type > ICAP_OPT_BODY || type < 0) { //????????? destroy_encaps_entity(req->entities[pos]); req->entities[pos] = NULL; return 0; } if (req->trash_entities[type] != NULL) { ci_debug_printf(3, "ERROR!!!!! There is an entity of type %d to trash..... ", type); destroy_encaps_entity(req->trash_entities[type]); } req->trash_entities[type] = req->entities[pos]; req->entities[pos] = NULL; return 1; } ci_request_t *ci_request_alloc(ci_connection_t * connection) { ci_request_t *req; int i; req = (ci_request_t *) __intl_malloc(sizeof(ci_request_t)); if (!req) return NULL; req->connection = connection; req->packed = 0; req->user[0] = '\0'; req->access_type = 0; req->service[0] = '\0'; req->req_server[0] = '\0'; req->current_service_mod = NULL; req->service_data = NULL; req->args[0] = '\0'; req->type = -1; req->preview = -1; ci_buf_init(&(req->preview_data)); req->keepalive = 1; /*Keep alive connection is the default behaviour for icap protocol. */ req->allow204 = 0; req->allow206 = 0; req->hasbody = 0; req->responce_hasbody = 0; req->eof_received = 0; req->request_header = ci_headers_create(); req->response_header = ci_headers_create(); req->xheaders = ci_headers_create(); req->status = SEND_NOTHING; req->return_code = -1; req->pstrblock_read = NULL; req->pstrblock_read_len = 0; req->current_chunk_len = 0; req->chunk_bytes_read = 0; req->write_to_module_pending = 0; req->pstrblock_responce = NULL; req->remain_send_block_bytes = 0; req->data_locked = 1; req->i206_use_original_body = -1; req->preview_data_type = -1; req->auth_required = 0; req->log_str = NULL; req->attributes = NULL; memset(&(req->xclient_ip), 0, sizeof(ci_ip_t)); req->bytes_in = 0; req->bytes_out = 0; req->request_bytes_in = 0; req->http_bytes_in = 0; req->http_bytes_out = 0; req->body_bytes_in = 0; req->body_bytes_out = 0; for (i = 0; i < 5; i++) // req->entities[i] = NULL; for (i = 0; i < 7; i++) // req->trash_entities[i] = NULL; return req; } /*reset_request simply reset request to use it with tunneled requests The req->access_type must not be reset!!!!! Also buffers where the pstrblock_read points must not free or reset. */ void ci_request_reset(ci_request_t * req) { int i; /* memset(req->connections,0,sizeof(ci_connection)) *//*Not really needed... */ req->packed = 0; req->user[0] = '\0'; req->service[0] = '\0'; req->current_service_mod = NULL; req->service_data = NULL; req->args[0] = '\0'; req->type = -1; req->preview = -1; ci_buf_reset(&(req->preview_data)); req->keepalive = 1; /*Keep alive connection is the default behaviour for icap protocol. */ req->allow204 = 0; req->allow206 = 0; req->hasbody = 0; req->responce_hasbody = 0; ci_headers_reset(req->request_header); ci_headers_reset(req->response_header); ci_headers_reset(req->xheaders); req->eof_received = 0; req->status = SEND_NOTHING; req->return_code = -1; req->pstrblock_read = NULL; req->pstrblock_read_len = 0; req->current_chunk_len = 0; req->chunk_bytes_read = 0; req->pstrblock_responce = NULL; req->remain_send_block_bytes = 0; req->write_to_module_pending = 0; req->data_locked = 1; req->i206_use_original_body = -1; req->preview_data_type = -1; req->auth_required = 0; if (req->log_str) __intl_free(req->log_str); req->log_str = NULL; if (req->attributes) ci_array_destroy(req->attributes); req->attributes = NULL; memset(&(req->xclient_ip), 0, sizeof(ci_ip_t)); req->bytes_in = 0; req->bytes_out = 0; req->request_bytes_in = 0; req->http_bytes_in = 0; req->http_bytes_out = 0; req->body_bytes_in = 0; req->body_bytes_out = 0; for (i = 0; req->entities[i] != NULL; i++) { ci_request_release_entity(req, i); } /*Reset the encapsulated response or request headers*/ if (req->trash_entities[ICAP_REQ_HDR] && req->trash_entities[ICAP_REQ_HDR]->entity) ci_headers_reset((ci_headers_list_t *)req->trash_entities[ICAP_REQ_HDR]->entity); if (req->trash_entities[ICAP_RES_HDR] && req->trash_entities[ICAP_RES_HDR]->entity) ci_headers_reset((ci_headers_list_t *)req->trash_entities[ICAP_RES_HDR]->entity); } void ci_request_destroy(ci_request_t * req) { int i; if (req->connection) __intl_free(req->connection); ci_buf_mem_free(&(req->preview_data)); ci_headers_destroy(req->request_header); ci_headers_destroy(req->response_header); ci_headers_destroy(req->xheaders); for (i = 0; req->entities[i] != NULL; i++) destroy_encaps_entity(req->entities[i]); for (i = 0; i < 7; i++) { if (req->trash_entities[i]) destroy_encaps_entity(req->trash_entities[i]); } if (req->log_str) __intl_free(req->log_str); if (req->attributes) ci_array_destroy(req->attributes); __intl_free(req); } char *ci_request_set_log_str(ci_request_t *req, char *logstr) { int size; if (req->log_str) __intl_free(req->log_str); size = strlen(logstr) + 1; req->log_str = __intl_malloc(size*sizeof(char)); if (!req->log_str) return NULL; strcpy(req->log_str, logstr); return req->log_str; } int ci_request_set_str_attribute(ci_request_t *req, const char *name, const char *value) { if (req->attributes == NULL) { req->attributes = ci_array_new(4096); if (!req->attributes) { ci_debug_printf(1, "Error allocating request attributes array!\n"); return 0; } } if (!ci_str_array_add(req->attributes, name, value)) { ci_debug_printf(1, "Not enough space to add attribute %s:%s for service %s\n", name, value, req->service); return 0; } return 1; } int ci_request_206_origin_body(ci_request_t *req, uint64_t offset) { if (!req) return 0; if (!req->allow206) { ci_debug_printf(1, "Request does not support allow206 responses! Can not set use-original-body extension\n"); return 0; } #if 0 if (req->body_bytes_in < offset) { ci_debug_printf(1, "Can not set use-original-body extension to offset longer than the known body size"); return 0; } #endif req->i206_use_original_body = offset; return 1; } int process_encapsulated(ci_request_t * req, const char *buf) { const char *start; const char *pos; char *end; int type = 0, num = 0, val = 0; int hasbody = 1; /*Assume that we have a resbody or reqbody or optbody */ start = buf + 13; /*strlen("Encapsulated:")*/ pos = start; end = (char *)start; for (;isspace(*pos) && *pos != '\0'; ++pos); while (*pos != '\0') { type = get_encaps_type(pos, &val, &end); if (type < 0) /*parse error - return "400 bad request"*/ return EC_400; if (num > 5) /*In practice there is an error here .... */ break; if (type == ICAP_NULL_BODY) hasbody = 0; /*We have not a body */ req->entities[num++] = ci_request_alloc_entity(req, type, val); assert(start != end); pos = end; /* points after the value of entity.... */ for (;(isspace(*pos) || *pos == ',') && *pos != '\0'; ++pos); } req->hasbody = hasbody; return EC_100; } enum chunk_status { READ_CHUNK_DEF = 1, READ_CHUNK_DATA }; /* maybe the wdata must moved to the ci_request_t and write_to_module_pending must replace wdata_len */ int parse_chunk_data(ci_request_t * req, char **wdata) { char *end; const char *eofChunk; int chunkLen, remains, tmp; int read_status = 0; *wdata = NULL; if (req->write_to_module_pending) { /*We must not here if the chunk buffer did not flashed */ return CI_ERROR; } while (1) { if (req->current_chunk_len == req->chunk_bytes_read) read_status = READ_CHUNK_DEF; else read_status = READ_CHUNK_DATA; if (read_status == READ_CHUNK_DEF) { if ((eofChunk = strnstr(req->pstrblock_read, "\r\n", req->pstrblock_read_len)) == NULL) { /*Check for wrong protocol data, or possible parse error*/ if (req->pstrblock_read_len >= BUFSIZE) return CI_ERROR; /* To big chunk definition?*/ return CI_NEEDS_MORE; } eofChunk += 2; chunkLen = eofChunk - req->pstrblock_read; // Count parse data req->request_bytes_in += (eofChunk - req->pstrblock_read); errno = 0; tmp = strtol(req->pstrblock_read, &end, 16); /*here must check for erron */ if (tmp == 0 && req->pstrblock_read == end) { /*Oh .... an error ... */ ci_debug_printf(5, "Parse error:count=%d,start=%c\n", tmp, req->pstrblock_read[0]); return CI_ERROR; } req->current_chunk_len = tmp; req->chunk_bytes_read = 0; while(*end == ' ' || *end == '\t') ++end; /*ignore spaces*/ if (req->current_chunk_len == 0) { remains = req->pstrblock_read_len - chunkLen; if (remains < 2) /*missing the \r\n of the 0[; ...]\r\n\r\n of the eof chunk*/ return CI_NEEDS_MORE; if (*eofChunk != '\r' && *(eofChunk + 1) != '\n') return CI_ERROR; /* Not an \r\n\r\n eof chunk definition. Parse Error*/ eofChunk += 2; chunkLen += 2; req->request_bytes_in += 2; /*count 2 extra chars on parsed data*/ if (*end == ';') { end++; while(*end == ' ' || *end == '\t') ++end; /*ignore spaces*/ remains = req->pstrblock_read_len - (end - req->pstrblock_read); if (remains >= 18 && strncmp(end, "use-original-body=", 18) == 0) { req->i206_use_original_body = strtol(end + 18, &end, 10); } else if (remains >=4 && strncmp(end, "ieof", 4) != 0) return CI_ERROR; // ignore any char after ';' while(*end != '\r') ++end; req->eof_received = 1; } } else { read_status = READ_CHUNK_DATA; /*include the \r\n end of chunk data */ req->current_chunk_len += 2; } /*The end pointing after the number and extensions. Should point to \r\n*/ if (*end != '\r' || *(end + 1) != '\n') { /*Extra chars in chunk definition!*/ return CI_ERROR; } req->pstrblock_read_len -= chunkLen; req->pstrblock_read += chunkLen; } if (req->current_chunk_len == 0) /*zero chunk received, stop for now*/ return CI_EOF; /*if we have data for service leaving this function now */ if (req->write_to_module_pending) return CI_OK; if (read_status == READ_CHUNK_DATA) { if (req->pstrblock_read_len <= 0) { return CI_NEEDS_MORE; } *wdata = req->pstrblock_read; remains = req->current_chunk_len - req->chunk_bytes_read; if (remains <= req->pstrblock_read_len) { /*we have all the chunks data */ if (remains > 2) { req->write_to_module_pending = remains - 2; req->http_bytes_in += req->write_to_module_pending; req->body_bytes_in += req->write_to_module_pending; } else /*we are in all or part of the \r\n end of chunk data */ req->write_to_module_pending = 0; req->chunk_bytes_read += remains; req->pstrblock_read += remains; req->pstrblock_read_len -= remains; req->request_bytes_in += remains; //append parsed data } else { tmp = remains - req->pstrblock_read_len; if (tmp < 2) { req->write_to_module_pending = req->pstrblock_read_len - tmp; } else { req->write_to_module_pending = req->pstrblock_read_len; } req->http_bytes_in += req->write_to_module_pending; req->body_bytes_in += req->write_to_module_pending; req->request_bytes_in += req->pstrblock_read_len; //append parsed data req->chunk_bytes_read += req->pstrblock_read_len; req->pstrblock_read += req->pstrblock_read_len; req->pstrblock_read_len -= req->pstrblock_read_len; } } if (req->pstrblock_read_len == 0) return CI_NEEDS_MORE; } return CI_OK; } int net_data_read(ci_request_t * req) { int bytes; if (req->pstrblock_read != req->rbuf) { /*... put the current data to the begining of buf .... */ if (req->pstrblock_read_len) memmove(req->rbuf, req->pstrblock_read, req->pstrblock_read_len); req->pstrblock_read = req->rbuf; } bytes = BUFSIZE - req->pstrblock_read_len; if (bytes <= 0) { ci_debug_printf(5, "Not enough space to read data! Is this a bug (%d %d)?????\n", req->pstrblock_read_len, BUFSIZE); return CI_ERROR; } if ((bytes = ci_read_nonblock(req->connection->fd, req->rbuf + req->pstrblock_read_len, bytes)) <= 0) { /*... read some data... */ ci_debug_printf(5, "Error reading data (read return=%d, errno=%d) \n", bytes, errno); return CI_ERROR; } req->pstrblock_read_len += bytes; /* ... (size of data is readed plus old )... */ req->bytes_in += bytes; return CI_OK; } /*************************************************************************/ /* ICAP client functions */ ci_request_t *ci_client_request(ci_connection_t * conn, char *server, char *service) { ci_request_t *req; req = ci_request_alloc(conn); if (!req) { ci_debug_printf(1, "Error allocation ci_request_t object(ci_client_request())\n"); return NULL; } strncpy(req->req_server, server, CI_MAXHOSTNAMELEN); req->req_server[CI_MAXHOSTNAMELEN] = '\0'; strncpy(req->service, service, MAX_SERVICE_NAME); req->service[MAX_SERVICE_NAME] = '\0'; return req; } void ci_client_request_reuse(ci_request_t * req) { int i; req->packed = 0; req->args[0] = '\0'; req->type = -1; ci_buf_reset(&(req->preview_data)); req->hasbody = 0; req->responce_hasbody = 0; ci_headers_reset(req->request_header); ci_headers_reset(req->response_header); ci_headers_reset(req->xheaders); req->eof_received = 0; req->status = 0; req->pstrblock_read = NULL; req->pstrblock_read_len = 0; req->current_chunk_len = 0; req->chunk_bytes_read = 0; req->pstrblock_responce = NULL; req->remain_send_block_bytes = 0; req->write_to_module_pending = 0; req->data_locked = 1; req->allow204 = 0; req->allow206 = 0; req->i206_use_original_body = -1; req->bytes_in = 0; req->bytes_out = 0; req->http_bytes_in = 0; req->http_bytes_out = 0; req->body_bytes_in = 0; req->body_bytes_out = 0; for (i = 0; req->entities[i] != NULL; i++) { ci_request_release_entity(req, i); } } static int client_create_request(ci_request_t * req, char *servername, char *service, int reqtype) { char buf[256]; if (reqtype != ICAP_OPTIONS && reqtype != ICAP_REQMOD && reqtype != ICAP_RESPMOD) return CI_ERROR; req->type = reqtype; snprintf(buf, 255, "%s icap://%s/%s ICAP/1.0", ci_method_string(reqtype), servername, service); buf[255] = '\0'; ci_headers_add(req->request_header, buf); snprintf(buf, 255, "Host: %s", servername); buf[255] = '\0'; ci_headers_add(req->request_header, buf); ci_headers_add(req->request_header, "User-Agent: C-ICAP-Client-Library/0.01"); if (ci_allow204(req) && ci_allow206(req)) ci_headers_add(req->request_header, "Allow: 204, 206"); else if (ci_allow204(req)) ci_headers_add(req->request_header, "Allow: 204"); if (ci_allow206(req)) ci_headers_add(req->request_header, "Allow: 206"); if (!ci_headers_is_empty(req->xheaders)) { ci_headers_addheaders(req->request_header, req->xheaders); } return CI_OK; } static int get_request_options(ci_request_t * req, ci_headers_list_t * h) { const char *pstr; if ((pstr = ci_headers_value(h, "Preview")) != NULL) { req->preview = strtol(pstr, NULL, 10); } else req->preview = -1; req->allow204 = 0; if ((pstr = ci_headers_value(h, "Allow")) != NULL) { if (strtol(pstr, NULL, 10) == 204) req->allow204 = 1; } if ((pstr = ci_headers_value(h, "Connection")) != NULL && strncmp(pstr, "close", 5) == 0) { req->keepalive = 0; } /*Moreover we are interested for the followings */ if ((pstr = ci_headers_value(h, "Transfer-Preview")) != NULL) { /*Not implemented yet */ } if ((pstr = ci_headers_value(h, "Transfer-Ignore")) != NULL) { /*Not implemented yet */ } if ((pstr = ci_headers_value(h, "Transfer-Complete")) != NULL) { /*Not implemented yet */ } /* The headers Max-Connections and Options-TTL are not needed in this client but if this functions moves to a general client api must be implemented */ return CI_OK; } static int ci_writen(int fd, char *buf, int len, int timeout) { int ret = 0, remains; remains = len; while (remains) { if ((ret = ci_write(fd, buf, remains, timeout)) < 0) return ret; buf += ret; remains -= ret; } return len; } static int client_send_request_headers(ci_request_t * req, int has_eof, int timeout) { ci_encaps_entity_t **elist, *e; ci_headers_list_t *headers; int bytes; ci_request_pack(req); if (ci_writen (req->connection->fd, req->request_header->buf, req->request_header->bufused, timeout) < 0) return CI_ERROR; req->bytes_out += req->request_header->bufused; elist = req->entities; while ((e = *elist++) != NULL) { if (e->type == ICAP_REQ_HDR || e->type == ICAP_RES_HDR) { headers = (ci_headers_list_t *) e->entity; if (ci_writen (req->connection->fd, headers->buf, headers->bufused, timeout) < 0) return CI_ERROR; req->bytes_out += headers->bufused; } } if (req->preview > 0 && req->preview_data.used > 0) { bytes = sprintf(req->wbuf, "%x\r\n", req->preview); if (ci_writen(req->connection->fd, req->wbuf, bytes, timeout) < 0) return CI_ERROR; req->bytes_out += bytes; if (ci_writen (req->connection->fd, req->preview_data.buf, req->preview, timeout) < 0) return CI_ERROR; req->bytes_out += req->preview; if (has_eof) { if (ci_writen (req->connection->fd, "\r\n0; ieof\r\n\r\n", 13, timeout) < 0) return CI_ERROR; req->bytes_out += 13; req->eof_received = 1; } else { if (ci_writen(req->connection->fd, "\r\n0\r\n\r\n", 7, timeout) < 0) return CI_ERROR; req->bytes_out += 7; } } else if (req->preview == 0) { if (ci_writen(req->connection->fd, "0\r\n\r\n", 5, timeout) < 0) return CI_ERROR; req->bytes_out += 5; } return CI_OK; } /*this function check if there is enough space in buffer buf ....*/ static int check_realloc(char **buf, int *size, int used, int mustadded) { char *newbuf; int len; while (*size - used < mustadded) { len = *size + HEADSBUFSIZE; newbuf = realloc(*buf, len); if (!newbuf) { return EC_500; } *buf = newbuf; *size = *size + HEADSBUFSIZE; } return CI_OK; } static int client_parse_icap_header(ci_request_t * req, ci_headers_list_t * h) { int readed = 0, eoh = 0; char *buf, *end; if (req->pstrblock_read_len < 4) /*we need 4 bytes for the end of headers "\r\n\r\n" string */ return CI_NEEDS_MORE; if ((end = strstr(req->pstrblock_read, "\r\n\r\n")) != NULL) { readed = end - req->pstrblock_read + 4; eoh = 1; } else readed = req->pstrblock_read_len - 3; if (check_realloc(&(h->buf), &(h->bufsize), h->bufused, readed) != CI_OK) return CI_ERROR; buf = h->buf + h->bufused; memcpy(buf, req->pstrblock_read, readed); h->bufused += readed; req->pstrblock_read += readed; req->pstrblock_read_len -= readed; if (!eoh) return CI_NEEDS_MORE; h->bufused -= 2; /*We keep the first \r\n of the eohead sequence and the other dropped So stupid but for the time never mind.... */ return CI_OK; } static int client_parse_encaps_header(ci_request_t * req, ci_headers_list_t * h, int size) { int remains, readed = 0; char *buf_end = NULL; // readed=h->bufused; remains = size - h->bufused; if (remains < 0) /*is it possible ????? */ return CI_ERROR; if (remains == 0) return CI_OK; if (req->pstrblock_read_len > 0) { readed = (remains > req->pstrblock_read_len ? req->pstrblock_read_len : remains); memcpy(h->buf + h->bufused, req->pstrblock_read, readed); h->bufused += readed; req->pstrblock_read = (req->pstrblock_read) + readed; req->pstrblock_read_len = (req->pstrblock_read_len) - readed; } if (h->bufused < size) return CI_NEEDS_MORE; buf_end = h->buf + h->bufused; if (strncmp(buf_end - 4, "\r\n\r\n", 4) == 0) { h->bufused -= 2; /*eat the last 2 bytes of "\r\n\r\n" */ return CI_OK; } else { ci_debug_printf(1, "Error parsing encapsulated headers," "no \\r\\n\\r\\n at the end of headers:%s!\n", buf_end); return CI_ERROR; } } int ci_client_get_server_options(ci_request_t * req, int timeout) { if (CI_OK != client_create_request(req, req->req_server, req->service, ICAP_OPTIONS)) return CI_ERROR; client_send_request_headers(req, 0, timeout); /* ci_headers_reset(req->head);*/ do { ci_wait_for_incomming_data(req->connection->fd, timeout); if (net_data_read(req) == CI_ERROR) return CI_ERROR; } while (client_parse_icap_header(req, req->response_header) == CI_NEEDS_MORE); ci_headers_unpack(req->response_header); get_request_options(req, req->response_header); return CI_OK; } ci_connection_t *ci_client_connect_to(char *servername, int port, int proto) { ci_connection_t *connection = __intl_malloc(sizeof(ci_connection_t)); char hostname[CI_MAXHOSTNAMELEN + 1]; unsigned int addrlen = 0; char errBuf[512]; int errNo; if (!connection) return NULL; if (!ci_host_to_sockaddr_t(servername, &(connection->srvaddr), proto)) { ci_debug_printf(1, "Error getting address info for host '%s': %s\n", servername, ci_strerror(errno, errBuf, sizeof(errBuf))); close(connection->fd); __intl_free(connection); return NULL; } ci_sockaddr_set_port(&(connection->srvaddr), port); connection->fd = socket(connection->srvaddr.ci_sin_family, SOCK_STREAM, 0); if (connection->fd == -1) { ci_debug_printf(1, "Error opening socket :%d:%s....\n", errno, ci_strerror(errno, errBuf, sizeof(errBuf))); __intl_free(connection); return NULL; } #ifdef USE_IPV6 if (connection->srvaddr.ci_sin_family == AF_INET6) addrlen = sizeof(struct sockaddr_in6); else #endif addrlen = sizeof(struct sockaddr_in); if (connect (connection->fd, (struct sockaddr *) &(connection->srvaddr.sockaddr), addrlen)) { errNo = errno; ci_sockaddr_t_to_host(&(connection->srvaddr), hostname, CI_MAXHOSTNAMELEN); ci_debug_printf(1, "Error connecting to host '%s': %s \n", hostname, ci_strerror(errNo, errBuf, sizeof(errBuf))); close(connection->fd); __intl_free(connection); return NULL; } addrlen = CI_SOCKADDR_SIZE; if (getsockname(connection->fd, (struct sockaddr *) &(connection->claddr.sockaddr), &addrlen)) { ci_debug_printf(1, "Error getting client sockname: %s\n", ci_strerror(errno, errBuf, sizeof(errBuf))); close(connection->fd); __intl_free(connection); return NULL; } ci_fill_sockaddr(&(connection->claddr)); ci_fill_sockaddr(&(connection->srvaddr)); ci_netio_init(connection->fd); return connection; } static int client_prepere_body_chunk(ci_request_t * req, void *data, int (*readdata) (void *data, char *, int)) { int chunksize, def_bytes; char *wbuf = NULL; char tmpbuf[EXTRA_CHUNK_SIZE]; wbuf = req->wbuf + EXTRA_CHUNK_SIZE; /*Let size of EXTRA_CHUNK_SIZE space in the beggining of chunk */ if ((chunksize = (*readdata) (data, wbuf, MAX_CHUNK_SIZE)) <= 0) { /* ci_debug_printf(1,"No data to send or eof reached (%d,).......\n",chunksize);*/ req->remain_send_block_bytes = 0; return chunksize; /*Must be 0 or CI_EOF */ } wbuf += chunksize; /*Put the "\r\n" sequence at the end of chunk */ *(wbuf++) = '\r'; *wbuf = '\n'; def_bytes = snprintf(tmpbuf, EXTRA_CHUNK_SIZE, "%x\r\n", chunksize); wbuf = req->wbuf + EXTRA_CHUNK_SIZE - def_bytes; /*Copy the chunk define in the beggining of chunk ..... */ memcpy(wbuf, tmpbuf, def_bytes); req->pstrblock_responce = wbuf; req->remain_send_block_bytes = def_bytes + chunksize + 2; return req->remain_send_block_bytes; } static int client_parse_incoming_data(ci_request_t * req, void *data_dest, int (*dest_write) (void *, char *, int)) { int ret, v1, v2, status, bytes, size; char *buf; const char *val; ci_headers_list_t *resp_heads; if (req->status == GET_NOTHING) { /*And reading the new ..... */ ret = client_parse_icap_header(req, req->response_header); if (ret != CI_OK) return ret; sscanf(req->response_header->buf, "ICAP/%d.%d %d", &v1, &v2, &status); ci_debug_printf(3, "Response was with status:%d \n", status); ci_headers_unpack(req->response_header); if (ci_allow204(req) && status == 204) { req->status = GET_EOF; return 204; } if ((val = ci_headers_search(req->response_header, "Encapsulated")) == NULL) { ci_debug_printf(1, "No encapsulated entities!\n"); return CI_ERROR; } process_encapsulated(req, val); if (!req->entities[0]) return CI_ERROR; if (!req->entities[1]) { /*Then we have only body */ req->status = GET_BODY; if (req->pstrblock_read_len == 0) return CI_NEEDS_MORE; } else { req->status = GET_HEADERS; size = req->entities[1]->start - req->entities[0]->start; resp_heads = req->entities[0]->entity; if (!ci_headers_setsize(resp_heads, size)) return CI_ERROR; } // return CI_NEEDS_MORE; } /*read encups headers */ /*Non option responce has one or two entities: "req-headers req-body|null-body" or [resp-headers] resp-body||null-body So here client_parse_encaps_header will be called for one headers block */ if (req->status == GET_HEADERS) { size = req->entities[1]->start - req->entities[0]->start; resp_heads = req->entities[0]->entity; if ((ret = client_parse_encaps_header(req, resp_heads, size)) != CI_OK) return ret; ci_headers_unpack(resp_heads); ci_debug_printf(5, "OK reading headers, going to read body\n"); /*reseting body chunks related variables */ req->current_chunk_len = 0; req->chunk_bytes_read = 0; req->write_to_module_pending = 0; if (req->entities[1]->type == ICAP_NULL_BODY) { req->status = GET_EOF; return CI_OK; } else { req->status = GET_BODY; if (req->pstrblock_read_len == 0) return CI_NEEDS_MORE; } } if (req->status == GET_BODY) { do { if ((ret = parse_chunk_data(req, &buf)) == CI_ERROR) { ci_debug_printf(1, "Error parsing chunks, current chunk len: %d, read: %d, readlen: %d, str: %s\n", req->current_chunk_len, req->chunk_bytes_read, req->pstrblock_read_len, req->pstrblock_read); return CI_ERROR; } while (req->write_to_module_pending > 0) { bytes = (*dest_write) (data_dest, buf, req->write_to_module_pending); if (bytes < 0) { ci_debug_printf(1, "Error writing to output file!\n"); return CI_ERROR; } req->write_to_module_pending -= bytes; } if (ret == CI_EOF) { req->status = GET_EOF; return CI_OK; } } while (ret != CI_NEEDS_MORE); return CI_NEEDS_MORE; } return CI_OK; } static const char *eof_str = "0\r\n\r\n"; static int client_send_get_data(ci_request_t * req, int timeout, void *data_source, int (*source_read) (void *, char *, int), void *data_dest, int (*dest_write) (void *, char *, int) ) { int io_ret, read_status, bytes, io_action; if( req->pstrblock_read_len != 0) { /*We have read data, parse them before enter the io loop*/ if ((read_status = client_parse_incoming_data(req, data_dest, dest_write)) == CI_ERROR) return CI_ERROR; if (read_status == 204) return 204; if (req->status == GET_EOF) return CI_OK; } if (!data_source) req->eof_received = 1; if (!req->eof_received) { io_action = wait_for_readwrite; } else io_action = wait_for_read; while (io_action && (io_ret = ci_wait_for_data(req->connection->fd, timeout, io_action))) { if (io_ret < 0) return CI_ERROR; if (io_ret & wait_for_write) { if (req->remain_send_block_bytes == 0) { if (data_source && client_prepere_body_chunk(req, data_source, source_read) <= 0) { req->eof_received = 1; req->pstrblock_responce = (char *) eof_str; req->remain_send_block_bytes = 5; } } bytes = ci_write_nonblock(req->connection->fd, req->pstrblock_responce, req->remain_send_block_bytes); if (bytes < 0) return CI_ERROR; req->bytes_out += bytes; req->pstrblock_responce += bytes; req->remain_send_block_bytes -= bytes; } if (req->eof_received && req->remain_send_block_bytes == 0) io_action = 0; else io_action = wait_for_write; if (io_ret & wait_for_read) { if (net_data_read(req) == CI_ERROR) return CI_ERROR; if ((read_status = client_parse_incoming_data(req, data_dest, dest_write)) == CI_ERROR) return CI_ERROR; if (read_status == 204) return 204; } if (req->status != GET_EOF) io_action |= wait_for_read; } return CI_OK; } static int client_build_headers(ci_request_t *req, int has_reqhdr, int has_reshdr, int has_body) { int i = 0; for (i = 0; i < 4; i++) { if (req->entities[i]) { ci_request_release_entity(req, i); } } i = 0; if (has_reqhdr) req->entities[i++] = ci_request_alloc_entity(req, ICAP_REQ_HDR, 0); if (has_reshdr) req->entities[i++] = ci_request_alloc_entity(req, ICAP_RES_HDR, 0); if (has_body) req->entities[i] = ci_request_alloc_entity(req, req->type == ICAP_RESPMOD ? ICAP_RES_BODY : ICAP_REQ_BODY, 0); else req->entities[i] = ci_request_alloc_entity(req, ICAP_NULL_BODY, 0); return 1; } int ci_client_icapfilter(ci_request_t * req, int timeout, ci_headers_list_t * req_headers, ci_headers_list_t * resp_headers, void *data_source, int (*source_read) (void *, char *, int), void *data_dest, int (*dest_write) (void *, char *, int)) { int i, ret, v1, v2, remains, pre_eof = 0, preview_status; char *buf; const char *val; if (CI_OK != client_create_request(req, req->req_server, req->service, req->type)) { ci_debug_printf(1, "Error making respmod request ....\n"); return CI_ERROR; } if (!data_source) req->preview = -1; if (req->preview > 0) { /*The preview data will be send with headers.... */ ci_buf_mem_alloc(&(req->preview_data), req->preview); /*Alloc mem for preview data */ buf = req->preview_data.buf; remains = req->preview; while (remains && !pre_eof) { /*Getting the preview data */ if ((ret = (*source_read) (data_source, buf, remains)) <= 0) { pre_eof = 1; break; } remains -= ret; } req->preview -= remains; req->preview_data.used = req->preview; } if (pre_eof) req->eof_received = 1; /*Bulid client request structure*/ if (!client_build_headers(req, (req_headers != NULL), (resp_headers != NULL), (data_source != NULL))) return CI_ERROR; /*Add the user supplied headers */ if (req_headers) { ci_debug_printf(5, "Going to add %d request headers\n", req_headers->used); for (i = 0; i < req_headers->used; i++) { ci_debug_printf(8, "Add request header: %s\n", req_headers->headers[i]); ci_http_request_add_header(req, req_headers->headers[i]); } } if (resp_headers) { ci_debug_printf(5, "Going to add %d response headers\n", resp_headers->used); for (i = 0; i < resp_headers->used; i++) { ci_debug_printf(8, "Add resp header: %s\n", resp_headers->headers[i]); ci_http_response_add_header(req, resp_headers->headers[i]); } } if ((ret = client_send_request_headers(req, pre_eof, timeout)) < 0) { return CI_ERROR; } /*send body */ /* ci_headers_reset(req->head);*/ for (i = 0; req->entities[i] != NULL; i++) { ci_request_release_entity(req, i); } preview_status = 100; if (req->preview >= 0) { /*we must wait for ICAP responce here..... */ do { ci_wait_for_incomming_data(req->connection->fd, timeout); if (net_data_read(req) == CI_ERROR) return CI_ERROR; } while (client_parse_icap_header(req, req->response_header) == CI_NEEDS_MORE); sscanf(req->response_header->buf, "ICAP/%d.%d %d", &v1, &v2, &preview_status); ci_debug_printf(3, "Preview response was with status: %d \n", preview_status); if (preview_status == 204) ci_headers_unpack(req->response_header); else if ((req->eof_received && preview_status == 200) || preview_status == 206) { ci_headers_unpack(req->response_header); if ((val = ci_headers_search(req->response_header, "Encapsulated")) == NULL) { ci_debug_printf(1, "No encapsulated entities!\n"); return CI_ERROR; } process_encapsulated(req, val); if (!req->entities[1]) /*Then we have only body */ req->status = GET_BODY; else req->status = GET_HEADERS; } else ci_headers_reset(req->response_header); } if (preview_status == 204 || preview_status == 206) return preview_status; ret = client_send_get_data(req, timeout, data_source, source_read, data_dest, dest_write); if (preview_status == 206 && ret == CI_OK) return 206; return ret; } /** * Return 1 if the HTTP headers (if any) are read completely * otherwise return 0; */ int ci_client_http_headers_completed(ci_request_t * req) { return (req->status >= GET_PREVIEW); } c_icap-0.4.2/acl.c0000664000175000017500000006227012567560075010605 00000000000000/* * Copyright (C) 2004 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "c-icap.h" #include "common.h" #include "request.h" #include "cfg_param.h" #include "debug.h" #include "simple_api.h" #include "acl.h" #include "access.h" #include "mem.h" #include "filetype.h" #include #include /*standard acl types */ /*Spec types: username: user, servicename: service requet_type: type port : port src_ip: src dst_ip: srvip */ void *get_user(ci_request_t *req, char *param){ return req->user; } void *get_service(ci_request_t *req, char *param){ return req->service; } void *get_reqtype(ci_request_t *req, char *param){ return (void *)ci_method_string(req->type); } void *get_port(ci_request_t *req, char *param){ return &req->connection->srvaddr.ci_sin_port; } void *get_client_ip(ci_request_t *req, char *param){ return &(req->connection->claddr); } void *get_srv_ip(ci_request_t *req, char *param){ return &(req->connection->srvaddr); } void *get_http_client_ip(ci_request_t *req, char *param){ return (void *)ci_http_client_ip(req); } #if defined(USE_REGEX) /*They are implemented at the bottom of this file ...*/ void *get_icap_header(ci_request_t *req, char *param); void *get_icap_response_header(ci_request_t *req, char *param); void *get_http_req_header(ci_request_t *req, char *param); void *get_http_resp_header(ci_request_t *req, char *param); void free_icap_header(ci_request_t *req,void *param); void free_icap_response_header(ci_request_t *req, void *param); void free_http_req_header(ci_request_t *req, void *param); void free_http_resp_header(ci_request_t *req, void *param); #endif void *get_data_type(ci_request_t *req, char *param); void free_data_type(ci_request_t *req,void *param); ci_acl_type_t acl_user={ "user", get_user, NULL, &ci_str_ops }; ci_acl_type_t acl_service={ "service", get_service, NULL, &ci_str_ops }; ci_acl_type_t acl_req_type={ "type", get_reqtype, NULL, &ci_str_ops }; ci_acl_type_t acl_tcp_port={ "port", get_port, NULL, &ci_int32_ops }; ci_acl_type_t acl_tcp_src={ "src", get_client_ip, NULL, &ci_ip_sockaddr_ops }; ci_acl_type_t acl_tcp_srvip={ "srvip", get_srv_ip, NULL, &ci_ip_sockaddr_ops }; ci_acl_type_t acl_tcp_xclientip={ "http_client_ip", get_http_client_ip, NULL, &ci_ip_ops }; #if defined(USE_REGEX) ci_acl_type_t acl_icap_header = { "icap_header", get_icap_header, free_icap_header, &ci_regex_ops }; ci_acl_type_t acl_icap_resp_header = { "icap_resp_header", get_icap_response_header, free_icap_response_header, &ci_regex_ops }; ci_acl_type_t acl_http_req_header = { "http_req_header", get_http_req_header, free_http_req_header, &ci_regex_ops }; ci_acl_type_t acl_http_resp_header = { "http_resp_header", get_http_resp_header, free_http_resp_header, &ci_regex_ops }; #endif ci_acl_type_t acl_data_type={ "data_type", get_data_type, free_data_type, &ci_datatype_ops }; struct acl_cmp_uint64_data { uint64_t data; int operator; }; /**** Content-Length acl ****/ void *acl_cmp_uint64_dup(const char *str, ci_mem_allocator_t *allocator) { return ci_uint64_ops.dup(str, allocator); } int acl_cmp_uint64_equal(const void *key1, const void *key2) { uint64_t k1 = *(uint64_t *)key1; struct acl_cmp_uint64_data *data = (struct acl_cmp_uint64_data *)key2; ci_debug_printf(8, "Acl content length check %llu %c %llu\n", (long long int)data->data, data->operator == 1 ? '>' : data->operator == 2 ? '<' : '=', (long long int)k1); if (data->operator == 1) { /* > */ return data->data > k1; } else if (data->operator == 2) { /* < */ return data->data < k1; } else { /* = */ return k1 == data->data; } } void acl_cmp_uint64_free(void *key, ci_mem_allocator_t *allocator) { ci_uint64_ops.free(key, allocator); } static const ci_type_ops_t acl_cmp_uint64_ops = { acl_cmp_uint64_dup, acl_cmp_uint64_free, NULL, // compare, not used here NULL, // length, not used here acl_cmp_uint64_equal }; void free_cmp_uint64_data(ci_request_t *req,void *param); void *get_content_length(ci_request_t *req, char *param); static ci_acl_type_t acl_content_length={ "content_length", get_content_length, free_cmp_uint64_data, &acl_cmp_uint64_ops }; /**** Time acl ****/ /* Acl in the form: [DAY[,DAY,[..]]][/][HH:MM-HH:MM] DAY: S - Sunday M - Monday T - Tuesday W - Wednesday H - Thursday F - Friday A - Saturday acl time WorkingDays M,T,W,H,F/9:00-18:00 acl time ChildTime Saturday,Sunday/8:30-20:00 acl time ParentsTime 20:00-24:00 00:00-8:30 */ /*Acl ci_types_ops_t */ void *acl_time_dup(const char *str, ci_mem_allocator_t *allocator); int acl_time_equal(const void *key1, const void *key2); void acl_time_free(void *key, ci_mem_allocator_t *allocator); static const ci_type_ops_t acl_time_ops = { acl_time_dup, acl_time_free, NULL, // compare, not used here NULL, // length, not used here acl_time_equal }; /*The acl type*/ void free_time_data(ci_request_t *req,void *param); void *get_time_data(ci_request_t *req, char *param); static ci_acl_type_t acl_time={ "time", get_time_data, free_time_data, &acl_time_ops }; struct acl_time_data { unsigned int days; unsigned int start_time; unsigned int end_time; }; void *acl_time_dup(const char *str, ci_mem_allocator_t *allocator) { struct {const char *day; int id;} days[] = { {"Sunday", 0}, {"Monday", 1}, {"Tuesday", 2}, {"Wednesday", 3}, {"Thursday", 4}, {"Friday", 5}, {"Saturday", 6}, {"S", 0}, {"M", 1}, {"T", 2}, {"W", 3}, {"H", 4}, {"F", 5}, {"A", 6}, {NULL, -1} }; int h1, m1, h2, m2, i; char *s, *e; const char *error; char buf[1024]; struct acl_time_data *tmd = allocator->alloc(allocator, sizeof(struct acl_time_data)); tmd->days = 0; /*copy string in order to parse it*/ strncpy(buf, str, sizeof(buf)); buf[sizeof(buf) - 1] = '\0'; s = buf; if (!isdigit(*s)) { do { if (*s == ',') ++s; for (i = 0; days[i].day != NULL; ++i) { if (strncasecmp(s, days[i].day, strlen(days[i].day)) == 0) { tmd->days |= 1 << days[i].id; break; } } if (days[i].day == NULL) { /*not found*/ error = s; goto acl_time_dup_fail; } s += strlen(days[i].day); } while(*s == ','); if (*s != '/') { error = s; goto acl_time_dup_fail; } if (*s) ++s; } /* Time region specification*/ /*We are expecting hour region in the form 'HH:MM-HH:MM' */ if (!isdigit(*s)) { error = s; goto acl_time_dup_fail; } h1 = strtol(s, &e, 10); if (h1 < 0 || h1 > 24) { error = s; goto acl_time_dup_fail; } if (*e != ':' || !isdigit(e[1])) { error = e; goto acl_time_dup_fail; } s = e + 1; m1 = strtol(s, &e, 10); if (m1 < 0 || m1 > 59) { error = s; goto acl_time_dup_fail; } if (*e != '-' || !isdigit(e[1])) { error = e; goto acl_time_dup_fail; } s = e + 1; h2 = strtol(s, &e, 10); if (h2 < 0 || h2 > 24) { error = s; goto acl_time_dup_fail; } if (*e != ':' || !isdigit(e[1])) { error = e; goto acl_time_dup_fail; } s = e + 1; m2 = strtol(s, &e, 10); if (m2 < 0 || m2 > 59) { error = s; goto acl_time_dup_fail; } tmd->start_time = h1 * 60 + m1; tmd->end_time = h2 * 60 + m2; if (tmd->start_time <= tmd->end_time) { ci_debug_printf(5, "Acl time, adding days: %x, start time %d, end time: %d!\n", tmd->days, tmd->start_time, tmd->end_time); return tmd; } ci_debug_printf(1, "Acl '%s': end time is smaller than the start time!\n", str); error = str; acl_time_dup_fail: ci_debug_printf(1, "Failed to parse acl time: %s (error on pos '...%s')\n", str, error); allocator->free(allocator, (void *)tmd); return NULL; } int acl_time_equal(const void *key1, const void *key2) { struct acl_time_data *tmd_acl = (struct acl_time_data *)key1; struct acl_time_data *tmd_request = (struct acl_time_data *)key2; ci_debug_printf(9, "acl_time_equal(key1=%p, key2=%p)\n", key1, key2); int matches = (tmd_acl->days & tmd_request->days) && (tmd_request->start_time >= tmd_acl->start_time) && (tmd_request->start_time <= tmd_acl->end_time); ci_debug_printf(8, "acl_time_equal: %x/%d-%d <> %x/%d-%d -> %d\n", tmd_acl->days, tmd_acl->start_time, tmd_acl->end_time, tmd_request->days, tmd_request->start_time, tmd_request->end_time, matches ); return matches; } void acl_time_free(void *tmd, ci_mem_allocator_t *allocator) { allocator->free(allocator, (void *)tmd); } void free_time_data(ci_request_t *req,void *param) { /*Nothing to do*/ ci_debug_printf(5, "free_time_data(req=%p, param=%p)", req, param); ci_buffer_free(param); } void *get_time_data(ci_request_t *req, char *param) { struct acl_time_data *tmd_req = ci_buffer_alloc(sizeof(struct acl_time_data)); struct tm br_tm; time_t tm; time(&tm); localtime_r(&tm, &br_tm); tmd_req->days = 0; tmd_req->days |= (1 << br_tm.tm_wday); tmd_req->start_time = (br_tm.tm_hour) * 60 + br_tm.tm_min; tmd_req->end_time = 0; return (void *)tmd_req; } /********************************************************************************/ /* ci_access_entry api functions */ ci_access_entry_t *ci_access_entry_new(ci_access_entry_t **list, int type) { ci_access_entry_t *access_entry, *cur; if (list == NULL) return NULL; if(!(access_entry = malloc(sizeof(ci_access_entry_t)))) return NULL; access_entry->type = type; access_entry->spec_list = NULL; access_entry->next = NULL; if (*list == NULL){ *list = access_entry; } else { cur = *list; while (cur->next!=NULL) cur = cur->next; cur->next = access_entry; } return access_entry; } void ci_access_entry_release(ci_access_entry_t *list) { ci_access_entry_t *access_entry; ci_specs_list_t *spec_list, *cur; if(!list) return; access_entry = list; while (list) { access_entry = list; list = list->next; spec_list = access_entry->spec_list; while(spec_list) { cur = spec_list; spec_list = spec_list->next; free(cur); } free(access_entry); } } const ci_acl_spec_t *ci_access_entry_add_acl(ci_access_entry_t *access_entry, const ci_acl_spec_t *acl, int negate){ struct ci_specs_list *spec_list,*spec_entry; if (access_entry == NULL) return NULL; spec_entry = malloc(sizeof(struct ci_specs_list)); if (spec_entry == NULL) return NULL; spec_entry->next = NULL; spec_entry->negate = negate; spec_entry->spec = acl; if (access_entry->spec_list == NULL) { access_entry->spec_list = spec_entry; } else { spec_list = access_entry->spec_list; while (spec_list->next != NULL) spec_list = spec_list->next; spec_list->next = spec_entry; } return acl; } int ci_access_entry_add_acl_by_name(ci_access_entry_t *access_entry, const char *acl_name){ const ci_acl_spec_t *acl; int negate = 0; if (acl_name[0] == '!') { negate = 1; acl_name = acl_name + 1; } acl = ci_acl_search(acl_name); if (!acl) { ci_debug_printf(1, "The acl spec %s does not exists!\n", acl_name); return 0; } if (ci_access_entry_add_acl(access_entry, acl, negate) == NULL) { ci_debug_printf(1, "Error adding acl spec %s to the access list!\n", acl_name); return 0; } return 1; } /*********************************************************************************/ /*ci_acl_spec functions */ ci_acl_spec_t * ci_acl_spec_new(const char *name, const char *type, const char *param, struct ci_acl_type_list *list, ci_acl_spec_t **spec_list) { ci_acl_spec_t *spec,*cur; const ci_acl_type_t *acl_type; acl_type = ci_acl_typelist_search(list, type); if (!acl_type) return NULL; if (!(spec = malloc(sizeof( ci_acl_spec_t)))) return NULL; strncpy(spec->name, name, MAX_NAME_LEN); spec->name[MAX_NAME_LEN] = '\0'; if(param) { if (!(spec->parameter = strdup(param))) { free(spec); return NULL; } } else spec->parameter = NULL; spec->type = acl_type; spec->data = NULL; spec->next = NULL; if (spec_list!=NULL){ if (*spec_list!=NULL){ cur = *spec_list; while (cur->next!=NULL) cur = cur->next; cur->next = spec; } else *spec_list = spec; } return spec; } ci_acl_data_t *ci_acl_spec_new_data(ci_acl_spec_t *spec, const char *val) { ci_acl_data_t *new_data, *list; const ci_type_ops_t *ops; void *data; if (!spec) return NULL; ops = spec->type->type; data = ops->dup(val, default_allocator); if (!data) return NULL; new_data = malloc(sizeof(ci_acl_data_t)); if (!new_data) { ops->free(data, default_allocator); return NULL; } new_data->data = data; new_data->next = NULL; if ((list=spec->data) != NULL) { while (list->next != NULL) list = list->next; list->next = new_data; } else spec->data = new_data; return new_data; } ci_acl_spec_t *ci_acl_spec_search(ci_acl_spec_t *list, const char *name) { ci_acl_spec_t *spec; ci_debug_printf(9,"In search specs list %p,name %s\n", list, name); if (!list || !name) return NULL; spec = list; while (spec!= NULL) { ci_debug_printf(9,"Checking name:%s with specname %s\n", name, spec->name); if (strcmp(spec->name, name) == 0 ) { return spec; } spec = spec->next; } return NULL; } void ci_acl_spec_release(ci_acl_spec_t *cur) { ci_acl_data_t *dhead, *dtmp; const ci_type_ops_t *ops; dhead = cur->data; ops = cur->type->type; while (dhead) { dtmp = dhead; dhead = dhead->next; ops->free(dtmp->data, default_allocator); free(dtmp); } } void ci_acl_spec_list_release(ci_acl_spec_t *spec) { ci_acl_spec_t *cur; while (spec) { cur=spec; spec=spec->next; ci_acl_spec_release(cur); } } /*******************************************************************/ /* ci_acl_type functions */ #define STEP 32 int ci_acl_typelist_init(struct ci_acl_type_list *list) { list->acl_type_list = malloc(STEP*sizeof(ci_acl_type_t)); list->acl_type_list_size = STEP; list->acl_type_list_num = 0; return 1; } int ci_acl_typelist_add(struct ci_acl_type_list *list, const ci_acl_type_t *type) { ci_acl_type_t *cur; ci_acl_type_t *nl = NULL; if (!type->name) return 0; if (ci_acl_typelist_search(list, type->name) != NULL) { ci_debug_printf(3, "The acl type %s already defined\n", type->name); return 0; } if (list->acl_type_list_num == list->acl_type_list_size) { list->acl_type_list_size += STEP; nl = realloc((void *)list->acl_type_list, list->acl_type_list_size*sizeof(ci_acl_type_t)); if (!nl) { ci_debug_printf(1, "Failed to allocate more space for new ci_acl_typr_t\n"); return 0; } list->acl_type_list = nl; } cur = &(list->acl_type_list[list->acl_type_list_num]); strncpy(cur->name, type->name, MAX_NAME_LEN); cur->name[MAX_NAME_LEN] = '\0'; cur->type = type->type; cur->get_test_data = type->get_test_data; list->acl_type_list_num++; return 1; } const ci_acl_type_t *ci_acl_typelist_search(struct ci_acl_type_list *list,const char *name) { int i; for (i=0; iacl_type_list_num; i++) { if(strcmp(list->acl_type_list[i].name,name)==0) return (const ci_acl_type_t *)&list->acl_type_list[i]; } return NULL; } int ci_acl_typelist_release(struct ci_acl_type_list *list) { free(list->acl_type_list); list->acl_type_list_size = 0; list->acl_type_list_num = 0; return 1; } int ci_acl_typelist_reset(struct ci_acl_type_list *list) { list->acl_type_list_num = 0; return 1; } /*********************************************************************************/ int spec_data_check(const ci_acl_spec_t *spec, const void *req_raw_data) { // int (*comp)(void *req_spec, void *acl_spec); struct ci_acl_data *spec_data=spec->data; const ci_type_ops_t *ops = spec->type->type; ci_debug_printf(9,"Check request with ci_acl_spec_t:%s\n", spec->name); while (spec_data!=NULL) { if (ops->equal(spec_data->data, (void *)req_raw_data)) { ci_debug_printf(9,"The ci_acl_spec_t:%s matches\n", spec->name); return 1; } spec_data=spec_data->next; } return 0; } int request_match_specslist(ci_request_t *req, const struct ci_specs_list *spec_list) { const ci_acl_spec_t *spec; const ci_acl_type_t *type; int ret, negate, check_result; void *test_data; ret = 1; while (spec_list!=NULL) { spec = spec_list->spec; negate = spec_list->negate; type = spec->type; test_data = type->get_test_data(req, spec->parameter); if (!test_data) { ci_debug_printf(9,"No data to test for %s/%s, ignore\n", type->name, spec->parameter); return 0; } check_result = spec_data_check(spec, test_data); if (check_result==0 && negate==0) ret = 0; else if (check_result!=0 && negate!=0) ret = 0; if (type->free_test_data) type->free_test_data(req, test_data); if (ret == 0) return 0; spec_list=spec_list->next; } return 1; } int ci_access_entry_match_request(ci_access_entry_t *access_entry, ci_request_t *req) { struct ci_specs_list *spec_list; if (!access_entry) return CI_ACCESS_ALLOW; while(access_entry) { ci_debug_printf(9,"Check request with an access entry\n"); spec_list = access_entry->spec_list; if (spec_list && spec_list->spec && request_match_specslist(req, spec_list)) return access_entry->type; access_entry=access_entry->next; } return CI_ACCESS_UNKNOWN; } /**********************************************************************************/ /* acl library functions */ static struct ci_acl_type_list types_list; static struct ci_acl_spec *specs_list; static int acl_load_defaults() { ci_acl_typelist_add(&types_list, &acl_tcp_port); ci_acl_typelist_add(&types_list, &acl_service); ci_acl_typelist_add(&types_list, &acl_req_type); ci_acl_typelist_add(&types_list, &acl_user); ci_acl_typelist_add(&types_list, &acl_tcp_src); ci_acl_typelist_add(&types_list, &acl_tcp_srvip); ci_acl_typelist_add(&types_list, &acl_icap_header); ci_acl_typelist_add(&types_list, &acl_icap_resp_header); ci_acl_typelist_add(&types_list, &acl_http_req_header); ci_acl_typelist_add(&types_list, &acl_http_resp_header); ci_acl_typelist_add(&types_list, &acl_data_type); ci_acl_typelist_add(&types_list, &acl_content_length); ci_acl_typelist_add(&types_list, &acl_time); ci_acl_typelist_add(&types_list, &acl_tcp_xclientip); return 1; } void ci_acl_init() { ci_acl_typelist_init(&types_list); acl_load_defaults(); specs_list = NULL; } void ci_acl_reset() { ci_acl_spec_list_release(specs_list); specs_list = NULL; ci_acl_typelist_reset(&types_list); acl_load_defaults(); } const ci_acl_spec_t *ci_acl_search(const char *name){ return (const ci_acl_spec_t *)ci_acl_spec_search(specs_list, name); } const ci_acl_type_t *ci_acl_type_search(const char *name){ return ci_acl_typelist_search(&types_list, name); } int ci_acl_type_add(const ci_acl_type_t *type) { return ci_acl_typelist_add(&types_list, type); } int ci_acl_add_data(const char *name, const char *type, const char *data) { ci_acl_spec_t *spec; const ci_acl_type_t *spec_type; char *s, *param = NULL, *acl_type; acl_type = strdup(type); if (!acl_type) { ci_debug_printf(1, "cfg_acl_add: error strduping!\n"); return 0; } s = acl_type; if ((s=strchr(s,'{')) != NULL) { *s='\0'; param=s+1; if((s=strchr(param,'}')) != NULL) *s= '\0'; } if ((spec = ci_acl_spec_search(specs_list, name)) != NULL){ spec_type = ci_acl_type_search(acl_type); if(spec_type != spec->type){ ci_debug_printf(1, "The acl type:%s does not match with type of existing acl \"%s\"", acl_type, name); free(acl_type); return 0; } } else { spec = ci_acl_spec_new(name, acl_type, param, &types_list, &specs_list); } free(acl_type); if (!spec){ ci_debug_printf(1, "Error in acl:%s! Maybe the acl type \"%s\" does not exists!\n", name, acl_type); return 0; } ci_acl_spec_new_data(spec, data); return 1; } /******************************************************/ /* Some acl_type methods implementation */ #if defined(USE_REGEX) const char *get_header(ci_headers_list_t *headers, char *head) { const char *val; char *buf; int i; if(!headers || !head) return NULL; if (!(val = ci_headers_value(headers, head))) return NULL; if (!headers->packed) /*The headers are not packed, so it is NULL terminated*/ return val; /*assume that an 8k buffer is enough for a header value*/ if (!(buf = ci_buffer_alloc(8192))) return NULL; for(i=0;i<8191 && *val!= '\0' && *val != '\r' && *val!='\n'; i++,val++) buf[i] = *val; buf[8191]='\0'; return buf; } void release_header_value(ci_headers_list_t *headers, char *head) { if (headers && headers->packed && head) /*The headers are packed, we have allocated buffer*/ ci_buffer_free(head); } void *get_icap_header(ci_request_t *req, char *param) { ci_headers_list_t *heads; heads = req->request_header; return (void *)get_header(heads, param); } void free_icap_header(ci_request_t *req, void *param) { ci_headers_list_t *heads; heads = req->request_header; release_header_value(heads, param); } void *get_icap_response_header(ci_request_t *req, char *param) { ci_headers_list_t *heads; heads = req->response_header; return (void *)get_header(heads, param); } void free_icap_response_header(ci_request_t *req, void *param) { ci_headers_list_t *heads; heads = req->response_header; release_header_value(heads, param); } void *get_http_req_header(ci_request_t *req, char *param) { ci_headers_list_t *heads; heads = ci_http_request_headers(req); return (void *)get_header(heads, param); } void free_http_req_header(ci_request_t *req, void *param) { ci_headers_list_t *heads; heads = ci_http_request_headers(req); release_header_value(heads, param); } void *get_http_resp_header(ci_request_t *req, char *param) { ci_headers_list_t *heads; heads = ci_http_response_headers(req); return (void *)get_header(heads, param); } void free_http_resp_header(ci_request_t *req, void *param) { ci_headers_list_t *heads; heads = ci_http_response_headers(req); release_header_value(heads, param); } #endif void *get_data_type(ci_request_t *req, char *param){ int type, isenc; int *ret_type; type = ci_magic_req_data_type(req, &isenc); if (type < 0) return NULL; ret_type = malloc(sizeof(unsigned int)); if (!ret_type) return NULL; *ret_type = type; return (void *)ret_type; } void free_data_type(ci_request_t *req,void *param){ free(param); } void *get_content_length(ci_request_t *req, char *param) { struct acl_cmp_uint64_data *clen_p = (struct acl_cmp_uint64_data *)ci_buffer_alloc(sizeof(struct acl_cmp_uint64_data)); ci_off_t clen = ci_http_content_length(req); if (clen < 0) return NULL; clen_p->data = (uint64_t)clen; if (param[0] == '=') { clen_p->operator = 0; } else if (param[0] == '>') { clen_p->operator = 1; } else if (param[0] == '<') { clen_p->operator = 2; } return clen_p; } void free_cmp_uint64_data(ci_request_t *req, void *param) { ci_buffer_free(param); } c_icap-0.4.2/regex.c0000664000175000017500000001235112567550777011163 00000000000000#include "common.h" #include "debug.h" #include "array.h" #include "ci_regex.h" #ifdef HAVE_PCRE #include #else #include #endif char *ci_regex_parse(const char *str, int *flags, int *recursive) { int slen; const char *e; char *s; if (*str != '/') return NULL; ++str; slen = strlen(str); e = str + slen; while(*e != '/' && e != str) --e; if (*e != '/') return NULL; slen = e - str; s = malloc( (slen + 1) * sizeof(char)); strncpy(s, str, slen); s[slen] = '\0'; *flags = 0; #ifdef HAVE_PCRE *flags |= PCRE_NEWLINE_ANY; *flags |= PCRE_NEWLINE_ANYCRLF; #else *flags |= REG_EXTENDED; // *flags |= REG_NOSUB; #endif while(*e != '\0') { #ifdef HAVE_PCRE if(*e == 'i') *flags = *flags | PCRE_CASELESS; else if (*e == 'm') *flags |= PCRE_MULTILINE; else if (*e == 's') *flags |= PCRE_DOTALL; else if (*e == 'x') *flags |= PCRE_EXTENDED; else if (*e == 'A') *flags |= PCRE_ANCHORED; else if (*e == 'D') *flags |= PCRE_DOLLAR_ENDONLY; else if (*e == 'U') *flags |= PCRE_UNGREEDY; else if (*e == 'X') *flags |= PCRE_EXTRA; else if (*e == 'D') *flags |= PCRE_DOLLAR_ENDONLY; else if (*e == 'u') *flags |= PCRE_UTF8; #else if(*e == 'i') *flags = *flags | REG_ICASE; else if (*e == 'm') *flags |= REG_NEWLINE; #endif else if (*e == 'g') *recursive = 1; ++e; } return s; } ci_regex_t ci_regex_build(const char *regex_str, int regex_flags) { #ifdef HAVE_PCRE pcre *re; const char *error; int erroffset; re = pcre_compile(regex_str, regex_flags, &error, &erroffset, NULL); if (re == NULL) { ci_debug_printf(2, "PCRE compilation failed at offset %d: %s\n", erroffset, error); return NULL; } return re; #else int retcode; regex_t *regex = malloc(sizeof(regex_t)); /*reset regex_struct*/ memset(regex, 0, sizeof(regex_t)); retcode = regcomp(regex, regex_str, regex_flags); if (retcode) { free(regex); regex = NULL; } return regex; #endif } void ci_regex_free(ci_regex_t regex) { #ifdef HAVE_PCRE pcre_free((pcre *)regex); #else regfree((regex_t *)regex); free(regex); #endif } #ifdef HAVE_PCRE #define OVECCOUNT 30 /* should be a multiple of 3 */ #endif int ci_regex_apply(const ci_regex_t regex, const char *str, int len, int recurs, ci_list_t *matches, const void *user_data) { int count = 0, i; ci_regex_replace_part_t parts; if (!str) return 0; #ifdef HAVE_PCRE int ovector[OVECCOUNT]; int rc; int offset = 0; int str_length = len >=0 ? len : strlen(str); do { memset(ovector, 0, sizeof(ovector)); rc = pcre_exec(regex, NULL, str, str_length, offset, 0, ovector, OVECCOUNT); if (rc >= 0 && ovector[0] != ovector[1]) { ++count; ci_debug_printf(9, "Match pattern (pos:%d-%d): '%.*s'\n", ovector[0], ovector[1], ovector[1]-ovector[0], str+ovector[0]); offset = ovector[1]; if (matches) { parts.user_data = user_data; memset(parts.matches, 0 , sizeof(ci_regex_matches_t)); for (i = 0; i < 10 && ovector[2*i+1] > ovector[2*i]; ++i) { ci_debug_printf(9, "\t sub-match pattern (pos:%d-%d): '%.*s'\n", ovector[2*i], ovector[2*i+1], ovector[2*i + 1] - ovector[2*i], str+ovector[2*i]); parts.matches[i].s = ovector[2*i]; parts.matches[i].e = ovector[2*i+1]; } ci_list_push_back(matches, (void *)&parts); } } } while (recurs && rc >=0 && offset < str_length); #else int retcode; regmatch_t pmatch[10]; do { if ((retcode = regexec(regex, str, 10, pmatch, 0)) == 0) { ++count; ci_debug_printf(9, "Match pattern (pos:%d-%d): '%.*s'\n", pmatch[0].rm_so, pmatch[0].rm_eo, pmatch[0].rm_eo - pmatch[0].rm_so, str+pmatch[0].rm_so); if (matches) { parts.user_data = user_data; memset(parts.matches, 0, sizeof(ci_regex_matches_t)); for (i = 0; i < 10 && pmatch[i].rm_eo > pmatch[i].rm_so; ++i) { ci_debug_printf(9, "\t sub-match pattern (pos:%d-%d): '%.*s'\n", pmatch[i].rm_so, pmatch[i].rm_eo, pmatch[i].rm_eo - pmatch[i].rm_so, str+pmatch[i].rm_so); parts.matches[i].s = pmatch[i].rm_so; parts.matches[i].e = pmatch[i].rm_eo; } ci_list_push_back(matches, (void *)&parts); } if (pmatch[0].rm_so >= 0 && pmatch[0].rm_eo >= 0 && pmatch[0].rm_so != pmatch[0].rm_eo) { str += pmatch[0].rm_eo; ci_debug_printf(8, "I will check again starting from: %s\n", str); } else /*stop here*/ str = NULL; } } while (recurs && str && *str != '\0' && retcode == 0); #endif ci_debug_printf(5, "ci_regex_apply matches count: %d\n", count); return count; } c_icap-0.4.2/debug.c0000664000175000017500000000503612567550776011140 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include #include "debug.h" int CI_DEBUG_LEVEL = 1; int CI_DEBUG_STDOUT = 0; #ifndef _WIN32 void (*__log_error) (void *req, const char *format, ...) = NULL; #else void (*__vlog_error) (void *req, const char *format, va_list ap) = NULL; void __ldebug_printf(int i, const char *format, ...) { va_list ap; if (i <= CI_DEBUG_LEVEL) { va_start(ap, format); if (__vlog_error) { (*__vlog_error) (NULL, format, ap); } if (CI_DEBUG_STDOUT) vprintf(format, ap); va_end(ap); } } #endif /* void debug_print_request(ci_request_t *req){ int i,j; ci_debug_printf(1,"Request Type :\n"); if(req->type>=0){ ci_debug_printf(1," Requested: %s\n Server: %s\n Service: %s\n", ci_method_string(req->type), req->req_server, req->service); if(req->args){ ci_debug_printf(1," Args: %s\n",req->args); } else{ ci_debug_printf(1,"\n"); } } else{ ci_debug_printf(1," No Method\n"); } ci_debug_printf(1,"\n\nHEADERS : \n"); for(i=0;ihead->used;i++){ ci_debug_printf(1," %s\n",req->head->headers[i]); } ci_debug_printf(1,"\n\nEncapsulated Entities: \n"); i=0; while(req->entities[i]!=NULL){ ci_debug_printf(1,"\t %s header at %d\n", ci_encaps_entity_string(req->entities[i]->type),req->entities[i]->start); if(req->entities[i]->typeentities[i]->entity; ci_debug_printf(1,"\t\t HEADERS : \n"); for(j=0;jused;j++){ ci_debug_printf(1,"\t\t\t%d. %s\n",j,h->headers[j]); } } i++; } } */ c_icap-0.4.2/contrib/0000775000175000017500000000000012601747560011406 500000000000000c_icap-0.4.2/contrib/get_file.pl0000664000175000017500000000270012567550777013455 00000000000000#!/usr/bin/perl my(%args); if($ENV{'REQUEST_METHOD'} eq "GET") { $query=$ENV{'QUERY_STRING'}; my(@line_args)=split(/&/,$query); for my $arg (@line_args){ $arg=~ s/\+/ /g; # replace + with spaces..... ($key,$val)=split(/=/,$arg); $val =~ s/%(..)/pack("c",hex($1))/ge; if($key eq "file" || $key eq "usename" || $key eq "content" ||$key eq "remove" ){ $args{$key}=$val; } } } else{ print "Content-type: text/html\n\n"; print "No Arguments....."; exit 1; } $filename="/srv/www/htdocs/downloads/".$args{"file"}; my(@stat)=stat $filename; binmode(STDOUT); if(open (F,"<$filename")){ print "Connection: close\n"; if($args{"content"}){ print "Content-Type: ".$args{"content"}."\n\\"; } else{ print "Content-Type: application/octet-stream\n"; } print "Content-Length: ".$stat[7]."\n"; if($args{"usename"}){ print "Content-Disposition: attachment; filename=".$args{"usename"}."\n\n"; } else { print "Content-Disposition: attachment; filename=".$args{"file"}."\n\n"; } while($len=sysread( F, $buf,512)){ print $buf; } close F; if($args{"remove"}==1){ unlink $filename; } } else { print "Connection: close\n"; print "Content-Type: text/html\n\n"; print "

Error

\n"; print "The file ".$args{"file"}." does not exists in the server
\n"; print "Please contact to the administrator for more info.\n\n"; } c_icap-0.4.2/contrib/convert_old_magic.pl0000664000175000017500000000104412567550777015355 00000000000000#!/usr/bin/perl # this utility can be used to convert old c-icap.magic files to new format # The old line format was: # POS:LABEL:TYPE NAME:GROUP:COMMENT # The new is : # POS:LABEL:TYPE NAME:COMMENT:GROUP1[:GROUP2[:GROUP3[...]]] my $in = shift; if(!open(FILE,$in)){ die "The file $in does not exists!\n\n"; } while(){ $line=$_; if( $line =~ /^\#.*/ || $line =~ /^[\s*]$/){ print $line; } else{ chomp $line; split ':',$line; print $_[0].":".$_[1].":".$_[2].":".$_[4].":".$_[3]."\n"; } } close(FILE); c_icap-0.4.2/body.c0000664000175000017500000006333612567550777011017 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include #include "body.h" #include "debug.h" #include "simple_api.h" #include "util.h" #include #include #ifdef _WIN32 #include #include #endif #if defined USE_POSIX_MAPPED_FILES #include #endif #define STARTLEN 8192 /*8*1024*1024 */ #define INCSTEP 4096 #define min(x,y) ((x)>(y)?(y):(x)) #define max(x,y) ((x)>(y)?(x):(y)) static int MEMBUF_POOL = -1; static int CACHED_FILE_POOL = -1; static int SIMPLE_FILE_POOL = -1; static int RING_BUF_POOL = -1; CI_DECLARE_FUNC(int) init_body_system() { MEMBUF_POOL = ci_object_pool_register("ci_membuf_t", sizeof(ci_membuf_t)); if (MEMBUF_POOL < 0) return CI_ERROR; CACHED_FILE_POOL = ci_object_pool_register("ci_cached_file_t", sizeof(ci_cached_file_t)); if (CACHED_FILE_POOL < 0) return CI_ERROR; SIMPLE_FILE_POOL = ci_object_pool_register("ci_simple_file_t", sizeof(ci_simple_file_t)); if (SIMPLE_FILE_POOL < 0) return CI_ERROR; RING_BUF_POOL = ci_object_pool_register("ci_ring_buf_t", sizeof(ci_ring_buf_t)); if (RING_BUF_POOL < 0) return CI_ERROR; return CI_OK; } void release_body_system() { ci_object_pool_unregister(MEMBUF_POOL); ci_object_pool_unregister(CACHED_FILE_POOL); ci_object_pool_unregister(SIMPLE_FILE_POOL); ci_object_pool_unregister(RING_BUF_POOL); } struct ci_membuf *ci_membuf_new() { return ci_membuf_new_sized(STARTLEN); } struct ci_membuf *ci_membuf_new_sized(int size) { struct ci_membuf *b; b = ci_object_pool_alloc(MEMBUF_POOL); if (!b) return NULL; b->endpos = 0; b->readpos = 0; b->flags = 0; b->buf = ci_buffer_alloc(size * sizeof(char)); if (b->buf == NULL) { ci_object_pool_free(b); return NULL; } b->bufsize = size; b->unlocked = -1; b->attributes = NULL; return b; } struct ci_membuf *ci_membuf_from_content(char *buf, size_t buf_size, size_t content_size, unsigned int flags) { struct ci_membuf *b; if (!buf || buf_size <= 0 || buf_size < content_size) { ci_debug_printf(1, "ci_membuf_from_content: Wrong arguments: %p, of size=%u and content size=%u\n", buf, (unsigned int)buf_size, (unsigned int)content_size); return NULL; } if ((flags & CI_MEMBUF_FROM_CONTENT_FLAGS) != flags) { ci_debug_printf(1, "ci_membuf_from_content: Wrong flags: %u\n", flags); return NULL; } if ((flags & CI_MEMBUF_NULL_TERMINATED)) { if (buf[content_size - 1] == '\0') content_size--; else if (content_size >= buf_size || buf[content_size] != '\0') { ci_debug_printf(1, "ci_membuf_from_content: content is not NULL terminated!\n"); return NULL; } } b = ci_object_pool_alloc(MEMBUF_POOL); if (!b) { ci_debug_printf(1, "ci_membuf_from_content: memory allocation failed\n"); return NULL; } b->flags = CI_MEMBUF_FOREIGN_BUF | flags; b->endpos = content_size; b->readpos = 0; b->buf = buf; b->bufsize = buf_size; b->unlocked = -1; b->attributes = NULL; return b; } void ci_membuf_free(struct ci_membuf *b) { if (!b) return; if (b->buf && !(b->flags & CI_MEMBUF_FOREIGN_BUF)) ci_buffer_free(b->buf); if (b->attributes) ci_array_destroy(b->attributes); ci_object_pool_free(b); } unsigned int ci_membuf_set_flag(struct ci_membuf *body, unsigned int flag) { if (!(flag & CI_MEMBUF_USER_FLAGS)) return 0; body->flags |= flag; return body->flags; } int ci_membuf_write(struct ci_membuf *b, const char *data, int len, int iseof) { int remains, newsize; char *newbuf; int terminate = b->flags & CI_MEMBUF_NULL_TERMINATED; if ((b->flags & CI_MEMBUF_RO) || (b->flags & CI_MEMBUF_CONST)) { ci_debug_printf( 1, "ci_membuf_write: can not write: buffer is read-only!\n"); return 0; } if ((b->flags & CI_MEMBUF_HAS_EOF)) { ci_debug_printf( 1, "Cannot write to membuf: the eof flag is set!\n"); return 0; } if (iseof) { b->flags |= CI_MEMBUF_HAS_EOF; /* ci_debug_printf(10,"Buffer size=%d, Data size=%d\n ", ((struct membuf *)b)->bufsize,((struct membuf *)b)->endpos); */ } remains = b->bufsize - b->endpos - (terminate ? 1 : 0); assert(remains >= -1); /*can be -1 when NULL_TERMINATED flag just set by user and no space to*/ while (remains < len) { newsize = b->bufsize + INCSTEP; newbuf = ci_buffer_realloc(b->buf, newsize); if (newbuf == NULL) { ci_debug_printf( 1, "ci_membuf_write: Failed to grow membuf for new data!\n"); if (remains >= 0) { if (remains) memcpy(b->buf + b->endpos, data, remains); if (terminate) { b->endpos = b->bufsize - 1; b->buf[b->endpos] = '\0'; } else b->endpos = b->bufsize; } else { ci_debug_printf( 1, "ci_membuf_write: Failed to NULL terminate membuf!\n"); } return remains; } b->buf = newbuf; b->bufsize = newsize; remains = b->bufsize - b->endpos - (terminate ? 1 : 0); } /*while remainsbuf + b->endpos, data, len); b->endpos += len; } if (terminate) b->buf[b->endpos] = '\0'; return len; } int ci_membuf_read(struct ci_membuf *b, char *data, int len) { int remains, copybytes; if (b->unlocked >= 0) remains = b->unlocked - b->readpos; else remains = b->endpos - b->readpos; if (remains == 0 && (b->flags & CI_MEMBUF_HAS_EOF)) return CI_EOF; copybytes = (len <= remains ? len : remains); if (copybytes) { memcpy(data, b->buf + b->readpos, copybytes); b->readpos += copybytes; } return copybytes; } #define BODY_ATTRS_SIZE 1024 int ci_membuf_attr_add(struct ci_membuf *body,const char *attr, const void *val, size_t val_size) { if (!body->attributes) body->attributes = ci_array_new(BODY_ATTRS_SIZE); if (body->attributes) return (ci_array_add(body->attributes, attr, val, val_size) != NULL); return 0; } const void * ci_membuf_attr_get(struct ci_membuf *body,const char *attr) { if (body->attributes) return ci_array_search(body->attributes, attr); return NULL; } int ci_membuf_truncate(struct ci_membuf *body, int new_size) { if (body->endpos < new_size) return 0; body->endpos = new_size; if (body->flags & CI_MEMBUF_NULL_TERMINATED) body->buf[body->endpos] = '\0'; if (body->readpos > body->endpos) body->readpos = body->endpos; if (body->unlocked > body->endpos) body->unlocked = body->endpos; return 1; } /****/ int do_write(int fd, const void *buf, size_t count) { int bytes; errno = 0; do { bytes = write(fd, buf, count); }while ( bytes < 0 && errno == EINTR); return bytes; } int do_read(int fd, void *buf, size_t count) { int bytes; errno = 0; do { bytes = read(fd, buf, count); }while ( bytes < 0 && errno == EINTR); return bytes; } #ifdef _WIN32 #define F_PERM S_IREAD|S_IWRITE #else #define F_PERM S_IREAD|S_IWRITE|S_IRGRP|S_IROTH #endif int do_open(const char *pathname, int flags) { int fd; errno = 0; do { fd = open(pathname, flags, F_PERM); } while ( fd < 0 && errno == EINTR); return fd; } void do_close(int fd) { errno = 0; while (close(fd) < 0 && errno == EINTR); } /**************************************************************************/ /* */ /* */ #define tmp_template "CI_TMP_XXXXXX" /* extern int BODY_MAX_MEM; extern char *TMPDIR; */ int CI_BODY_MAX_MEM = 131072; char *CI_TMPDIR = "/var/tmp/"; /* int open_tmp_file(char *tmpdir,char *filename){ return ci_mktemp_file(tmpdir,tmp_template,filename); } */ int resize_buffer(ci_cached_file_t * body, int new_size) { char *newbuf; if (new_size < body->bufsize) return 1; if (new_size > CI_BODY_MAX_MEM) return 0; newbuf = ci_buffer_realloc(body->buf, new_size); if (newbuf) { body->buf = newbuf; body->bufsize = new_size; } return 1; } ci_cached_file_t *ci_cached_file_new(int size) { ci_cached_file_t *body; if (!(body = ci_object_pool_alloc(CACHED_FILE_POOL))) return NULL; if (size == 0) size = CI_BODY_MAX_MEM; if (size > 0 && size <= CI_BODY_MAX_MEM) { body->buf = ci_buffer_alloc(size * sizeof(char)); } else body->buf = NULL; if (body->buf == NULL) { body->bufsize = 0; if ((body->fd = ci_mktemp_file(CI_TMPDIR, tmp_template, body->filename)) < 0) { ci_debug_printf(1, "Can not open temporary filename in directory:%s\n", CI_TMPDIR); ci_object_pool_free(body); return NULL; } } else { body->bufsize = size; body->fd = -1; } body->endpos = 0; body->readpos = 0; body->flags = 0; body->unlocked = 0; body->attributes = NULL; return body; } void ci_cached_file_reset(ci_cached_file_t * body, int new_size) { if (body->fd > 0) { do_close(body->fd); unlink(body->filename); /*Comment out for debuging reasons */ } body->endpos = 0; body->readpos = 0; body->flags = 0; body->unlocked = 0; body->fd = -1; if (body->attributes) ci_array_destroy(body->attributes); body->attributes = NULL; if (!resize_buffer(body, new_size)) { /*free memory and open a file. */ } } void ci_cached_file_destroy(ci_cached_file_t * body) { if (!body) return; if (body->buf) ci_buffer_free(body->buf); if (body->fd >= 0) { do_close(body->fd); unlink(body->filename); /*Comment out for debuging reasons */ } if (body->attributes) ci_array_destroy(body->attributes); ci_object_pool_free(body); } void ci_cached_file_release(ci_cached_file_t * body) { if (!body) return; if (body->buf) ci_buffer_free(body->buf); if (body->fd >= 0) { do_close(body->fd); } if (body->attributes) ci_array_destroy(body->attributes); ci_object_pool_free(body); } int ci_cached_file_write(ci_cached_file_t * body, const char *buf, int len, int iseof) { int remains; int ret; if (iseof) { body->flags |= CI_FILE_HAS_EOF; ci_debug_printf(10, "Buffer size=%d, Data size=%" PRINTF_OFF_T "\n ", ((ci_cached_file_t *) body)->bufsize, (CAST_OFF_T) ((ci_cached_file_t *) body)->endpos); } if(len == 0) /*If no data to write just return 0;*/ return 0; if (body->fd > 0) { /*A file was open so write the data at the end of file....... */ lseek(body->fd, 0, SEEK_END); if ((ret = do_write(body->fd, buf, len)) < 0) { ci_debug_printf(1, "Cannot write to file!!! (errno=%d)\n", errno); } body->endpos += len; return len; } remains = body->bufsize - body->endpos; assert(remains >= 0); if (remains < len) { if ((body->fd = ci_mktemp_file(CI_TMPDIR, tmp_template, body->filename)) < 0) { ci_debug_printf(1, "I cannot create the temporary file: %s!!!!!!\n", body->filename); return -1; } ret = do_write(body->fd, body->buf, body->endpos); if( ret>=0 && do_write(body->fd, buf, len) >=0 ) { body->endpos += len; return len; } else { ci_debug_printf( 1, "Cannot write to cachefile: %s\n", strerror( errno ) ); return CI_ERROR; } } /* if remains 0) { memcpy(body->buf + body->endpos, buf, len); body->endpos += len; } return len; } /* body->unlocked=? */ int ci_cached_file_read(ci_cached_file_t * body, char *buf, int len) { int remains, bytes; if ((body->readpos == body->endpos) && (body->flags & CI_FILE_HAS_EOF)) return CI_EOF; if(len == 0) /*If no data to read just return 0*/ return 0; if (body->fd > 0) { if ((body->flags & CI_FILE_USELOCK) && body->unlocked >= 0) remains = body->unlocked - body->readpos; else remains = len; /* assert(remains>=0);*/ bytes = (remains > len ? len : remains); /*Number of bytes that we are going to read from file..... */ lseek(body->fd, body->readpos, SEEK_SET); if ((bytes = do_read(body->fd, buf, bytes)) > 0) body->readpos += bytes; return bytes; } if ((body->flags & CI_FILE_USELOCK) && body->unlocked >= 0) remains = body->unlocked - body->readpos; else remains = body->endpos - body->readpos; /* assert(remains>=0); */ bytes = (len <= remains ? len : remains); if (bytes > 0) { memcpy(buf, body->buf + body->readpos, bytes); body->readpos += bytes; } else { /*?????????????????????????????? */ bytes = 0; ci_debug_printf(10, "Read 0, %" PRINTF_OFF_T " %" PRINTF_OFF_T "\n", (CAST_OFF_T) body->readpos, (CAST_OFF_T) body->endpos); } return bytes; } /********************************************************************************/ /*ci_simple_file function implementation */ ci_simple_file_t *ci_simple_file_new(ci_off_t maxsize) { ci_simple_file_t *body; if (!(body = ci_object_pool_alloc(SIMPLE_FILE_POOL))) return NULL; if ((body->fd = ci_mktemp_file(CI_TMPDIR, tmp_template, body->filename)) < 0) { ci_debug_printf(1, "ci_simple_file_new: Can not open temporary filename in directory:%s\n", CI_TMPDIR); ci_object_pool_free(body); return NULL; } ci_debug_printf(5, "ci_simple_file_new: Use temporary filename: %s\n", body->filename); body->endpos = 0; body->readpos = 0; body->flags = 0; body->unlocked = 0; /*Not use look */ body->max_store_size = (maxsize>0?maxsize:0); body->bytes_in = 0; body->bytes_out = 0; body->attributes = NULL; return body; } ci_simple_file_t *ci_simple_file_named_new(char *dir, char *filename,ci_off_t maxsize) { ci_simple_file_t *body; if (!(body = ci_object_pool_alloc(SIMPLE_FILE_POOL))) return NULL; if (filename) { snprintf(body->filename, CI_FILENAME_LEN, "%s/%s", dir, filename); if ((body->fd = do_open(body->filename, O_CREAT | O_RDWR | O_EXCL)) < 0) { ci_debug_printf(1, "Can not open temporary filename: %s\n", body->filename); ci_object_pool_free(body); return NULL; } } else if ((body->fd = ci_mktemp_file(dir, tmp_template, body->filename)) < 0) { ci_debug_printf(1, "Can not open temporary filename in directory: %s\n", dir); ci_object_pool_free(body); return NULL; } body->endpos = 0; body->readpos = 0; body->flags = 0; body->unlocked = 0; body->max_store_size = (maxsize>0?maxsize:0); body->bytes_in = 0; body->bytes_out = 0; body->attributes = NULL; #if defined(USE_POSIX_MAPPED_FILES) body->mmap_addr = NULL; body->mmap_size = 0; #endif return body; } void ci_simple_file_destroy(ci_simple_file_t * body) { if (!body) return; if (body->fd >= 0) { do_close(body->fd); unlink(body->filename); /*Comment out for debuging reasons */ } if (body->attributes) ci_array_destroy(body->attributes); #if defined(USE_POSIX_MAPPED_FILES) if (body->mmap_addr) munmap(body->mmap_addr, body->mmap_size); #endif ci_object_pool_free(body); } void ci_simple_file_release(ci_simple_file_t * body) { if (!body) return; if (body->fd >= 0) { do_close(body->fd); } if (body->attributes) ci_array_destroy(body->attributes); #if defined(USE_POSIX_MAPPED_FILES) if (body->mmap_addr) munmap(body->mmap_addr, body->mmap_size); #endif ci_object_pool_free(body); } int ci_simple_file_write(ci_simple_file_t * body, const char *buf, int len, int iseof) { int ret; int wsize = 0; if (body->flags & CI_FILE_HAS_EOF) { if (len > 0) { ci_debug_printf( 1, "Cannot write to file: '%s', the eof flag is set!\n", body->filename); } return 0; } if(len <= 0) { if (iseof) body->flags |= CI_FILE_HAS_EOF; return 0; } if (body->endpos < body->readpos) { wsize = min(body->readpos-body->endpos-1, len); } else if(body->max_store_size && body->endpos >= body->max_store_size) { /*If we are going to entre ring mode. If we are using locking we can not enter ring mode.*/ if (body->readpos!=0 && (body->flags & CI_FILE_USELOCK)==0) { body->endpos = 0; if (!(body->flags & CI_FILE_RING_MODE)) { body->flags |= CI_FILE_RING_MODE; ci_debug_printf(9, "Entering Ring mode!\n"); } wsize = min(body->readpos-body->endpos-1, len); } else { if ((body->flags & CI_FILE_USELOCK) != 0) ci_debug_printf(1, "File locked and no space on file for writing data, (Is this a bug?)!\n"); return 0; } } else { if (body->max_store_size) wsize = min(body->max_store_size - body->endpos, len); else wsize = len; } lseek(body->fd, body->endpos, SEEK_SET); if ((ret = do_write(body->fd, buf, wsize)) < 0) { ci_debug_printf( 1, "Cannot write to file: %s\n", strerror( errno ) ); } else { body->endpos += ret; body->bytes_in += ret; } if (iseof && ret == len) { body->flags |= CI_FILE_HAS_EOF; ci_debug_printf(9, "Body data size=%" PRINTF_OFF_T "\n ", (CAST_OFF_T) body->endpos); } return ret; } int ci_simple_file_read(ci_simple_file_t * body, char *buf, int len) { int remains, bytes; if (len <= 0) return 0; if ((body->readpos == body->endpos)) { if((body->flags & CI_FILE_HAS_EOF)) { ci_debug_printf(9, "Has EOF and no data to read, send EOF\n"); return CI_EOF; } else { return 0; } } if(body->max_store_size && body->readpos == body->max_store_size) { body->readpos = 0; } if ((body->flags & CI_FILE_USELOCK) && body->unlocked >= 0) { remains = body->unlocked - body->readpos; } else if(body->endpos > body->readpos) { remains = body->endpos - body->readpos; } else { if(body->max_store_size) { remains = body->max_store_size - body->readpos; } else { ci_debug_printf(9, "Error? anyway send EOF\n"); return CI_EOF; } } bytes = (remains > len ? len : remains); /*Number of bytes that we are going to read from file..... */ lseek(body->fd, body->readpos, SEEK_SET); if ((bytes = do_read(body->fd, buf, bytes)) > 0) { body->readpos += bytes; body->bytes_out += bytes; } return bytes; } int ci_simple_file_truncate(ci_simple_file_t *body, ci_off_t new_size) { if (new_size > body->endpos) return 0; if (new_size == 0) { new_size = lseek(body->fd, 0, SEEK_END); if (new_size > body->endpos) /* ????? */ return 0; } else { if (ftruncate(body->fd, new_size) != 0) return 0; /*failed to resize*/ } body->endpos = new_size; if (body->readpos > new_size) body->readpos = new_size; if (body->unlocked > new_size) body->unlocked = new_size; return 1; } #if defined(USE_POSIX_MAPPED_FILES) const char * ci_simple_file_to_const_string(ci_simple_file_t *body) { ci_off_t map_size; char *addr = NULL; if (!(body->flags & CI_FILE_HAS_EOF)) { ci_debug_printf( 1, "mmap to file: '%s' failed, the eof flag is not set!\n", body->filename); return NULL; } /* We need one more byte for string termination*/ map_size = body->endpos + 1; if (body->mmap_addr == NULL) { addr = mmap(NULL, map_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, body->fd, 0); if (!addr) return 0; /*Terminate buffer */ addr[map_size - 1] = '\0'; body->mmap_addr = addr; body->mmap_size = map_size; } return body->mmap_addr; } #define CI_MEMBUF_SF_FLAGS (CI_MEMBUF_CONST | CI_MEMBUF_RO | CI_MEMBUF_NULL_TERMINATED) ci_membuf_t *ci_simple_file_to_membuf(ci_simple_file_t *body, unsigned int flags) { assert((CI_MEMBUF_SF_FLAGS & flags) ==flags); assert(flags & CI_MEMBUF_CONST); void *addr = (void *)ci_simple_file_to_const_string(body); if (!addr) return NULL; return ci_membuf_from_content(body->mmap_addr, body->mmap_size, body->endpos, CI_MEMBUF_CONST | CI_MEMBUF_RO | CI_MEMBUF_NULL_TERMINATED | CI_MEMBUF_HAS_EOF); } #endif /*******************************************************************/ /*ring memory buffer implementation */ struct ci_ring_buf *ci_ring_buf_new(int size) { struct ci_ring_buf *buf = ci_object_pool_alloc(RING_BUF_POOL); if (!buf) return NULL; buf->buf = ci_buffer_alloc(size); if (!buf->buf) { ci_object_pool_free(buf); return NULL; } buf->end_buf=buf->buf+size-1; buf->read_pos = buf->buf; buf->write_pos = buf->buf; buf->full = 0; return buf; } void ci_ring_buf_destroy(struct ci_ring_buf *buf) { ci_buffer_free(buf->buf); ci_object_pool_free(buf); } int ci_ring_buf_is_empty(struct ci_ring_buf *buf) { return (buf->read_pos==buf->write_pos) && (buf->full==0); } int ci_ring_buf_write_block(struct ci_ring_buf *buf, char **wb, int *len) { if(buf->read_pos == buf->write_pos && buf->full == 0) { *wb = buf->write_pos; *len = buf->end_buf - buf->write_pos + 1; return 0; } else if(buf->read_pos >= buf->write_pos) { *wb = buf->write_pos; *len = buf->read_pos - buf->write_pos; return 0; } else { /*buf->read_pos < buf->write_pos*/ *wb = buf->write_pos; *len = buf->end_buf - buf->write_pos + 1; return 1; } } int ci_ring_buf_read_block(struct ci_ring_buf *buf, char **rb, int *len) { if (buf->read_pos == buf->write_pos && buf->full == 0) { *rb = buf->read_pos; *len = 0; return 0; } else if(buf->read_pos >= buf->write_pos) { *rb = buf->read_pos; *len = buf->end_buf - buf->read_pos +1; return (buf->read_pos!=buf->buf? 1:0); } else { /*buf->read_pos < buf->write_pos*/ *rb = buf->read_pos; *len = buf->write_pos - buf->read_pos; return 0; } } void ci_ring_buf_consume(struct ci_ring_buf *buf, int len) { if(len <= 0) return; buf->read_pos += len; if(buf->read_pos > buf->end_buf) buf->read_pos = buf->buf; if(buf->full) buf->full = 0; } void ci_ring_buf_produce(struct ci_ring_buf *buf, int len) { if(len <= 0) return; buf->write_pos += len; if (buf->write_pos > buf->end_buf) buf->write_pos = buf->buf; if(buf->write_pos == buf->read_pos) buf->full = 1; } int ci_ring_buf_write(struct ci_ring_buf *buf, const char *data,int size) { char *wb; int wb_len, ret, written; written = 0; do { ret = ci_ring_buf_write_block(buf, &wb, &wb_len); if (wb_len) { wb_len = min(size, wb_len); memcpy(wb, data, wb_len); ci_ring_buf_produce(buf, wb_len); size -= wb_len; data += wb_len; written += wb_len; } } while ((ret!=0) && (size>0)); return written; } int ci_ring_buf_read(struct ci_ring_buf *buf, char *data,int size) { char *rb; int rb_len, ret, data_read; data_read = 0; do { ret = ci_ring_buf_read_block(buf, &rb, &rb_len); if (rb_len) { rb_len = min(size, rb_len); memcpy(data, rb, rb_len); ci_ring_buf_consume(buf, rb_len); size -= rb_len; data += rb_len; data_read += rb_len; } } while ((ret!=0) && (size>0 )); return data_read; } c_icap-0.4.2/tests/0000775000175000017500000000000012601747561011111 500000000000000c_icap-0.4.2/tests/test_allocators.c0000664000175000017500000000420412567550777014413 00000000000000#include "common.h" #include #include #include #include #include #include #include #include "cfg_param.h" #include "ci_threads.h" #include "mem.h" #include "debug.h" int run_allocs() { int l, i, k; void *v; for (l = 1; l< 50; l++) { for (k = 1; k < 133; k++) { for( i = k; i < 32768; i = i*2) { ci_debug_printf(5, "Alloc buffer for %d bytes\n", i); v = ci_buffer_alloc(i); memset(v, 0x1, i); ci_buffer_free(v); } } for (k = 11; k < 73; k++) { ci_debug_printf(5, "Alloc buffer for realloc for %d bytes\n", k); v = ci_buffer_alloc(k); for( i = 17; i < 32768; i = i*2) { ci_debug_printf(5, "ReAlloc buffer for %d bytes\n", i); v = ci_buffer_realloc(v, i); memset(v, 0x1, i); } ci_buffer_free(v); } } return 1; } int threadsnum = 100; static struct ci_options_entry options[] = { {"-d", "debug_level", &CI_DEBUG_LEVEL, ci_cfg_set_int, "The debug level"}, {"-t", "threads", &threadsnum, ci_cfg_set_int, "The numbers of threads to use"}, {NULL,NULL,NULL,NULL,NULL} }; int mem_init(); int main(int argc, char *argv[]) { int i; ci_thread_t *threads; CI_DEBUG_STDOUT = 1; ci_cfg_lib_init(); mem_init(); if (!ci_args_apply(argc, argv, options)) { ci_args_usage(argv[0], options); exit(-1); } /* Simple one thread test */ run_allocs(); /* Run multithread test */ threads = malloc(sizeof(ci_thread_t) * threadsnum); for (i = 0; i < threadsnum; i++) threads[i] = 0; for (i = 0; i < threadsnum; i++) { ci_debug_printf(8, "Thread %d started\n", i); ci_thread_create(&(threads[i]), (void *(*)(void *)) run_allocs, (void *) NULL /*data*/); } for (i = 0; i < threadsnum; i++) { ci_thread_join(threads[i]); ci_debug_printf(6, "Thread %d exited\n", i); } return 0; } c_icap-0.4.2/tests/test_lists.c0000664000175000017500000001577012567550777013420 00000000000000#include "common.h" #include #include #include #include "c-icap.h" #include "cfg_param.h" #include "mem.h" #include "array.h" #include "debug.h" void log_errors(void *unused, const char *format, ...) { va_list ap; va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); } static struct ci_options_entry options[] = { {"-d", "debug_level", &CI_DEBUG_LEVEL, ci_cfg_set_int, "The debug level"}, {NULL,NULL,NULL,NULL,NULL} }; int print_str(void *data, const char *name, const void *value) { const char *v = (const char *)value; ci_debug_printf(2, "\t%s: %s\n", name, v); return 0; } int mem_init(); struct obj { char c; char buf[64]; }; void fill_obj(struct obj *o, char c) { o->c = c; memset(o->buf, c, 64); o->buf[63] = '\0'; } int check_obj(void *data, const void *obj) { int i; struct obj *o = (struct obj *)obj; int *k = (int *)data; (*k)++; if (!o) { ci_debug_printf(1, "Empty data stored in list?\n"); return -1; } for (i=0; i < 62; i++) { if (o->c != o->buf[i]) { ci_debug_printf(1, "Not valid data stored in list?\n"); return -1; } } return 0; } struct cb_rm_data { ci_list_t *list; char item; }; int cb_remove_anobj(void *data, const void *obj) { struct obj *o = (struct obj *)obj; struct cb_rm_data *rd = (struct cb_rm_data *)data; if (o->c == rd->item) { ci_list_remove(rd->list, o); } ci_debug_printf(5, "item->%c %s\n", o->c, (o->c == rd->item ? "rm" : "")); return 0; } int main(int argc,char *argv[]) { ci_list_t *list; struct obj o; struct obj *pO; int i, k, l; char c; ci_cfg_lib_init(); mem_init(); __log_error = (void (*)(void *, const char *,...)) log_errors; /*set c-icap library log function */ if (!ci_args_apply(argc, argv, options)) { ci_args_usage(argv[0], options); exit(-1); } list = ci_list_create(4096, sizeof(struct obj)); if (!list) { ci_debug_printf(1, "Error creating list\n"); exit(-1); } for (l = 0; l < 2; l++) { for (i = 0, k =0; i < 1024; i++) { for (c = 'a'; c < 'z'; c++) { fill_obj(&o, c); if (c % 2) ci_list_push(list, &o); else ci_list_push_back(list, &o); k++; } } ci_debug_printf(1, "OK added %d items\n", k); k = 0; ci_debug_printf(1, "Check list...\n"); ci_list_iterate(list, (void *)&k, check_obj); ci_debug_printf(1, "Counted %d valid items\n", k); ci_debug_printf(1, "Remove all 's' objects...\n"); k = 0; fill_obj(&o, 's'); while(ci_list_remove(list, &o)) { k++; } fill_obj(&o, 'k'); while(ci_list_remove(list, &o)) { k++; } ci_debug_printf(1, "Removed %d objects\n", k); ci_debug_printf(1, "Check obj removal on iterate\n"); struct cb_rm_data rd; rd.list = list; rd.item = 'l'; ci_list_iterate(list, (void *)&rd, cb_remove_anobj); ci_debug_printf(1, "done\n"); k = 0; ci_debug_printf(1, "Check list...\n"); ci_list_iterate(list, (void *)&k, check_obj); ci_debug_printf(1, "Counted %d valid items\n", k); ci_debug_printf(1, "Add back the removed objects\n"); k = 0; fill_obj(&o, 's'); for (i=0; i < 1024; i++) { ci_list_push(list, &o); k++; } fill_obj(&o, 'k'); for (i=0; i < 1024; i++) { ci_list_push_back(list, &o); k++; } ci_debug_printf(1, "Add %d objects\n", k); k = 0; ci_debug_printf(1, "Check list...\n"); ci_list_iterate(list, (void *)&k, check_obj); ci_debug_printf(1, "Counted %d valid items\n", k); ci_debug_printf(1, "Remove 1024 from the head and 1024 from the tail\n"); for (i=0; i < 1024; i++) { if (!ci_list_pop(list, &o)) ci_debug_printf(1, "Not enough objects in list!\n"); } for (i=0; i < 1024; i++) { if (!ci_list_pop_back(list, &o)) ci_debug_printf(1, "Not enough objects in list!\n"); k++; } k = 0; ci_debug_printf(1, "Check list...\n"); ci_list_iterate(list, (void *)&k, check_obj); ci_debug_printf(1, "Counted %d valid items\n", k); fill_obj(&o, 'l'); ci_debug_printf(1, "Find one object of '%c'\n", 'l'); if (!ci_list_search(list, &o)) { ci_debug_printf(1, "\t Not Found (correct)\n"); } else { ci_debug_printf(1, "\t Found! (wrong!)\n"); } fill_obj(&o, 's'); ci_debug_printf(1, "Find one object of '%c'\n", 's'); if (!ci_list_search(list, &o)) { ci_debug_printf(1, "\t Not Found (correct)\n"); } else { ci_debug_printf(1, "\t Found! (wrong!)\n"); } fill_obj(&o, 'k'); ci_debug_printf(1, "Find one object of '%c'\n", 'k'); if (!ci_list_search(list, &o)) { ci_debug_printf(1, "\t Not Found (correct)\n"); } else { ci_debug_printf(1, "\t Found!(wrong!)\n"); } fill_obj(&o, 'd'); ci_debug_printf(1, "Find one object of '%c'\n", 'd'); if (!ci_list_search(list, &o)) { ci_debug_printf(1, "\t Not Found (wrong)\n"); } else { ci_debug_printf(1, "\t Found! (correct)\n"); } for (pO = ci_list_first(list), i = 0; pO != NULL; pO = ci_list_next(list)) { if (pO->c == 'v') { ci_list_remove(list, pO); i++; ci_debug_printf(5, "%d, an item->%c removed\n", i, pO->c); } } ci_debug_printf(1, "removed %d 'v' items (list should have %d items)\n", i, k - i); k = 0; while (ci_list_pop(list, &o)) k++; ci_debug_printf(1, "Removed %d items\n", k); } /* Check removing items in list*/ for (k=0, c = 'a'; c <= 'c'; c++) { for (i = 0; i < 3; i++) { fill_obj(&o, c); ci_list_push_back(list, &o); k++; } } ci_debug_printf(1, "OK added %d items\n", k); for (pO = ci_list_first(list), i = 0; pO != NULL; pO = ci_list_next(list)) { if (pO->c == 'c') { ci_list_remove(list, pO); i++; ci_debug_printf(5, "%d, an item->%c removed\n", i, pO->c); } } ci_debug_printf(1, "removed %d 'c' items (list should have %d items)\n", i, k - i); k = 0; while (ci_list_pop(list, &o)) k++; ci_debug_printf(1, "Removed %d items\n", k); ci_list_destroy(list); ci_debug_printf(1, "Test finished!\n"); return 0; } c_icap-0.4.2/tests/test_body.c0000664000175000017500000000515112567550777013207 00000000000000#include "common.h" #include #include "c-icap.h" #include "body.h" #include "cfg_param.h" #include "debug.h" #include "md5.h" #include "mem.h" static void MDPrint(const char *label, unsigned char digest[16]) { unsigned int i; printf("%s:", label); for (i = 0; i < 16; i++) printf("%02x", digest[i]); printf("\n"); } void log_errors(void *unused, const char *format, ...) { va_list ap; va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); } char *FILENAME = NULL; static struct ci_options_entry options[] = { {"-d", "debug_level", &CI_DEBUG_LEVEL, ci_cfg_set_int, "The debug level"}, {"-f", "file", &FILENAME, ci_cfg_set_str, "The path of the file to load"}, {NULL,NULL,NULL,NULL,NULL} }; int mem_init(); int init_body_system(); int main(int argc,char *argv[]) { ci_membuf_t *mb = NULL; ci_simple_file_t *sf = NULL; ci_cfg_lib_init(); mem_init(); init_body_system(); __log_error = (void (*)(void *, const char *,...)) log_errors; /*set c-icap library log function */ if (!ci_args_apply(argc, argv, options) || !FILENAME) { ci_args_usage(argv[0], options); exit(-1); } FILE *f; char buf[4096]; if ((f = fopen(FILENAME, "r")) == NULL) { ci_debug_printf(1, "Can not open file '%s'!\n", FILENAME); exit(-1); } if (!(sf = ci_simple_file_new(0))) { ci_debug_printf(1, "Error allocating simple body struct!\n"); exit(-1); } ci_MD5_CTX md; unsigned char digest[16]; ci_MD5Init(&md); size_t bytes; while ((bytes = fread(buf, 1, sizeof(buf), f))) { ci_MD5Update(&md, (unsigned char *)buf, bytes); ci_simple_file_write(sf, buf, bytes, 0); } ci_simple_file_write(sf, buf, 0, 1); ci_MD5Final(digest, &md); MDPrint("File md5", digest); mb = ci_simple_file_to_membuf(sf, CI_MEMBUF_CONST); ci_MD5Init(&md); ci_MD5Update(&md, (unsigned char *)mb->buf, mb->endpos); ci_MD5Final(digest, &md); MDPrint("From membuf_t, whole string md5", digest); ci_MD5Init(&md); int len; while((len = ci_membuf_read(mb, buf, sizeof(buf))) > 0) { ci_MD5Update(&md, (unsigned char *)buf, len); } ci_MD5Final(digest, &md); MDPrint("From membuf_t read blocks md5", digest); if (mb) ci_membuf_free(mb); ci_simple_file_destroy(sf); return 0; } c_icap-0.4.2/tests/test_arrays.c0000664000175000017500000001362512567550777013560 00000000000000#include "common.h" #include #include #include #include "c-icap.h" #include "cfg_param.h" #include "mem.h" #include "array.h" #include "debug.h" void log_errors(void *unused, const char *format, ...) { va_list ap; va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); } static struct ci_options_entry options[] = { {"-d", "debug_level", &CI_DEBUG_LEVEL, ci_cfg_set_int, "The debug level"}, {NULL,NULL,NULL,NULL,NULL} }; int print_str(void *data, const char *name, const void *value) { const char *v = (const char *)value; ci_debug_printf(2, "\t%s: %s\n", name, v); return 0; } int mem_init(); int main(int argc,char *argv[]) { ci_str_array_t *arr_str; ci_ptr_array_t *arr_ptr; ci_vector_t *vect_str; ci_vector_t *vect_ptr; ci_dyn_array_t *dyn_arr; const ci_array_item_t *item; int i, j; char name[128]; char value[128]; void *data; char *strdata; ci_cfg_lib_init(); mem_init(); __log_error = (void (*)(void *, const char *,...)) log_errors; /*set c-icap library log function */ if (!ci_args_apply(argc, argv, options)) { ci_args_usage(argv[0], options); exit(-1); } ci_debug_printf(1, "Creating array of strings ... "); arr_str = ci_str_array_new(32768); for (i = 1; i< 128; i++) { sprintf(name, "name%d", i); sprintf(value, "value%d", i); ci_str_array_add(arr_str, name, value); } ci_debug_printf(1, "done ... test it ... "); ci_debug_printf(2, "\n\nArray of strings:\n"); ci_str_array_iterate(arr_str, NULL, print_str); ci_debug_printf(2, "\nTest random access:\n"); for (i = 0; i< 128; i++) { item = ci_str_array_get_item(arr_str, i); if (item) { ci_debug_printf(2, "\t%s:%s\n", item->name, (char *)item->value); } } ci_debug_printf(1, "done\n"); ci_debug_printf(1, "Test pop1: \n"); for (i = 0; i < 64; i++) ci_str_array_pop(arr_str); for (i = 64; i < 128; i++) { sprintf(name, "name%d", i); sprintf(value, "value%d", i); ci_str_array_add(arr_str, name, value); } ci_debug_printf(2, "Result: \n"); ci_str_array_iterate(arr_str, NULL, print_str); ci_debug_printf(1, "Test pop 2: \n"); while ((item = ci_str_array_pop(arr_str)) != NULL) { ci_debug_printf(2, " popped : %s %s \n", item->name, (char *)item->value); } ci_str_array_destroy(arr_str); ci_debug_printf(1, "done \n"); ci_debug_printf(1, "Creating array of pointers ... "); arr_ptr = ci_ptr_array_new(32768); for (i = 1; i< 128; i++) { sprintf(name, "name%d", i); sprintf(value, "dynvalue%d", i); data = strdup(value); ci_ptr_array_add(arr_ptr, name, data); } ci_debug_printf(1, "done ... test it ... "); ci_debug_printf(2, "Array of pointers:\n"); ci_ptr_array_iterate(arr_ptr, NULL, print_str); ci_debug_printf(1, "done\n"); char buf[1024]; ci_debug_printf(1, "Test pop on array of pointers..."); while((data = ci_ptr_array_pop_value(arr_ptr, buf, sizeof(buf))) != NULL) { ci_debug_printf(3, "Deleting : %s: %s\n", buf, (char *)data); free(data); } ci_debug_printf(1, "done\n"); ci_ptr_array_destroy(arr_ptr); vect_str = ci_str_vector_create(4096); for (j = 1; j < 3; j++) { for (i = 1; i< 128; i++) { sprintf(value, "value: %d", i); strdata = ci_str_vector_add(vect_str, value); if (!strdata) ci_debug_printf(2, "Can not add: %s\n", value); } /*Check if casting works*/ ci_debug_printf(1, "Test casting for vectors:"); const char **p = ci_str_vector_cast_to_charchar(vect_str); const char **s; for(s = p; *s!=NULL; s++) { ci_debug_printf(2, "from charchar value: %s\n", *s); } ci_str_vector_t *v = ci_str_vector_cast_from_charchar(p); ci_debug_printf(1, "Returned vector max size: %d, itmes %d\n", v->max_size, v->count); while((strdata = ci_str_vector_pop(vect_str)) != NULL) { ci_debug_printf(2, "Popped value: %s\n", strdata); } } ci_str_vector_destroy(vect_str); ci_debug_printf(1, "\nTest for dynamic arrays\n"); dyn_arr = ci_dyn_array_new(1024); for (i = 0, j = 0; i < 1024; ++i) { sprintf(name, "name%d", i); sprintf(value, "value%d", i); if (ci_dyn_array_add(dyn_arr, name, value, strlen(value) + 1) == NULL) { ci_debug_printf(1, "Failed to add : %s/%s!\n", name, value); } else j += strlen(name) + strlen(value) + 2; } ci_debug_printf(1, "Size of dynamic array: %d, of key/value pairs size: %d\n", ci_dyn_array_size(dyn_arr), j); for (i = 0, j = 0; i < ci_dyn_array_size(dyn_arr); ++i) { char *v = ci_dyn_array_value(dyn_arr, i); char *n = ci_dyn_array_name(dyn_arr, i); j += strlen(n) + strlen(v) + 2; ci_debug_printf(5, "%i = %p:%s/%s\n", i, ci_dyn_array_get_item(dyn_arr, i), ci_dyn_array_name(dyn_arr, i), (char *)ci_dyn_array_value(dyn_arr, i)); } ci_debug_printf(1, "%d computed key/value pairs of summary size: %d\n", i, j); ci_debug_printf(1, "Search for %s: %s\n", "name123", (char *)ci_dyn_array_search(dyn_arr, "name123")); ci_debug_printf(1, "Search for %s: %s\n", "name1023", (char *)ci_dyn_array_search(dyn_arr, "name1023")); ci_debug_printf(1, "Search for %s: %s\n", "name0", (char *)ci_dyn_array_search(dyn_arr, "name0")); ci_debug_printf(1, "Search for %s: %s\n", "nameNotExist", (char *)ci_dyn_array_search(dyn_arr, "nameNotExist")); ci_dyn_array_destroy(dyn_arr); ci_debug_printf(1, "\nEnd of dynamic arrays test\n"); return 0; } c_icap-0.4.2/tests/test_base64.c0000664000175000017500000000107112567550777013333 00000000000000#include "common.h" #include "simple_api.h" int main(int argc, char *argv[]) { char encoded[1024]; char decoded[1024]; int l; const char *str; if (argc > 1) { str = argv[1]; } else str = "Good morning"; ci_base64_encode((unsigned char *)str, (size_t)strlen(str), encoded, 1024); l = ci_base64_decode(encoded, decoded, 1024); decoded[l] = '\0'; printf("Input string: \'%s\'\n", str); printf("Base64 encoded string: \'%s\'\n", encoded); printf("Decoded string: \'%s\'\n", decoded); return 0; } c_icap-0.4.2/tests/Makefile.am0000664000175000017500000000061412567550777013102 00000000000000 CONFIGDIR=@sysconfdir@ PKGLIBDIR=@pkglibdir@ MODULESDIR=$(pkglibdir)/ SERVICESDIR=$(pkglibdir)/ #CONFIGDIR=$(sysconfdir)/ AM_CFLAGS= -I../include/ AM_LDFLAGS = -rdynamic -rpath @libdir@ @THREADS_LDFLAGS@ LDADD = ../libicapapi.la @THREADS_LDADD@ @DL_ADD_FLAG@ noinst_PROGRAMS = test_cache test_tables test_headers test_allocators test_arrays test_lists test_md5 test_base64 test_body test_ops c_icap-0.4.2/tests/test_tables.c0000664000175000017500000000636312567550777013532 00000000000000#include "common.h" #include #include #include #include "c-icap.h" #include "dlib.h" #include "module.h" #include "mem.h" #include "lookup_table.h" #include "cache.h" #include "debug.h" void init_internal_lookup_tables(); char *path; char **keys = NULL; void log_errors(void *unused, const char *format, ...) { va_list ap; va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); } int load_module(const char *directive,const char **argv,void *setdata) { CI_DLIB_HANDLE lib; common_module_t *module; if(argv== NULL || argv[0]== NULL) return 0; lib = ci_module_load(argv[0],"./"); if(!lib) { printf("Error opening module :%s\n",argv[0]); return 0; } module = ci_module_sym(lib, "module"); if(!module) { printf("Error opening module %s: can not find symbol module\n",argv[0]); return 0; } if (module->init_module) module->init_module(NULL); if (module->post_init_module) module->post_init_module(NULL); return 1; } int cfg_set_str_list(const char *directive, const char **argv, void *setdata) { int i; char ***list = (char ***)setdata; if (setdata == NULL) return 0; if (argv == NULL || argv[0] == NULL) { return 0; } if (!*list) *list = calloc(1024, sizeof(char *)); for (i = 0; i < 1023 && (*list)[i]; ++i); if ((*list)[i] == NULL) (*list)[i] = strdup(argv[0]); ci_debug_printf(2, "Setting parameter :%s=%s\n", directive, argv[0]); return 1; } static struct ci_options_entry options[] = { {"-d", "debug_level", &CI_DEBUG_LEVEL, ci_cfg_set_int, "The debug level"}, {"-m", "module", NULL, load_module, "The path of the table"}, {"-p", "table_path", &path, ci_cfg_set_str, "The path of the table"}, {"-k", "key", &keys, cfg_set_str_list, "The key to search"}, {NULL,NULL,NULL,NULL,NULL} }; int main(int argc,char *argv[]) { struct ci_lookup_table *table; void *e,*v,**vals; char *key; int i, k; ci_cfg_lib_init(); mem_init(); init_internal_lookup_tables(); __log_error = (void (*)(void *, const char *,...)) log_errors; /*set c-icap library log function */ if (!ci_args_apply(argc, argv, options) || !path || !keys) { ci_args_usage(argv[0], options); exit(-1); } table = ci_lookup_table_create(path); if(!table) { printf("Error creating table\n"); return -1; } if (!table->open(table)) { printf("Error opening table\n"); return -1; } for (k = 0; keys[k] != NULL && k < 1024; ++k) { key = keys[k]; e = table->search(table,key,&vals); if (e) { printf("Result :\n\t%s:",key); if (vals) { for (v=vals[0],i=0;v!=NULL;v=vals[++i]) { printf("%s ",(char *)v); } } printf("\n"); } else { printf("Key '%s' not found\n", key); } } ci_lookup_table_destroy(table); return 0; } c_icap-0.4.2/tests/test_ops.c0000664000175000017500000000474512567550777013063 00000000000000#include "common.h" #include #include #include #include "c-icap.h" #include "cfg_param.h" #include "debug.h" #include "types_ops.h" #include "mem.h" #include "net_io.h" char *str_ip(ci_ip_t *ip) { char ip_buf[512]; char mask_buf[512]; static char buf[1024]; sprintf(buf, "%s/%s", ci_inet_ntoa(ip->family, &ip->address, ip_buf, sizeof(ip_buf)), ci_inet_ntoa(ip->family, &ip->netmask, mask_buf, sizeof(mask_buf))); return buf; } int check_ip_ops() { int i , ret = 1; char ip_buf[128]; ci_ip_t *ip1 = ci_ip_ops.dup("192.168.1.1/255.255.255.248", default_allocator); for (i = 1; i < 8 && ret; ++i) { snprintf(ip_buf, sizeof(ip_buf), "192.168.1.%d", i); ci_ip_t *ip2 = ci_ip_ops.dup(ip_buf, default_allocator); printf("IP network address: %s\n", str_ip(ip1)); printf("IP check address: %s\n", str_ip(ip2)); ret = ci_ip_ops.equal(ip1, ip2); printf("Check result: %d\n\n", ret); ci_ip_ops.free(ip2, default_allocator); } for (i = 8; i < 16 && ret; ++i) { snprintf(ip_buf, sizeof(ip_buf), "192.168.1.%d", i); ci_ip_t *ip2 = ci_ip_ops.dup(ip_buf, default_allocator); printf("IP network address: %s\n", str_ip(ip1)); printf("IP check address: %s\n", str_ip(ip2)); ret = ci_ip_ops.equal(ip1, ip2); printf("Check result: %d\n\n", ret); ret = !ret; ci_ip_ops.free(ip2, default_allocator); } ci_ip_ops.free(ip1, default_allocator); return ret; } void log_errors(void *unused, const char *format, ...) { va_list ap; va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); } static struct ci_options_entry options[] = { {"-d", "debug_level", &CI_DEBUG_LEVEL, ci_cfg_set_int, "The debug level"}, {NULL,NULL,NULL,NULL,NULL} }; int main(int argc,char *argv[]) { int ret = 0; ci_cfg_lib_init(); __log_error = (void (*)(void *, const char *,...)) log_errors; /*set c-icap library log function */ if (!ci_args_apply(argc, argv, options)) { ci_args_usage(argv[0], options); exit(-1); } ci_cfg_lib_init(); mem_init(); if (!check_ip_ops()) { ci_debug_printf(1, "ip_ops check failed!\n"); ret = -1; } return ret; } c_icap-0.4.2/tests/Makefile.in0000664000175000017500000005570012601747525013105 00000000000000# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ noinst_PROGRAMS = test_cache$(EXEEXT) test_tables$(EXEEXT) \ test_headers$(EXEEXT) test_allocators$(EXEEXT) \ test_arrays$(EXEEXT) test_lists$(EXEEXT) test_md5$(EXEEXT) \ test_base64$(EXEEXT) test_body$(EXEEXT) test_ops$(EXEEXT) subdir = tests DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/autoconf.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) test_allocators_SOURCES = test_allocators.c test_allocators_OBJECTS = test_allocators.$(OBJEXT) test_allocators_LDADD = $(LDADD) test_allocators_DEPENDENCIES = ../libicapapi.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = test_arrays_SOURCES = test_arrays.c test_arrays_OBJECTS = test_arrays.$(OBJEXT) test_arrays_LDADD = $(LDADD) test_arrays_DEPENDENCIES = ../libicapapi.la test_base64_SOURCES = test_base64.c test_base64_OBJECTS = test_base64.$(OBJEXT) test_base64_LDADD = $(LDADD) test_base64_DEPENDENCIES = ../libicapapi.la test_body_SOURCES = test_body.c test_body_OBJECTS = test_body.$(OBJEXT) test_body_LDADD = $(LDADD) test_body_DEPENDENCIES = ../libicapapi.la test_cache_SOURCES = test_cache.c test_cache_OBJECTS = test_cache.$(OBJEXT) test_cache_LDADD = $(LDADD) test_cache_DEPENDENCIES = ../libicapapi.la test_headers_SOURCES = test_headers.c test_headers_OBJECTS = test_headers.$(OBJEXT) test_headers_LDADD = $(LDADD) test_headers_DEPENDENCIES = ../libicapapi.la test_lists_SOURCES = test_lists.c test_lists_OBJECTS = test_lists.$(OBJEXT) test_lists_LDADD = $(LDADD) test_lists_DEPENDENCIES = ../libicapapi.la test_md5_SOURCES = test_md5.c test_md5_OBJECTS = test_md5.$(OBJEXT) test_md5_LDADD = $(LDADD) test_md5_DEPENDENCIES = ../libicapapi.la test_ops_SOURCES = test_ops.c test_ops_OBJECTS = test_ops.$(OBJEXT) test_ops_LDADD = $(LDADD) test_ops_DEPENDENCIES = ../libicapapi.la test_tables_SOURCES = test_tables.c test_tables_OBJECTS = test_tables.$(OBJEXT) test_tables_LDADD = $(LDADD) test_tables_DEPENDENCIES = ../libicapapi.la AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = test_allocators.c test_arrays.c test_base64.c test_body.c \ test_cache.c test_headers.c test_lists.c test_md5.c test_ops.c \ test_tables.c DIST_SOURCES = test_allocators.c test_arrays.c test_base64.c \ test_body.c test_cache.c test_headers.c test_lists.c \ test_md5.c test_ops.c test_tables.c am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BDB_ADD_FLAG = @BDB_ADD_FLAG@ BDB_ADD_LDADD = @BDB_ADD_LDADD@ BZLIB_ADD_FLAG = @BZLIB_ADD_FLAG@ BZLIB_ADD_LDADD = @BZLIB_ADD_LDADD@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CICAPLIB_VERSION = @CICAPLIB_VERSION@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ C_ICAP_HEX_VERSION = @C_ICAP_HEX_VERSION@ DEFINE_INT64 = @DEFINE_INT64@ DEFINE_INT8 = @DEFINE_INT8@ DEFINE_OFF_T = @DEFINE_OFF_T@ DEFINE_SIZE_OFF_T = @DEFINE_SIZE_OFF_T@ DEFINE_SIZE_T = @DEFINE_SIZE_T@ DEFINE_SIZE_VOID_P = @DEFINE_SIZE_VOID_P@ DEFINE_UINT64 = @DEFINE_UINT64@ DEFINE_UINT8 = @DEFINE_UINT8@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_ADD_FLAG = @DL_ADD_FLAG@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTTYPES_H = @INTTYPES_H@ INVISIBILITY_CFLAG = @INVISIBILITY_CFLAG@ LD = @LD@ LDAP_ADD_FLAG = @LDAP_ADD_FLAG@ LDAP_ADD_LDADD = @LDAP_ADD_LDADD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MEMCACHED_CFLAGS = @MEMCACHED_CFLAGS@ MEMCACHED_LDFLAGS = @MEMCACHED_LDFLAGS@ MKDIR_P = @MKDIR_P@ MODULES_CFLAGS = @MODULES_CFLAGS@ MODULES_LIBADD = @MODULES_LIBADD@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_ADD_FLAG = @PCRE_ADD_FLAG@ PCRE_ADD_LDADD = @PCRE_ADD_LDADD@ POSIX_FILE_LOCK = @POSIX_FILE_LOCK@ POSIX_MAPPED_FILES = @POSIX_MAPPED_FILES@ POSIX_SEMAPHORES = @POSIX_SEMAPHORES@ POSIX_SHARED_MEM = @POSIX_SHARED_MEM@ PTHREADS_RWLOCK = @PTHREADS_RWLOCK@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SYSV_IPC = @SYSV_IPC@ SYS_TYPES_H = @SYS_TYPES_H@ THREADS_LDADD = @THREADS_LDADD@ THREADS_LDFLAGS = @THREADS_LDFLAGS@ USE_COMPAT = @USE_COMPAT@ USE_IPV6 = @USE_IPV6@ USE_REGEX = @USE_REGEX@ VERSION = @VERSION@ VISIBILITY_ATTR = @VISIBILITY_ATTR@ ZLIB_ADD_FLAG = @ZLIB_ADD_FLAG@ ZLIB_ADD_LDADD = @ZLIB_ADD_LDADD@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_bin = @doxygen_bin@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ has_doxygen = @has_doxygen@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ perlccflags = @perlccflags@ perlcore = @perlcore@ perlldflags = @perlldflags@ perllib = @perllib@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ CONFIGDIR = @sysconfdir@ PKGLIBDIR = @pkglibdir@ MODULESDIR = $(pkglibdir)/ SERVICESDIR = $(pkglibdir)/ #CONFIGDIR=$(sysconfdir)/ AM_CFLAGS = -I../include/ AM_LDFLAGS = -rdynamic -rpath @libdir@ @THREADS_LDFLAGS@ LDADD = ../libicapapi.la @THREADS_LDADD@ @DL_ADD_FLAG@ all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list test_allocators$(EXEEXT): $(test_allocators_OBJECTS) $(test_allocators_DEPENDENCIES) $(EXTRA_test_allocators_DEPENDENCIES) @rm -f test_allocators$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_allocators_OBJECTS) $(test_allocators_LDADD) $(LIBS) test_arrays$(EXEEXT): $(test_arrays_OBJECTS) $(test_arrays_DEPENDENCIES) $(EXTRA_test_arrays_DEPENDENCIES) @rm -f test_arrays$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_arrays_OBJECTS) $(test_arrays_LDADD) $(LIBS) test_base64$(EXEEXT): $(test_base64_OBJECTS) $(test_base64_DEPENDENCIES) $(EXTRA_test_base64_DEPENDENCIES) @rm -f test_base64$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_base64_OBJECTS) $(test_base64_LDADD) $(LIBS) test_body$(EXEEXT): $(test_body_OBJECTS) $(test_body_DEPENDENCIES) $(EXTRA_test_body_DEPENDENCIES) @rm -f test_body$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_body_OBJECTS) $(test_body_LDADD) $(LIBS) test_cache$(EXEEXT): $(test_cache_OBJECTS) $(test_cache_DEPENDENCIES) $(EXTRA_test_cache_DEPENDENCIES) @rm -f test_cache$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_cache_OBJECTS) $(test_cache_LDADD) $(LIBS) test_headers$(EXEEXT): $(test_headers_OBJECTS) $(test_headers_DEPENDENCIES) $(EXTRA_test_headers_DEPENDENCIES) @rm -f test_headers$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_headers_OBJECTS) $(test_headers_LDADD) $(LIBS) test_lists$(EXEEXT): $(test_lists_OBJECTS) $(test_lists_DEPENDENCIES) $(EXTRA_test_lists_DEPENDENCIES) @rm -f test_lists$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_lists_OBJECTS) $(test_lists_LDADD) $(LIBS) test_md5$(EXEEXT): $(test_md5_OBJECTS) $(test_md5_DEPENDENCIES) $(EXTRA_test_md5_DEPENDENCIES) @rm -f test_md5$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_md5_OBJECTS) $(test_md5_LDADD) $(LIBS) test_ops$(EXEEXT): $(test_ops_OBJECTS) $(test_ops_DEPENDENCIES) $(EXTRA_test_ops_DEPENDENCIES) @rm -f test_ops$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_ops_OBJECTS) $(test_ops_LDADD) $(LIBS) test_tables$(EXEEXT): $(test_tables_OBJECTS) $(test_tables_DEPENDENCIES) $(EXTRA_test_tables_DEPENDENCIES) @rm -f test_tables$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_tables_OBJECTS) $(test_tables_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_allocators.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_arrays.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_base64.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_body.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_cache.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_headers.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_lists.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_md5.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_ops.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_tables.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-libtool clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-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: c_icap-0.4.2/tests/test_cache.c0000664000175000017500000001220412567550777013312 00000000000000#include "common.h" #include #include #include #include "c-icap.h" #include "cache.h" #include "dlib.h" #include "mem.h" #include "module.h" #include "lookup_table.h" #include "proc_mutex.h" #include "ci_threads.h" #include "debug.h" #include "cfg_param.h" int load_module(const char *directive,const char **argv,void *setdata) { CI_DLIB_HANDLE lib; common_module_t *module; if(argv== NULL || argv[0]== NULL) return 0; lib = ci_module_load(argv[0],"./"); if(!lib) { printf("Error opening module :%s\n",argv[0]); return 0; } module = ci_module_sym(lib, "module"); if(!module) { printf("Error opening module %s: can not find symbol module\n",argv[0]); return 0; } if (module->init_module) module->init_module(NULL); if (module->post_init_module) module->post_init_module(NULL); return 1; } void log_errors(void *unused, const char *format, ...) { va_list ap; va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); } char *CACHE_TYPE = NULL; static struct ci_options_entry options[] = { {"-d", "debug_level", &CI_DEBUG_LEVEL, ci_cfg_set_int, "The debug level"}, {"-m", "module", NULL, load_module, "The path of the table"}, {"-c", "cache", &CACHE_TYPE, ci_cfg_set_str, "The type of cache to use"}, {NULL,NULL,NULL,NULL,NULL} }; int mem_init(); int main(int argc,char *argv[]) { int i; struct ci_cache *cache; char *s; const char *str; size_t v_size; ci_cfg_lib_init(); mem_init(); __log_error = (void (*)(void *, const char *,...)) log_errors; /*set c-icap library log function */ if (!ci_args_apply(argc, argv, options)) { ci_args_usage(argv[0], options); exit(-1); } if (!CACHE_TYPE) CACHE_TYPE = "local"; cache = ci_cache_build("test1", CACHE_TYPE, 65536, /*cache_size*/ 2048, /*max_object_size*/ 0, /*ttl*/ &ci_str_ops /*key_ops*/ ); ci_cache_update(cache, "test1", "A test1 val", strlen("A test1 val") + 1, NULL); ci_cache_update(cache, "test2", "A test2 val", strlen("A test2 val") + 1, NULL); ci_cache_update(cache, "test3", "A test 3 val", strlen("A test 3 val") + 1, NULL); ci_cache_update(cache, "test4", "A test 4 val", strlen("A test 4 val") + 1, NULL); if(ci_cache_search(cache,"test2", (void **)&s, NULL, NULL)) { printf("Found : %s\n", s); ci_buffer_free(s); } if(ci_cache_search(cache,"test21", (void **)&s, NULL, NULL)) { printf("Found : %s (correct is NULL!)\n", s); ci_buffer_free(s); } if(ci_cache_search(cache,"test1", (void **)&s, NULL, NULL)) { printf("Found : %s\n", s); ci_buffer_free(s); } if(ci_cache_search(cache,"test4", (void **)&s, NULL, NULL)) { printf("Found : %s\n", s); ci_buffer_free(s); } ci_cache_destroy(cache); cache = ci_cache_build("test2", CACHE_TYPE, 65536, /*cache_size*/ 2048, /*max_object_size*/ 0, /*ttl*/ &ci_str_ops /*key_ops*/ ); ci_str_vector_t *vect_str = ci_str_vector_create(4096); str = ci_str_vector_add(vect_str, "1_val1"); printf("Found 1_val1: %s\n", str); str = ci_str_vector_add(vect_str, "1_val2"); printf("Found 1_val2: %s\n", str); v_size = ci_cache_store_vector_size(vect_str); ci_cache_update(cache, "vect1", vect_str, v_size, &ci_cache_store_vector_val); ci_str_vector_destroy(vect_str); vect_str = ci_str_vector_create(4096); str = ci_str_vector_add(vect_str, "2_val1"); str = ci_str_vector_add(vect_str, "2_val2"); str = ci_str_vector_add(vect_str, "2_val3"); v_size = ci_cache_store_vector_size(vect_str); ci_cache_update(cache, "vect2", vect_str, v_size, &ci_cache_store_vector_val); ci_str_vector_destroy(vect_str); if (ci_cache_search(cache, "vect1", (void **)&vect_str, NULL, &ci_cache_read_vector_val)) { for (i=0; vect_str && vect_str->items[i] != NULL; i++) printf("Vector item %d:%s \n", i, (char *)vect_str->items[i]); ci_str_vector_destroy(vect_str); } if (ci_cache_search(cache, "vect2", (void **)&vect_str, NULL, &ci_cache_read_vector_val)) { for (i=0; vect_str && vect_str->items[i] != NULL; i++) printf("Vector item %d:%s \n", i, (char *)vect_str->items[i]); ci_str_vector_destroy(vect_str); } ci_cache_destroy(cache); cache = ci_cache_build("test3", CACHE_TYPE, 65536, /*cache_size*/ 2048, /*max_object_size*/ 0, /*ttl*/ NULL /*key_ops*/ ); ci_cache_update(cache, "nulkey1", NULL, 0, NULL); ci_cache_update(cache, "nulkey2", NULL, 0, NULL); if(ci_cache_search(cache,"nulkey1", (void **)&s, NULL, NULL)) { printf("Found : %s\n", s); ci_buffer_free(s); } if(ci_cache_search(cache,"nulkey2", (void **)&s, NULL, NULL)) { printf("Found : %s\n", s); ci_buffer_free(s); } ci_cache_destroy(cache); return 0; } c_icap-0.4.2/tests/test_headers.c0000664000175000017500000000320712567550777013665 00000000000000#include "common.h" #include #include #include #include #include #include #include #include "simple_api.h" #include "header.h" #include "debug.h" int main(int argc, char *argv[]) { int i; ci_headers_list_t *headers; headers = ci_headers_create(); ci_headers_add(headers,"HTTP/1.1 200 OK"); ci_headers_add(headers,"Date: Fri, 23 Jul 2004 16:31:39 GMT"); ci_headers_add(headers,"Server: Apache/1.3.28 (Linux/SuSE) PHP/4.3.3 mod_perl/1.28"); ci_headers_add(headers,"Content-Location: index.html.en"); ci_headers_add(headers,"Vary: negotiate,accept-language,accept-charset"); ci_headers_add(headers,"Last-Modified: Wed, 16 Jul 2003 20:40:02 GMT"); ci_headers_add(headers,"ETag: \"760-2485-3f15b822;403fc6e0\""); ci_headers_add(headers,"Accept-Ranges: bytes"); ci_headers_add(headers,"Content-Length: 9349"); ci_headers_add(headers,"Keep-Alive: timeout=15, max=96"); ci_headers_add(headers,"Connection: Keep-Alive"); ci_headers_add(headers,"Content-Type: text/html"); ci_headers_add(headers,"Content-Language: en"); for (i=0; iused; i++) { printf("%d. %s\n", i, headers->headers[i]); } ci_headers_remove(headers,"Content-Language"); ci_headers_remove(headers,"Content-Type"); ci_headers_add(headers,"X-Test-header: a-test-value by me"); printf("\n\nPrint headers 2\n"); for (i=0; iused; i++) { printf("%d. %s\n", i, headers->headers[i]); } ci_headers_pack(headers); printf("\n\nThe Packed headers are:\n%s\n",headers->headers[0]); return 0; } c_icap-0.4.2/tests/test_md5.c0000664000175000017500000000204312567550777012734 00000000000000#include "common.h" #include #include #include #include "md5.h" static void MDPrint(unsigned char digest[16]); static void MDString(char *string); static void MDString(char *string) { ci_MD5_CTX context; unsigned char digest[16]; unsigned int len = strlen(string); ci_MD5Init(&context); ci_MD5Update(&context, (unsigned char *)string, len); ci_MD5Final(digest, &context); printf("MD5 (\"%s\") = ", string); MDPrint(digest); printf("\n"); } static void MDPrint(unsigned char digest[16]) { unsigned int i; for (i = 0; i < 16; i++) printf("%02x", digest[i]); } int main(int argc, char *argv[]) { printf("MD5 test suite:\n"); MDString(""); MDString("a"); MDString("abc"); MDString("message digest"); MDString("abcdefghijklmnopqrstuvwxyz"); MDString("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"); MDString("1234567890123456789012345678901234567890" "1234567890123456789012345678901234567890"); return 0; } c_icap-0.4.2/cache.c0000664000175000017500000004134312567550777011117 00000000000000/* * Copyright (C) 2004-2010 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include #include "debug.h" #include "ci_threads.h" #include "lookup_table.h" #include "array.h" #include "cache.h" #include "registry.h" #include "proc_mutex.h" #include "ci_threads.h" #include time_t ci_internal_time() { return time(NULL); } void ci_cache_type_register(const struct ci_cache_type *type) { ci_registry_add_item("c-icap::ci_cache_type", type->name, type); } static const ci_cache_type_t *ci_cache_type_get(const char *name) { return (const ci_cache_type_t *)ci_registry_get_item("c-icap::ci_cache_type", name); } void ci_cache_destroy(ci_cache_t *cache) { cache->destroy(cache); free(cache); } const void *ci_cache_search(ci_cache_t *cache, const void *key, void **val, void *data, void *(*dup_from_cache)(const void *stored_val, size_t stored_val_size, void *data)) { return cache->search(cache, key, val, data, dup_from_cache); } int ci_cache_update(ci_cache_t *cache, const void *key, const void *val, size_t val_size, void *(*copy_to_cache)(void *buf, const void *val, size_t buf_size)) { return cache->update(cache, key, val, val_size, copy_to_cache); } /*****************************************/ /*Simple local cache implementation */ int ci_local_cache_init(struct ci_cache *cache, const char *name); const void *ci_local_cache_search(struct ci_cache *cache, const void *key, void **val, void *data, void *(*dup_from_cache)(const void *stored_val, size_t stored_val_size, void *data)); int ci_local_cache_update(struct ci_cache *cache, const void *key, const void *val, size_t val_size, void *(*copy_to_cache)(void *buf, const void *val, size_t buf_size)); void ci_local_cache_destroy(struct ci_cache *cache); struct ci_cache_type ci_local_cache = { ci_local_cache_init, ci_local_cache_search, ci_local_cache_update, ci_local_cache_destroy, "local" }; struct ci_cache_entry { unsigned int hash; time_t time; void *key; void *val; int val_size; struct ci_cache_entry *qnext; struct ci_cache_entry *hnext; }; typedef struct common_mutex { int isproc; union { ci_proc_mutex_t proc_mutex; ci_thread_mutex_t thread_mutex; } mtx; } common_mutex_t; struct ci_local_cache_data { struct ci_cache_entry *first_queue_entry; struct ci_cache_entry *last_queue_entry; struct ci_cache_entry **hash_table; unsigned int hash_table_size; ci_mem_allocator_t *allocator; common_mutex_t mtx; }; int common_mutex_init(common_mutex_t *mtx, int proc_mtx) { if(proc_mtx) return 0; mtx->isproc = 0; return ci_thread_mutex_init(&mtx->mtx.thread_mutex); } int common_mutex_destroy(common_mutex_t *mtx) { if(mtx->isproc) return 0; return ci_thread_mutex_destroy(&mtx->mtx.thread_mutex); } int common_mutex_lock(common_mutex_t *mtx) { if(mtx->isproc) return 0; return ci_thread_mutex_lock(&mtx->mtx.thread_mutex); } int common_mutex_unlock(common_mutex_t *mtx) { if(mtx->isproc) return 0; return ci_thread_mutex_unlock(&mtx->mtx.thread_mutex); } int ci_local_cache_init(struct ci_cache *cache, const char *name) { struct ci_local_cache_data *cache_data; int i; unsigned int new_hash_size; ci_mem_allocator_t *allocator; cache_data = malloc(sizeof(struct ci_local_cache_data)); if (!cache_data) return 0; cache->cache_data = cache_data; /*until we are going to create an allocator which can allocate/release from continues memory blocks like those we have in shared memory*/ allocator = ci_create_os_allocator(); if (!allocator) { free(cache_data); return 0; } cache_data->allocator = allocator; cache_data->first_queue_entry = (struct ci_cache_entry *)allocator->alloc(allocator, sizeof(struct ci_cache_entry)); if (!cache_data->first_queue_entry) { ci_mem_allocator_destroy(allocator); free(cache_data); return 0; } cache_data->last_queue_entry = cache_data->first_queue_entry; cache_data->last_queue_entry->hnext=NULL; cache_data->last_queue_entry->qnext = NULL; cache_data->last_queue_entry->key = NULL; cache_data->last_queue_entry->val = NULL; cache_data->last_queue_entry->time = 0; cache_data->last_queue_entry->hash = 0; unsigned int cache_items = cache->mem_size/(cache->max_object_size+sizeof(struct ci_cache_entry)); if (cache_items == 0) { ci_mem_allocator_destroy(allocator); free(cache_data); return 0; } for (i=0; i < cache_items-1; i++) { cache_data->last_queue_entry->qnext=(struct ci_cache_entry *)allocator->alloc(allocator, sizeof(struct ci_cache_entry)); if (!cache_data->last_queue_entry->qnext) { /*we are leaking here the cache->first_queue_entry elements. TODO...*/ ci_mem_allocator_destroy(allocator); return 0; } cache_data->last_queue_entry=cache_data->last_queue_entry->qnext; cache_data->last_queue_entry->hnext=NULL; cache_data->last_queue_entry->qnext = NULL; cache_data->last_queue_entry->key = NULL; cache_data->last_queue_entry->val = NULL; cache_data->last_queue_entry->time = 0; cache_data->last_queue_entry->hash = 0; } new_hash_size = 63; if(cache_items > 63) { while(new_hash_sizehash_table=(struct ci_cache_entry **)allocator->alloc(allocator, (new_hash_size+1)*sizeof(struct ci_cache_entry *)); if (!cache_data->hash_table) { /*we are leaking here the cache->first_queue_entry elements. TODO...*/ ci_mem_allocator_destroy(allocator); free(cache); free(cache_data); return 0; } memset(cache_data->hash_table,0,(new_hash_size+1)*sizeof(struct ci_cache_entry *)); cache_data->hash_table_size = new_hash_size; common_mutex_init(&cache_data->mtx, 0); return 1; } void ci_local_cache_destroy(struct ci_cache *cache) { struct ci_cache_entry *e; struct ci_local_cache_data *cache_data; cache_data = (struct ci_local_cache_data *)cache->cache_data; e = cache_data->first_queue_entry; while(e) { cache_data->first_queue_entry = cache_data->first_queue_entry->qnext; if (e->key) cache->key_ops->free(e->key, cache_data->allocator); if (e->val && e->val_size > 0) cache_data->allocator->free(cache_data->allocator, e->val); cache_data->allocator->free(cache_data->allocator, e); e = cache_data->first_queue_entry; } cache_data->allocator->free(cache_data->allocator, cache_data->hash_table); common_mutex_destroy(&cache_data->mtx); ci_mem_allocator_destroy(cache_data->allocator); free(cache_data); } const void *ci_local_cache_search(struct ci_cache *cache, const void *key, void **val, void *data, void *(*dup_from_cache)(const void *stored_val, size_t stored_val_size, void *data)) { struct ci_cache_entry *e; struct ci_local_cache_data *cache_data; time_t current_time; cache_data = (struct ci_local_cache_data *)cache->cache_data; unsigned int hash=ci_hash_compute(cache_data->hash_table_size, key, cache->key_ops->size(key)); assert(hash <= cache_data->hash_table_size); common_mutex_lock(&cache_data->mtx); e=cache_data->hash_table[hash]; *val = NULL; while(e != NULL) { ci_debug_printf(10," \t\t->>>>Val %s\n",(char *)e->val); ci_debug_printf(10," \t\t->>>>compare %s ~ %s\n",(char *)e->key, (char *)key); if(cache->key_ops->compare(e->key, key) == 0) { current_time = ci_internal_time(); if ((current_time - e->time) > cache->ttl) /*if expired*/ key = NULL; else if (e->val_size) { if (dup_from_cache) *val = dup_from_cache(e->val, e->val_size, data); else { *val = ci_buffer_alloc(e->val_size); memcpy(*val, e->val, e->val_size); } } common_mutex_unlock(&cache_data->mtx); return key; } assert(e != e->hnext); e = e->hnext; } common_mutex_unlock(&cache_data->mtx); return NULL; } int ci_local_cache_update(struct ci_cache *cache, const void *key, const void *val, size_t val_size, void *(*copy_to_cache)(void *buf, const void *val, size_t buf_size)) { struct ci_cache_entry *e,*tmp; int key_size; time_t current_time; struct ci_local_cache_data *cache_data; unsigned int hash; cache_data = (struct ci_local_cache_data *)cache->cache_data; hash = ci_hash_compute(cache_data->hash_table_size, key, cache->key_ops->size(key)); assert(hash <= cache_data->hash_table_size); ci_debug_printf(10,"Adding :%s:%p\n",(char *)key, (char *)val); current_time = ci_internal_time(); common_mutex_lock(&cache_data->mtx); /*Get the oldest entry*/ e=cache_data->first_queue_entry; /*if the oldest entry does not expired do not store tke key/value pair*/ if((current_time - e->time)< cache->ttl) { ci_debug_printf(6, "ci_cache_update: not available slot (%d-%d %d).\n", (unsigned int) current_time, (unsigned int) e->time, (unsigned int) cache->ttl ); common_mutex_unlock(&cache_data->mtx); return 0; } /*If it has data release its data*/ if (e->key) { cache->key_ops->free(e->key, cache_data->allocator); e->key = NULL; } if (e->val && e->val_size > 0) { cache_data->allocator->free(cache_data->allocator, e->val); e->val = NULL; } /*If it is in the hash table remove it...*/ { assert(e->hash <= cache_data->hash_table_size); tmp = cache_data->hash_table[e->hash]; if(tmp == e) cache_data->hash_table[e->hash] = tmp->hnext; else if(tmp) { while(tmp->hnext != NULL && e != tmp->hnext) tmp = tmp->hnext; if(tmp->hnext) tmp->hnext = tmp->hnext->hnext; } } e->hnext = NULL; e->time = 0; e->hash = 0; /*I should implement a ci_type_ops::clone method. Maybe the memcpy is not enough....*/ key_size = cache->key_ops->size(key); e->key = cache_data->allocator->alloc(cache_data->allocator, key_size); if(!e->key) { common_mutex_unlock(&cache_data->mtx); ci_debug_printf(6, "ci_cache_update: failed to allocate memory for key.\n"); return 0; } memcpy(e->key, key, key_size); if (val != NULL && val_size > 0) { e->val = cache_data->allocator->alloc(cache_data->allocator, val_size); e->val_size = val_size; if (e->val) { if (copy_to_cache) { if (!copy_to_cache(e->val, val, e->val_size)) { cache_data->allocator->free(cache_data->allocator, e->val); e->val = NULL; } } else memcpy(e->val, val, e->val_size); } if(!e->val) { cache_data->allocator->free(cache_data->allocator, e->key); e->key = NULL; common_mutex_unlock(&cache_data->mtx); ci_debug_printf(6, "ci_cache_update: failed to allocate memory for cache data.\n"); return 0; } } else { e->val = NULL; e->val_size = 0; } e->hash = hash; e->time = current_time; cache_data->first_queue_entry = cache_data->first_queue_entry->qnext; /*Make it the newest entry (make it last entry in queue)*/ cache_data->last_queue_entry->qnext = e; cache_data->last_queue_entry = e; e->qnext = NULL; if(cache_data->hash_table[hash]) ci_debug_printf(10,"\t\t:::Found %s\n", (char *)cache_data->hash_table[hash]->val); /*Make it the first entry in the current hash entry*/ e->hnext=cache_data->hash_table[hash]; cache_data->hash_table[hash] = e; common_mutex_unlock(&cache_data->mtx); return 1; } struct ci_cache *ci_cache_build( const char *name, const char *cache_type, unsigned int cache_size, unsigned int max_object_size, int ttl, const ci_type_ops_t *key_ops ) { struct ci_cache *cache; const ci_cache_type_t *type; if (cache_size <= 0) return NULL; type = ci_cache_type_get(cache_type); if (type == NULL) { type = &ci_local_cache; if (strcasecmp(cache_type, ci_local_cache.name) != 0) ci_debug_printf(1, "WARNING: Cache type '%s' not found. Creating a local cache\n", cache_type); } cache = malloc(sizeof(struct ci_cache)); if (!cache) { return NULL; } if (key_ops != NULL) cache->key_ops = key_ops; else cache->key_ops = &ci_str_ops; cache->mem_size = cache_size; cache->max_object_size = max_object_size; cache->ttl = ttl; cache->init = type->init; cache->destroy = type->destroy; cache->search = type->search; cache->update = type->update; cache->_cache_type = type; if (!cache->init(cache, name)) { free(cache); return NULL; } return cache; } size_t ci_cache_store_vector_size(ci_vector_t *v) { int vector_data_size, vector_indx_size; void *vector_data_start; void *vector_data_end; if (!v) return 0; /*The vector data stored in a continue memory block which filled from bottom to up. So the last elements stored at the beggining of the memory block. */ vector_data_start = (void *)(v->items[v->count -1]); vector_data_end = v->mem +v->max_size; /*Assert that the vector stored in one memory block (eg it is not a ci_ptr_vector_t object)*/ assert(vector_data_start < vector_data_end && vector_data_start > (void *)v->mem); /*compute the required memory for storing the vector*/ vector_data_size = vector_data_end - vector_data_start; vector_indx_size = (v->count+1) * sizeof(void *); return sizeof(size_t) + vector_indx_size + vector_data_size ; } void *ci_cache_store_vector_val(void *buf, const void *val, size_t buf_size) { int vector_data_size, vector_indx_size, i; const void *vector_data_start; const void *vector_data_end; void *data, **data_indx; ci_vector_t *v = (ci_vector_t *)val; if (!val || !buf) /*Maybe look for error?*/ return NULL; /*The vector data stored in a continue memory block which filled from bottom to up. So the last elements stored at the beggining of the memory block. */ vector_data_start = (void *)(v->items[v->count -1]); vector_data_end = v->mem +v->max_size; /*Assert that the vector stored in one memory block (eg it is not a ci_ptr_vector_t object)*/ assert(vector_data_start < vector_data_end && vector_data_start > (void *)v->mem); /*compute the required memory for storing the vector*/ vector_data_size = vector_data_end - vector_data_start; vector_indx_size = (v->count+1) * sizeof(void *); assert(buf_size >= sizeof(size_t) + vector_indx_size + vector_data_size); data = buf; /*store the size of vector*/ memcpy(data, &(v->max_size), sizeof(size_t)); data_indx = data + sizeof(size_t); memcpy((void *)data_indx+vector_indx_size, vector_data_start, vector_data_size); /*Store the relative position of the vector item to the index part*/ for(i = 0; v->items[i]!= NULL; i++) data_indx[i] = (void *)(v->items[i] - vector_data_start + vector_indx_size); data_indx[i] = NULL; return data; } void *ci_cache_read_vector_val(const void *val, size_t val_size, void *o) { size_t vector_size, item_size; int i; ci_vector_t *v; const void **data_indx; if (!val) return NULL; data_indx = (const void **)(val + sizeof(size_t)); vector_size = *((size_t *)val); v= ci_vector_create(vector_size); /*The items stores from bottom to top. Compute the size of first item, which stored at the end of *val*/ item_size = val_size - sizeof(size_t) - (size_t)data_indx[0]; for(i=0; data_indx[i] != NULL; i++) { ci_vector_add(v, (const void *)((const void *)data_indx+(size_t)data_indx[i]), item_size); /*compute the item size of the next item*/ item_size = data_indx[i] - data_indx[i+1]; } return v; } c_icap-0.4.2/include/0000775000175000017500000000000012601747560011371 500000000000000c_icap-0.4.2/include/ci_regex.h0000664000175000017500000000323112567550776013262 00000000000000/* * Copyright (C) 2014 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __CI_REGEX_H #define __CI_REGEX_H #include "c-icap.h" #ifdef __cplusplus extern "C" { #endif typedef void * ci_regex_t; struct ci_regex_match { size_t s; size_t e; }; typedef struct ci_regex_match ci_regex_matches_t[10]; typedef struct ci_regex_replace_part { const void *user_data; ci_regex_matches_t matches; } ci_regex_replace_part_t; #define ci_regex_create_match_list() ci_list_create(32768, sizeof(ci_regex_replace_part_t)) CI_DECLARE_FUNC(char *) ci_regex_parse(const char *str, int *flags, int *recursive); CI_DECLARE_FUNC(ci_regex_t) ci_regex_build(const char *regex_str, int regex_flags); CI_DECLARE_FUNC(void) ci_regex_free(ci_regex_t regex); CI_DECLARE_FUNC(int) ci_regex_apply(const ci_regex_t regex, const char *str, int len, int recurs, ci_list_t *matches, const void *user_data); #ifdef __cplusplus } #endif #endif /*__CI_REGEX_H*/ c_icap-0.4.2/include/commands.h0000664000175000017500000000537712567550776013313 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __COMMANDS_H #define __COMMANDS_H #include "c-icap.h" #ifdef __cplusplus extern "C" { #endif #define COMMANDS_BUFFER_SIZE 128 #define NULL_CMD 0 #define MONITOR_PROC_CMD 1 #define CHILDS_PROC_CMD 2 #define MONITOR_PROC_POST_CMD 4 #define ALL_PROC_CMD 7 #define CHILD_START_CMD 8 #define CHILD_STOP_CMD 16 #define ONDEMAND_CMD 32 #define CMD_NM_SIZE 128 typedef struct ci_command{ char name[CMD_NM_SIZE]; int type; void *data; union { void (*command_action)(const char *name, int type,const char **argv); void (*command_action_extend)(const char *name, int type, void *data); }; } ci_command_t; /* Backward compatible function for ci_command_register_ctl */ CI_DECLARE_FUNC(void) register_command(const char *name, int type, void (*command_action)(const char *name,int type, const char **argv)); /* backward compatible function for ci_command_register_action */ CI_DECLARE_FUNC(void) register_command_extend(const char *name, int type, void *data, void (*command_action) (const char *name, int type, void *data)); CI_DECLARE_FUNC(void) ci_command_register_ctl_cmd(const char *name, int type, void (*command_action)(const char *name,int type, const char **argv)); CI_DECLARE_FUNC(void) ci_command_register_action(const char *name, int type, void *data, void (*command_action) (const char *name, int type, void *data)); CI_DECLARE_FUNC(void) ci_command_schedule_on(const char *name, void *data, time_t time); CI_DECLARE_FUNC(void) ci_command_schedule(const char *name, void *data, time_t afterSecs); void commands_init(); void commands_reset(); int execute_command(ci_command_t *command, char *cmdline, int exec_type); ci_command_t *find_command(const char *cmd_line); int commands_execute_start_child(); int commands_execute_stop_child(); #ifdef __cplusplus } #endif #endif /*__COMMANDS_H*/ c_icap-0.4.2/include/request.h0000664000175000017500000001524712567550777013200 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef _REQUEST_H #define _REQUEST_H #include "header.h" #include "service.h" #include "net_io.h" #include "array.h" #ifdef __cplusplus extern "C" { #endif /** \defgroup REQUEST ICAP request API \ingroup API * ICAP request related API. */ //enum REQUEST_STATUS { WAIT,SERVED }; enum GETDATA_STATUS {GET_NOTHING=0,GET_HEADERS,GET_PREVIEW,GET_BODY,GET_EOF}; enum SENDDATA_STATUS {SEND_NOTHING=0, SEND_RESPHEAD, SEND_HEAD1, SEND_HEAD2, SEND_HEAD3, SEND_BODY, SEND_EOF }; /*enum BODY_RESPONCE_STATUS{ CHUNK_DEF=1,CHUNK_BODY,CHUNK_END};*/ #define CI_NO_STATUS 0 #define CI_OK 1 #define CI_NEEDS_MORE 2 #define CI_ERROR -1 #define CI_EOF -2 #define EXTRA_CHUNK_SIZE 30 #define MAX_CHUNK_SIZE 4064 /*4096 -EXTRA_CHUNK_SIZE-2*/ #define MAX_USERNAME_LEN 255 typedef struct ci_buf{ char *buf; int size; int used; } ci_buf_t; struct ci_service_module; /** \typedef ci_request_t \ingroup REQUEST * This is the struct which holds all the data which represent an ICAP request. The * developers should not access directly the fields of this struct but better use * the documented macros and functions */ typedef struct ci_request{ ci_connection_t *connection; int packed; int type; char req_server[CI_MAXHOSTNAMELEN+1]; int access_type; char user[MAX_USERNAME_LEN+1]; char service[MAX_SERVICE_NAME+1]; char args[MAX_SERVICE_ARGS]; int preview; int keepalive; int allow204; int hasbody; int responce_hasbody; struct ci_buf preview_data; struct ci_service_module *current_service_mod; ci_headers_list_t *request_header; ci_headers_list_t *response_header; ci_encaps_entity_t *entities[5];//At most 3 and 1 for termination..... ci_encaps_entity_t *trash_entities[7]; ci_headers_list_t *xheaders; void *service_data; char rbuf[BUFSIZE]; char wbuf[MAX_CHUNK_SIZE+EXTRA_CHUNK_SIZE+2]; int eof_received; int data_locked; char *pstrblock_read; int pstrblock_read_len; unsigned int current_chunk_len; unsigned int chunk_bytes_read; unsigned int write_to_module_pending; int status; int return_code; char *pstrblock_responce; int remain_send_block_bytes; /*Caching values for various subsystems*/ int preview_data_type; int auth_required; /*log string*/ char *log_str; ci_str_array_t *attributes; /* statistics */ uint64_t bytes_in; /*May include bytes from next pipelined request*/ uint64_t bytes_out; uint64_t request_bytes_in; /*Current request input bytes*/ uint64_t http_bytes_in; uint64_t http_bytes_out; uint64_t body_bytes_in; uint64_t body_bytes_out; /* added flags/variables*/ int allow206; int64_t i206_use_original_body; ci_ip_t xclient_ip; } ci_request_t; #define lock_data(req) (req->data_locked=1) #define unlock_data(req) (req->data_locked=0) /*This functions needed in server (mpmt_server.c ) */ ci_request_t *newrequest(ci_connection_t *connection); int recycle_request(ci_request_t *req,ci_connection_t *connection); int keepalive_request(ci_request_t *req); int process_request(ci_request_t *); /*Functions used in both server and icap-client library*/ CI_DECLARE_FUNC(int) parse_chunk_data(ci_request_t *req, char **wdata); CI_DECLARE_FUNC(int) net_data_read(ci_request_t *req); CI_DECLARE_FUNC(int) process_encapsulated(ci_request_t *req, const char *buf); /*********************************************/ /*Buffer functions (I do not know if they must included in ci library....) */ CI_DECLARE_FUNC(void) ci_buf_init(struct ci_buf *buf); CI_DECLARE_FUNC(void) ci_buf_reset(struct ci_buf *buf); CI_DECLARE_FUNC(int) ci_buf_mem_alloc(struct ci_buf *buf,int size); CI_DECLARE_FUNC(void) ci_buf_mem_free(struct ci_buf *buf); CI_DECLARE_FUNC(int) ci_buf_write(struct ci_buf *buf,char *data,int len); CI_DECLARE_FUNC(int) ci_buf_reset_size(struct ci_buf *buf,int req_size); /***************/ /*API defines */ #define ci_service_data(req) ((req)->service_data) #define ci_allow204(req) ((req)->allow204) #define ci_allow206(req) ((req)->allow206) /*API functions ......*/ CI_DECLARE_FUNC(ci_request_t *) ci_request_alloc(ci_connection_t *connection); CI_DECLARE_FUNC(void) ci_request_reset(ci_request_t *req); CI_DECLARE_FUNC(void) ci_request_destroy(ci_request_t *req); CI_DECLARE_FUNC(void) ci_request_pack(ci_request_t *req); CI_DECLARE_FUNC(void) ci_response_pack(ci_request_t *req); CI_DECLARE_FUNC(ci_encaps_entity_t *) ci_request_alloc_entity(ci_request_t *req,int type,int val); CI_DECLARE_FUNC(int) ci_request_release_entity(ci_request_t *req,int pos); CI_DECLARE_FUNC(char *) ci_request_set_log_str(ci_request_t *req, char *logstr); CI_DECLARE_FUNC(int) ci_request_set_str_attribute(ci_request_t *req, const char *name, const char *value); CI_DECLARE_FUNC(int) ci_request_206_origin_body(ci_request_t *req, uint64_t offset); /*ICAP client api*/ CI_DECLARE_FUNC(ci_request_t *) ci_client_request(ci_connection_t *conn,char *server,char *service); CI_DECLARE_FUNC(void) ci_client_request_reuse(ci_request_t *req); CI_DECLARE_FUNC(int) ci_client_get_server_options(ci_request_t *req,int timeout); CI_DECLARE_FUNC(ci_connection_t *) ci_client_connect_to(char *servername,int port,int proto); CI_DECLARE_FUNC(int) ci_client_icapfilter(ci_request_t *req, int timeout, ci_headers_list_t *req_headers, ci_headers_list_t *resp_headers, void *data_source, int (*source_read)(void *,char *,int), void *data_dest, int (*dest_write) (void *,char *,int)); CI_DECLARE_FUNC(int) ci_client_http_headers_completed(ci_request_t * req); #ifdef __CI_COMPAT #define request_t ci_request_t #endif #ifdef __cplusplus } #endif #endif c_icap-0.4.2/include/net_io.h0000664000175000017500000001241012567550777012752 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __NET_IO_H #define __NET_IO_H #ifndef _WIN32 #include #include #include #include #include #include #include #include #else #include #endif #ifdef __cplusplus extern "C" { #endif #ifndef _WIN32 #define ci_socket int #define CI_SOCKET_ERROR -1 #else #define ci_socket SOCKET #define CI_SOCKET_ERROR INVALID_SOCKET #endif typedef struct ci_sockaddr{ #ifdef USE_IPV6 struct sockaddr_storage sockaddr; #else struct sockaddr_in sockaddr; #endif int ci_sin_family;/* #define ci_sin_family sockaddr.sin_family */ int ci_sin_port; /* #define ci_sin_port sockaddr.sin_port */ void *ci_sin_addr; int ci_inaddr_len; } ci_sockaddr_t; #define CI_MAXHOSTNAMELEN 256 #ifdef USE_IPV6 typedef union ci_inaddr { struct in_addr ipv4_addr; struct in6_addr ipv6_addr; } ci_in_addr_t; #define ci_inaddr_zero(addr) (memset(&(addr),0,sizeof(ci_in_addr_t))) #define ci_inaddr_copy(dest,src) (memcpy(&(dest),&(src),sizeof(ci_in_addr_t))) #define ci_ipv4_inaddr_hostnetmask(addr)((addr).ipv4_addr.s_addr=htonl(0xFFFFFFFF)) #define ci_in6_addr_u32(addr) ((uint32_t *)&((addr).ipv6_addr)) #define ci_ipv6_inaddr_hostnetmask(addr)(ci_in6_addr_u32(addr)[0]=htonl(0xFFFFFFFF),\ ci_in6_addr_u32(addr)[1]=htonl(0xFFFFFFFF), \ ci_in6_addr_u32(addr)[2]=htonl(0xFFFFFFFF), \ ci_in6_addr_u32(addr)[3]=htonl(0xFFFFFFFF)) #define CI_IPLEN 46 #define CI_SOCKADDR_SIZE sizeof(struct sockaddr_storage) #else /*IPV4 only*/ typedef struct in_addr ci_in_addr_t; #define ci_inaddr_zero(addr) ((addr).s_addr=0) #define ci_inaddr_copy(dest,src) ((dest)=(src)) #define ci_ipv4_inaddr_hostnetmask(addr)((addr).s_addr=htonl(0xFFFFFFFF)) #define CI_IPLEN 16 #define CI_SOCKADDR_SIZE sizeof(struct sockaddr_in) #endif #define wait_for_read 0x1 #define wait_for_write 0x2 #define wait_for_readwrite 0x3 typedef struct ci_ip { ci_in_addr_t address; ci_in_addr_t netmask; int family; } ci_ip_t; typedef struct ci_connection{ ci_socket fd; ci_sockaddr_t claddr; ci_sockaddr_t srvaddr; } ci_connection_t ; CI_DECLARE_FUNC(void) ci_connection_destroy(ci_connection_t *connection); CI_DECLARE_FUNC(void) ci_fill_sockaddr(ci_sockaddr_t *addr); CI_DECLARE_FUNC(void) ci_fill_ip_t(ci_ip_t *ip, ci_sockaddr_t *addr); CI_DECLARE_FUNC(void) ci_copy_sockaddr(ci_sockaddr_t *dest, ci_sockaddr_t *src); CI_DECLARE_FUNC(int) ci_inet_aton(int af,const char *cp, void *inp); CI_DECLARE_FUNC(const char *) ci_inet_ntoa(int af,const void *src, char *dst,int cnt); CI_DECLARE_FUNC(const char *) ci_sockaddr_t_to_ip(ci_sockaddr_t *addr, char *ip,int ip_strlen); #define ci_conn_remote_ip(conn,ip) ci_sockaddr_t_to_ip(&(conn->claddr),ip,CI_IPLEN) #define ci_conn_local_ip(conn,ip) ci_sockaddr_t_to_ip(&(conn->srvaddr),ip,CI_IPLEN) #ifdef USE_IPV6 CI_DECLARE_FUNC(void) ci_sockaddr_set_port(ci_sockaddr_t *addr, int port); #define ci_sockaddr_set_family(addr,family) ((addr).sockaddr.ss_family=family) #else CI_DECLARE_FUNC(void) ci_sockaddr_set_port(ci_sockaddr_t *addr, int port); #define ci_sockaddr_set_family(addr,family) ((addr).sockaddr.sin_family=family/*,(addr).ci_sin_family=family*/) #endif CI_DECLARE_FUNC(const char *) ci_sockaddr_t_to_host(ci_sockaddr_t *addr, char *hname, int maxhostlen); CI_DECLARE_FUNC(int) ci_host_to_sockaddr_t(const char *servername, ci_sockaddr_t * addr, int proto); CI_DECLARE_FUNC(void) ci_copy_connection(ci_connection_t *dest, ci_connection_t *src); CI_DECLARE_FUNC(int) icap_socket_opts(ci_socket fd, int secs_to_linger); CI_DECLARE_FUNC(ci_socket) icap_init_server(char *address, int port,int *protocol_family,int secs_to_linger); CI_DECLARE_FUNC(int) ci_wait_for_data(ci_socket fd,int secs,int what_wait); #define ci_wait_for_incomming_data(fd,timeout) ci_wait_for_data(fd,timeout,wait_for_read) #define ci_wait_for_outgoing_data(fd,timeout) ci_wait_for_data(fd,timeout,wait_for_write) CI_DECLARE_FUNC(int) ci_netio_init(ci_socket fd); CI_DECLARE_FUNC(int) ci_read(ci_socket fd,void *buf,size_t count,int timeout); CI_DECLARE_FUNC(int) ci_write(ci_socket fd, const void *buf,size_t count,int timeout); CI_DECLARE_FUNC(int) ci_read_nonblock(ci_socket fd, void *buf,size_t count); CI_DECLARE_FUNC(int) ci_write_nonblock(ci_socket fd, const void *buf,size_t count); CI_DECLARE_FUNC(int) ci_linger_close(ci_socket fd,int secs_to_linger); CI_DECLARE_FUNC(int) ci_hard_close(ci_socket fd); #ifdef __cplusplus } #endif #endif c_icap-0.4.2/include/ci_threads.h0000664000175000017500000001010212567550776013575 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __CI_THREADS_H #define __CI_THREADS_H #include "c-icap.h" #ifdef __cplusplus extern "C" { #endif #ifndef _WIN32 #include #define ci_thread_mutex_t pthread_mutex_t #define ci_thread_cond_t pthread_cond_t #define ci_thread_t pthread_t CI_DECLARE_FUNC(int) ci_thread_mutex_init(ci_thread_mutex_t *pmutex); CI_DECLARE_FUNC(int) ci_thread_mutex_destroy(ci_thread_mutex_t *pmutex); #define ci_thread_mutex_lock(pmutex) pthread_mutex_lock(pmutex) #define ci_thread_mutex_unlock(pmutex) pthread_mutex_unlock(pmutex) #define ci_thread_self pthread_self #ifdef USE_PTHREADS_RWLOCK #define ci_thread_rwlock_t pthread_rwlock_t CI_DECLARE_FUNC(int) ci_thread_rwlock_init(ci_thread_rwlock_t *); CI_DECLARE_FUNC(int) ci_thread_rwlock_destroy(ci_thread_rwlock_t *); #define ci_thread_rwlock_rdlock(rwlock) pthread_rwlock_rdlock(rwlock) #define ci_thread_rwlock_wrlock(rwlock) pthread_rwlock_wrlock(rwlock) #define ci_thread_rwlock_unlock(rwlock) pthread_rwlock_unlock(rwlock) #else #define ci_thread_rwlock_t pthread_mutex_t CI_DECLARE_FUNC(int) ci_thread_rwlock_init(ci_thread_rwlock_t *); CI_DECLARE_FUNC(int) ci_thread_rwlock_destroy(ci_thread_rwlock_t *); CI_DECLARE_FUNC(int) ci_thread_rwlock_rdlock(ci_thread_rwlock_t *); CI_DECLARE_FUNC(int) ci_thread_rwlock_wrlock(ci_thread_rwlock_t *); CI_DECLARE_FUNC(int) ci_thread_rwlock_unlock(ci_thread_rwlock_t *); #endif CI_DECLARE_FUNC(int) ci_thread_cond_init(ci_thread_cond_t *pcond); CI_DECLARE_FUNC(int) ci_thread_cond_destroy(ci_thread_cond_t *pcond); #define ci_thread_cond_wait(pcond,pmutex) pthread_cond_wait(pcond,pmutex) #define ci_thread_cond_broadcast(pcond) pthread_cond_broadcast(pcond) #define ci_thread_cond_signal(pcond) pthread_cond_signal(pcond) CI_DECLARE_FUNC(int) ci_thread_create(ci_thread_t *pthread_id, void *(*pfunc)(void *), void *parg); CI_DECLARE_FUNC(int) ci_thread_join(ci_thread_t thread_id); #else /*ifdef _WIN32*/ #include #define ci_thread_mutex_t CRITICAL_SECTION #define ci_thread_rwlock_t CRITICAL_SECTION #define ci_thread_cond_t HANDLE #define ci_thread_t DWORD CI_DECLARE_FUNC(int) ci_thread_mutex_init(ci_thread_mutex_t *pmutex); CI_DECLARE_FUNC(int) ci_thread_mutex_destroy(ci_thread_mutex_t *pmutex); CI_DECLARE_FUNC(int) ci_thread_mutex_lock(ci_thread_mutex_t *pmutex); CI_DECLARE_FUNC(int) ci_thread_mutex_unlock(ci_thread_mutex_t *pmutex); CI_DECLARE_FUNC(int) ci_thread_rwlock_init(ci_thread_rwlock_t *); CI_DECLARE_FUNC(int) ci_thread_rwlock_destroy(ci_thread_rwlock_t *); CI_DECLARE_FUNC(int) ci_thread_rwlock_rdlock(ci_thread_rwlock_t *); CI_DECLARE_FUNC(int) ci_thread_rwlock_wrlock(ci_thread_rwlock_t *); CI_DECLARE_FUNC(int) ci_thread_rwlock_unlock(ci_thread_rwlock_t *); CI_DECLARE_FUNC(int) ci_thread_cond_init(ci_thread_cond_t *pcond); CI_DECLARE_FUNC(int) ci_thread_cond_destroy(ci_thread_cond_t *pcond); CI_DECLARE_FUNC(int) ci_thread_cond_wait(ci_thread_cond_t *pcond,ci_thread_mutex_t *pmutex); CI_DECLARE_FUNC(int) ci_thread_cond_broadcast(ci_thread_cond_t *pcond); CI_DECLARE_FUNC(int) ci_thread_cond_signal(ci_thread_cond_t *pcond); CI_DECLARE_FUNC(int) ci_thread_create(ci_thread_t *thread_id, void *(*pfunc)(void *), void *parg); CI_DECLARE_FUNC(int) ci_thread_join(ci_thread_t thread_id); #endif #ifdef __cplusplus } #endif #endif /*__CI_THREADS_H */ c_icap-0.4.2/include/cache.h0000664000175000017500000001240412567550777012543 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __CACHE_H #define __CACHE_H #include "hash.h" #ifdef __cplusplus extern "C" { #endif /** \defgroup CACHE cache api \ingroup API \brief Macros, functions and structures used to implement and use c-icap cache. */ struct ci_cache; /** \ingroup CACHE \brief A struct which implements a cache type. * Modules implement a cache type, needs to implement members of this structure. */ typedef struct ci_cache_type { int (*init)(struct ci_cache *cache, const char *name); const void *(*search)(struct ci_cache *cache, const void *key, void **val, void *data, void *(*dup_from_cache)(const void *stored_val, size_t stored_val_size, void *data)); int (*update)(struct ci_cache *cache, const void *key, const void *val, size_t val_size, void *(*copy_to_cache)(void *cache_buf, const void *val, size_t cache_buf_size)); void (*destroy)(struct ci_cache *cache); const char *name; } ci_cache_type_t; /** * Register a cache type to c-icap server. \ingroup CACHE */ CI_DECLARE_FUNC(void) ci_cache_type_register(const struct ci_cache_type *type); /** * The ci_cache_t struct \ingroup CACHE */ typedef struct ci_cache{ int (*init)(struct ci_cache *cache, const char *name); // If dup_from_cache is NULL return a ci_buffer object const void * (*search)(struct ci_cache *cache, const void *key, void **val, void *data, void *(*dup_from_cache)(const void *stored_val, size_t stored_val_size, void *data)); // buf is of size val_size and buf_size==val_size int (*update)(struct ci_cache *cache, const void *key, const void *val, size_t val_size, void *(*copy_to_cache)(void *buf, const void *val, size_t buf_size)); void (*destroy)(struct ci_cache *cache); time_t ttl; unsigned int mem_size; unsigned int max_object_size; unsigned int flags; const ci_type_ops_t *key_ops; const ci_cache_type_t *_cache_type; void *cache_data; } ci_cache_t; /** * Builds a cache and return a pointer to the ci_cache_t object \ingroup CACHE \param cache_type The cache type to use. If the cache type not found return a cache object of type "local" \param cache_size The size of the cache \param max_object_size The maximum object size to store in cache \param ttl The ttl value for cached items in this cache \param key_ops If not null, the ci_types_ops_t object to use for comparing keys. By default keys are considered as c strings. */ CI_DECLARE_FUNC(ci_cache_t *) ci_cache_build( const char *name, const char *cache_type, unsigned int cache_size, unsigned int max_object_size, int ttl, const ci_type_ops_t *key_ops ); /** * Searchs a cache for a stored object * If the dup_from_cache parameter is NULL, the returned value must be * released using the ci_buffer_free function. \ingroup CACHE \param cache Pointer to the ci_cache_t object \param key Pointer to the key to search for \param val Pointer to store the pointer of returned value \param data Pointer to void object which will be passed to dup_from_cache function \param dup_from_cache Pointer to function which will be used to allocate memory and copy the stored value. */ CI_DECLARE_FUNC(const void *) ci_cache_search(ci_cache_t *cache, const void *key, void **val, void *data, void *(*dup_from_cache)(const void *stored_val, size_t stored_val_size, void *data)); /** * Stores an object to cache \ingroup CACHE \param cache Pointer to the ci_cache_t object \param key The key of the stored object \param val Pointer to the object to be stored \param val_size The size of the object to be stored \param copy_to_cache The function to use to copy object to cache. If it is NULL the memcpy is used. */ CI_DECLARE_FUNC(int) ci_cache_update(ci_cache_t *cache, const void *key, const void *val, size_t val_size, void *(*copy_to_cache)(void *buf, const void *val, size_t buf_size)); /** * Destroy a cache_t object \ingroup CACHE */ CI_DECLARE_FUNC(void) ci_cache_destroy(ci_cache_t *cache); /* Only for internal use only: cb functions to store/retrieve vectors from cache.... */ CI_DECLARE_FUNC(size_t) ci_cache_store_vector_size(ci_vector_t *v); CI_DECLARE_FUNC(void *) ci_cache_store_vector_val(void *buf, const void *val, size_t buf_size); CI_DECLARE_FUNC(void *) ci_cache_read_vector_val(const void *val, size_t val_size, void *); #ifdef __cplusplus } #endif #endif c_icap-0.4.2/include/md5.h0000664000175000017500000000073612567550776012171 00000000000000#ifndef CI_MD5_H #define CI_MD5_H #include "c-icap.h" struct ci_MD5Context { uint32_t buf[4]; uint32_t bits[2]; unsigned char in[64]; }; typedef struct ci_MD5Context ci_MD5_CTX; CI_DECLARE_FUNC(void) ci_MD5Init(struct ci_MD5Context *ctx); CI_DECLARE_FUNC(void) ci_MD5Update(struct ci_MD5Context *ctx, const unsigned char *buf, size_t len); CI_DECLARE_FUNC(void) ci_MD5Final(unsigned char digest[16], struct ci_MD5Context *ctx); #endif /* !CI_MD5_H */ c_icap-0.4.2/include/c-icap-conf.h0000664000175000017500000000436112601747555013551 00000000000000/*This is autogenerated file*/ #ifndef __C_ICAP_CONF_H #define __C_ICAP_CONF_H /*C_ICAP VERSION*/ #define C_ICAP_HEX_VERSION 0x000000040002 /* Define USE_IPV6 if we are supporting ipv6 */ #if 1 #define USE_IPV6 #endif #if 1 #define USE_SYSV_IPC #endif #if 1 #define USE_POSIX_MAPPED_FILES #endif #if 1 #define USE_POSIX_SHARED_MEM #endif #if 1 # define USE_SYSV_IPC_MUTEX #endif #if 1 # define USE_POSIX_FILE_LOCK #endif #if 1 # define USE_POSIX_SEMAPHORES #endif #if 1 #define USE_PTHREADS_RWLOCK #endif #if 1 #define USE_REGEX #endif #if 0 #define __CI_COMPAT #endif /*The following maybe should used...*/ #if 1 #define __SYS_TYPES_H_EXISTS #endif #if 1 #define __INTTYPES_H_EXISTS #endif /* The 64 bit data models as described by wikipedia are: Data model short int long long long pointers/size_t LLP64 16 32 32 64 64 LP64 16 32 64 64 64 ILP64 16 64 64 64 64 SILP64 64 64 64 64 64 On most 32bit and 64bit unix machines, 'short' is always 16bit, 'int' is 32bit long is 32bit or 64bit respectively and long long is always 64bit. We are going to define: off_t as long on 32bit machines and long long on 64bit (sizeof(void*)==8) size_t as long on 32bit machines and long long on 64bit The c-icap should not use int32_t/uint32_t/int16_t/uint16_t types */ #define CI_SIZEOF_VOID_P 8 /* typedef off_t if does not define. */ #if 0 #if CI_SIZEOF_VOID_P == 8 typedef long long off_t; #define CI_SIZEOF_OFF_T 8 #elif CI_SIZEOF_VOID_P == 4 typedef long off_t; #define CI_SIZEOF_OFF_T 4 #else #error "Unhandled size of void *" #endif #else /*if 0*/ #define CI_SIZEOF_OFF_T 8 #endif /* typedef size_t if does not define. */ #if 0 #if SIZEOF_VOID_P == 8 typedef unsigned long long size_t; #elif SIZEOF_VOID_P == 4 typedef unsigned int size_t; #else #error "Unhandled size of void *" #endif #endif #if 0 typedef unsigned char uint8_t; #endif #if 0 typedef char int8_t; #endif #if 0 typedef unsigned long long uint64_t; #endif #if 0 typedef long long int64_t; #endif #if 1 #define USE_VISIBILITY_ATTRIBUTE #endif #endif c_icap-0.4.2/include/proc_mutex.h0000664000175000017500000000505112567550776013664 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __PROC_MUTEX_H #define __PROC_MUTEX_H #include "c-icap.h" #if defined (USE_SYSV_IPC_MUTEX) #include #include #endif #if defined (USE_POSIX_SEMAPHORES) #include #endif #if defined (USE_POSIX_FILE_LOCK) #include #endif #if defined (_WIN32) #include #endif #ifdef __cplusplus extern "C" { #endif typedef struct ci_proc_mutex ci_proc_mutex_t; typedef struct ci_proc_mutex_scheme { int (*proc_mutex_init)(ci_proc_mutex_t *mutex, const char *name); int (*proc_mutex_destroy)(ci_proc_mutex_t *mutex); int (*proc_mutex_lock)(ci_proc_mutex_t *mutex); int (*proc_mutex_unlock)(ci_proc_mutex_t *mutex); int (*proc_mutex_print_info)(ci_proc_mutex_t *mutex, char *buf, size_t buf_size); const char *name; } ci_proc_mutex_scheme_t; #define CI_PROC_MUTEX_NAME_SIZE 64 struct ci_proc_mutex { char name[CI_PROC_MUTEX_NAME_SIZE]; #if defined(_WIN32) HANDLE id; #else const ci_proc_mutex_scheme_t *scheme; union { #if defined(USE_SYSV_IPC_MUTEX) struct { int id; } sysv; #endif #if defined(USE_POSIX_SEMAPHORES) struct { sem_t *sem; } posix; #endif #if defined(USE_POSIX_FILE_LOCK) struct { int fd; } file; #endif }; #endif }; CI_DECLARE_FUNC(int) ci_proc_mutex_init(ci_proc_mutex_t *mutex, const char *name); CI_DECLARE_FUNC(int) ci_proc_mutex_lock(ci_proc_mutex_t *mutex); CI_DECLARE_FUNC(int) ci_proc_mutex_unlock(ci_proc_mutex_t *mutex); CI_DECLARE_FUNC(int) ci_proc_mutex_destroy(ci_proc_mutex_t *mutex); CI_DECLARE_FUNC(int) ci_proc_mutex_set_scheme(const char *scheme); CI_DECLARE_FUNC(const ci_proc_mutex_scheme_t *) ci_proc_mutex_default_scheme(); #ifdef __cplusplus } #endif #endif c_icap-0.4.2/include/cfg_param.h0000664000175000017500000001541012567550776013416 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __CFG_PARAM_H #define __CFG_PARAM_H #include "body.h" #ifdef __cplusplus extern "C" { #endif struct ci_magics_db; /** \defgroup CONFIG c-icap server configuration API \ingroup API * */ /** * This struct holds the basic configurations of c-icap server. It passed as argument to * services and modules inititalization functions \ingroup CONFIG * * Do not use directly this struct but better use the documended macros and functions */ struct ci_server_conf{ char *ADDRESS; int PORT; int PROTOCOL_FAMILY; char *TMPDIR; char *PIDFILE; char *COMMANDS_SOCKET; char *RUN_USER; char *RUN_GROUP; char *cfg_file; char *magics_file; struct ci_magics_db *MAGIC_DB; char *SERVICES_DIR; char *MODULES_DIR; char *SERVER_ADMIN; char *SERVER_NAME; int START_SERVERS; int MAX_SERVERS; int THREADS_PER_CHILD; int MIN_SPARE_THREADS; int MAX_SPARE_THREADS; }; /** * This struct holds a configuration parameter of c-icap server. \ingroup CONFIG * An array of ci_conf_entry structs can be used to define the configuration directives * of a service or module which can be set in c-icap configuration file. \code int AParam; struct ci_conf_entry conf_table[]= { {"Aparameter", &AParam, ci_cfg_set_int, "This is a simple configuration parameter"}, {NULL,NULL,NULL,NULL} } \endcode In the above example the ci_cfg_set_int function is predefined. If the table "conf_table" attached to the service "AService" then the AParam integer variable can be set from the c-icap configuration file using the directive "AService.Aparameter" */ struct ci_conf_entry{ /** * The configuration directive */ const char *name; /** * A pointer to the configuration data */ void *data; /** * Pointer to the function which will be used to set configuration data. \param name is the configuration directive.It passed as argument by the c-icap server \param argv is a NULL termined string array which holds the list of arguments of configuration parameter \param setdata is o pointer to set data which passed as argument by c-icap server \return Non zero on success, zero otherwise */ int (*action)(const char *name, const char **argv,void *setdata); /** * A description message */ const char *msg; }; /* Command line options implementation structure */ struct ci_options_entry{ const char *name; const char *parameter; void *data; int (*action)(const char *name, const char **argv,void *setdata); const char *msg; }; /*Struct for storing default parameter values*/ struct cfg_default_value{ void *param; void *value; int size; struct cfg_default_value *next; }; #define MAIN_TABLE 1 #define ALIAS_TABLE 2 #ifndef CI_BUILD_LIB extern struct ci_server_conf CI_CONF; struct cfg_default_value * cfg_default_value_store(void *param, void *value,int size); struct cfg_default_value * cfg_default_value_replace(void *param, void *value); void * cfg_default_value_restore(void *value); struct cfg_default_value * cfg_default_value_search(void *param); int register_conf_table(const char *name,struct ci_conf_entry *table,int type); struct ci_conf_entry * unregister_conf_table(const char *name); int config(int argc, char **argv); int intl_cfg_set_str(const char *directive,const char **argv,void *setdata); int intl_cfg_set_int(const char *directive,const char **argv,void *setdata); int intl_cfg_onoff(const char *directive,const char **argv,void *setdata); int intl_cfg_disable(const char *directive,const char **argv,void *setdata); int intl_cfg_enable(const char *directive,const char **argv,void *setdata); int intl_cfg_size_off(const char *directive,const char **argv,void *setdata); int intl_cfg_size_long(const char *directive,const char **argv,void *setdata); #endif CI_DECLARE_FUNC(void) ci_cfg_lib_init(); CI_DECLARE_FUNC(void) ci_cfg_lib_reset(); CI_DECLARE_FUNC(void *) ci_cfg_alloc_mem(int size); /** * Sets a string configuration parameter. The setdata are a pointer to a string pointer \ingroup CONFIG */ CI_DECLARE_FUNC(int) ci_cfg_set_str(const char *directive,const char **argv,void *setdata); /** * Sets an int configuration parameter. The setdata is a pointer to an integer \ingroup CONFIG */ CI_DECLARE_FUNC(int) ci_cfg_set_int(const char *directive,const char **argv,void *setdata); /** * Sets an on/off configuration parameter. The setdata is a pointer to an integer, which * when the argument is "on" it is set to 1 and when the argument is "off" it is set to 0. \ingroup CONFIG */ CI_DECLARE_FUNC(int) ci_cfg_onoff(const char *directive,const char **argv,void *setdata); /** * Can used with configuration parameters which does not takes arguments but when defined just disable a feature. * The setdata is a pointer to an int which is set to zero. \ingroup CONFIG */ CI_DECLARE_FUNC(int) ci_cfg_disable(const char *directive,const char **argv,void *setdata); /** * Can used with configuration parameters which does not takes arguments but when defined just enable a feature. * The setdata is a pointer to an int which is set to non zero. \ingroup CONFIG */ CI_DECLARE_FUNC(int) ci_cfg_enable(const char *directive,const char **argv,void *setdata); /** * Sets a configuration parameter of type ci_off_t (typedef of off_t type). \ingroup CONFIG */ CI_DECLARE_FUNC(int) ci_cfg_size_off(const char *directive,const char **argv,void *setdata); /** * Sets a configuration parameter of type long. \ingroup CONFIG */ CI_DECLARE_FUNC(int) ci_cfg_size_long(const char *directive,const char **argv,void *setdata); CI_DECLARE_FUNC(void) ci_args_usage(const char *progname,struct ci_options_entry *options); CI_DECLARE_FUNC(int) ci_args_apply(int argc, char *argv[],struct ci_options_entry *options); #ifdef __CI_COMPAT #define icap_server_conf ci_server_conf #define conf_entry ci_conf_entry #define options_entry ci_options_entry #endif #ifdef __cplusplus } #endif #endif c_icap-0.4.2/include/registry.h0000664000175000017500000000321012567550776013342 00000000000000/* * Copyright (C) 2013 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __REGISTRY_H #define __REGISTRY_H #include "c-icap.h" #ifdef __cplusplus extern "C" { #endif CI_DECLARE_FUNC(int) ci_registry_create(const char *name); CI_DECLARE_FUNC(void) ci_registry_clean(); CI_DECLARE_FUNC(int) ci_registry_iterate(const char *name, void *data, int (*fn)(void *data, const char *label, const void *)); CI_DECLARE_FUNC(int) ci_registry_add_item(const char *name, const char *label, const void *obj); CI_DECLARE_FUNC(const void *) ci_registry_get_item(const char *name, const char *label); CI_DECLARE_FUNC(int) ci_registry_get_id(const char *name); CI_DECLARE_FUNC(int) ci_registry_id_iterate(int reg_id, void *data, int (*fn)(void *data, const char *label, const void *)); CI_DECLARE_FUNC(const void *) ci_registry_id_get_item(int reg_id, const char *label); #ifdef __cplusplus } /*extern "C"*/ #endif #endif /*__REGISTRY_H*/ c_icap-0.4.2/include/shared_mem.h0000664000175000017500000000440612567550776013606 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef _SHARED_MEM_H #define _SHARED_MEM_H #include "c-icap.h" #if defined (_WIN32) #include #endif #ifdef __cplusplus extern "C" { #endif typedef struct ci_shared_mem_id ci_shared_mem_id_t; typedef struct ci_shared_mem_scheme { void *(*shared_mem_create)(ci_shared_mem_id_t *id, const char *name, int size); void *(*shared_mem_attach)(ci_shared_mem_id_t *id); int (*shared_mem_detach)(ci_shared_mem_id_t *id); int (*shared_mem_destroy)(ci_shared_mem_id_t *id); int (*shared_mem_print_info)(ci_shared_mem_id_t *id, char *buf, size_t buf_size); const char *name; } ci_shared_mem_scheme_t; #define CI_SHARED_MEM_NAME_SIZE 64 struct ci_shared_mem_id { char name[CI_SHARED_MEM_NAME_SIZE]; void *mem; size_t size; #if defined (_WIN32) HANDLE id; #else const ci_shared_mem_scheme_t *scheme; union{ #if defined (USE_POSIX_SHARED_MEM) struct posix{ int fd; } posix; #endif #if defined (USE_SYSV_IPC) struct sysv{ int id; } sysv; #endif int id_; }; #endif }; CI_DECLARE_FUNC(void) *ci_shared_mem_create(ci_shared_mem_id_t *id, const char *name, int size); CI_DECLARE_FUNC(void) *ci_shared_mem_attach(ci_shared_mem_id_t *id); CI_DECLARE_FUNC(int) ci_shared_mem_detach(ci_shared_mem_id_t *id); CI_DECLARE_FUNC(int) ci_shared_mem_destroy(ci_shared_mem_id_t *id); CI_DECLARE_FUNC(int) ci_shared_mem_set_scheme(const char *name); #ifdef __cplusplus } #endif #endif c_icap-0.4.2/include/txtTemplate.h0000664000175000017500000000364612567550776014022 00000000000000/* * Copyright (C) 2007,2010 Trever L. Adams * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ // Additionally, you may use this file under LGPL 2 or (at your option) later #ifndef __TXTTEMPLATE_H #define __TXTTEMPLATE_H #include #include "request.h" #include "txt_format.h" #include "body.h" #ifdef __cplusplus extern "C" { #endif CI_DECLARE_FUNC (ci_membuf_t *) ci_txt_template_build_content(const ci_request_t *req, const char *SERVICE_NAME, const char *TEMPLATE_NAME, struct ci_fmt_entry *user_table); CI_DECLARE_FUNC (void) ci_txt_template_reset(void); CI_DECLARE_FUNC (int) ci_txt_template_init(void); CI_DECLARE_FUNC (void) ci_txt_template_close(void); CI_DECLARE_FUNC (void) ci_txt_template_set_dir(const char *dir); CI_DECLARE_FUNC (void) ci_txt_template_set_default_lang(const char *lang); CI_DECLARE_DATA extern const char *TEMPLATE_DIR; CI_DECLARE_DATA extern const char *TEMPLATE_DEF_LANG; CI_DECLARE_DATA extern int TEMPLATE_RELOAD_TIME; // Default time is one hour, this variable is in seconds CI_DECLARE_DATA extern int TEMPLATE_CACHE_SIZE; // How many templates can be cached CI_DECLARE_DATA extern int TEMPLATE_MEMBUF_SIZE; // Max memory for txtTemplate to expand template into txt #ifdef __cplusplus } #endif #endif /*__TXTTEMPLATE_H*/ c_icap-0.4.2/include/acl.h0000664000175000017500000001633712567550776012247 00000000000000/* * Copyright (C) 2004-2009 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __ACL_H #define __ACL_H #include "c-icap.h" #include "net_io.h" #include "types_ops.h" #ifdef __cplusplus extern "C" { #endif /** \defgroup ACL Access lists API \ingroup API * Access control lists related API. Structures, functions and macros used to define * custom acl types, and use access control lists in services and modules. */ #define MAX_NAME_LEN 31 /*ACL type structures and functions */ struct ci_request; /** \ingroup ACL * This is the struct used to implement an acl type object. */ typedef struct ci_acl_type{ /** \brief The acl type name */ char name[MAX_NAME_LEN+1]; /** \brief Pointer to the functions which retrieves the test data for this acl type * * This method extract the test data from request object for this acl object. * For example for the "src" acl type this function will extract the icap client * ip address \param req Pointer to the related ci_request_t object \param param Some acl types supports one parameter passed by the c-icap administrator \return A pointer to the test data */ void *(*get_test_data)(struct ci_request *req, char *param); /** \brief Pointer to the function which release the acl test data (if required) * * This method releases the acl test data,which allocated using the get_test_data method \param req Pointer to the related ci_request_t object \param data Pointer to allocated test data */ void (*free_test_data)(struct ci_request *req, void *data); /** \brief Pointer to the ci_types_ops_t struct which implements basic operations for the acl test data */ const ci_type_ops_t *type; } ci_acl_type_t; struct ci_acl_type_list{ ci_acl_type_t *acl_type_list; int acl_type_list_size; int acl_type_list_num; }; int ci_acl_typelist_init(struct ci_acl_type_list *list); int ci_acl_typelist_add(struct ci_acl_type_list *list, const ci_acl_type_t *type); int ci_acl_typelist_release(struct ci_acl_type_list *list); int ci_acl_typelist_reset(struct ci_acl_type_list *list); const ci_acl_type_t *ci_acl_typelist_search(struct ci_acl_type_list *list, const char *name); /*ACL specs structures and functions */ typedef struct ci_acl_data ci_acl_data_t; struct ci_acl_data{ void *data; ci_acl_data_t *next; }; /** \brief This struct holds an access control list (acl). \ingroup ACL * * Imagine the following access control list defined in the c-icap config file:\n * \code acl LOCALNET 127.0.0.1/255.255.255.255 192.168.1.0/255.255.255.0 * \endcode * This struct represents access control lists like the above */ typedef struct ci_acl_spec ci_acl_spec_t; struct ci_acl_spec { char name[MAX_NAME_LEN + 1]; const ci_acl_type_t *type; char *parameter; ci_acl_data_t *data; ci_acl_spec_t *next; }; /*Specs lists and access entries structures and functions */ typedef struct ci_specs_list ci_specs_list_t; struct ci_specs_list{ const ci_acl_spec_t *spec; int negate; ci_specs_list_t *next; }; /** \brief An access entry object holds an access control list, and can be connected to linked lists of access entries. \ingroup ACL * * This struct used to implement lists of access control lists. * Each access entry can hold an "allow" or "deny" access control list. * An access entries list represents the following c-icap config lines: * \code * icap_access allow LOCALNET LOCALHOST * icap_access deny ALL * \endcode * each of the above lines represented by an ci_access_entry object. * The ci_access_entry objects can be connected to a simple linked list. * */ typedef struct ci_access_entry ci_access_entry_t; struct ci_access_entry { int type; /*CI_ACCESS_DENY or CI_ACCESS_ALLOW*/ ci_specs_list_t *spec_list; ci_access_entry_t *next; }; /** \brief Append a new access entry object to an access entries list \ingroup ACL * \param list Pointer to the access entry list \param type CI_ACCESS_ALLOW if CI_ACCESS_DENY to specify if this access entry holds an "allow" or "deny" access control list \return A pointer to the newly created access entry object */ CI_DECLARE_FUNC(ci_access_entry_t *) ci_access_entry_new(ci_access_entry_t **list, int type); /** \brief Destroy an access entries list \ingroup ACL * \param list Pointer to the access entries list */ CI_DECLARE_FUNC(void) ci_access_entry_release(ci_access_entry_t *list); CI_DECLARE_FUNC(const ci_acl_spec_t *) ci_access_entry_add_acl(ci_access_entry_t *access_entry, const ci_acl_spec_t *acl, int negate); /** \brief Add an acl to an access entry object \ingroup ACL * \param access_entry Pointer to the access entry object \param aclname The name of the acl to be added. \return non zero on success, zero otherwise */ CI_DECLARE_FUNC(int) ci_access_entry_add_acl_by_name(ci_access_entry_t *access_entry, const char *aclname); /** \brief Check if an access entries list matches a request object \ingroup ACL * \param access_entry Pointer to the access entries list (a linked list of ci_access_entry_t objects) \param req pointer to the request object (ci_request_t object) \return CI_ACCESS_ALLOW if request matches the access list, CI_ACCESS_DENY otherwise */ CI_DECLARE_FUNC(int) ci_access_entry_match_request(ci_access_entry_t *access_entry, ci_request_t *req); /*Inititalizing, reseting and tools acl library functions */ /** \brief Initializes the c-icap acl subsystem. It is not thread safe \ingroup ACL */ CI_DECLARE_FUNC(void) ci_acl_init(); /** \brief Resets the c-icap acl subsystem. It is not thread safe \ingroup ACL */ CI_DECLARE_FUNC(void) ci_acl_reset(); CI_DECLARE_FUNC(const ci_acl_spec_t *) ci_acl_search(const char *name); CI_DECLARE_FUNC(int) ci_acl_add_data(const char *name, const char *type, const char *data); /** \brief Search for an acl type \ingroup ACL * \param name The name of the acl type \return Pointer to the ci_acl_type_t structure which implements the acl type, or NULL */ CI_DECLARE_FUNC(const ci_acl_type_t *) ci_acl_type_search(const char *name); /** \brief Add a custom acl type to the c-icap acl subsystem \ingroup ACL * \param type Pointer to the c-acl_type_t struct which implements the acl type \return non zero on success, zero otherwise */ CI_DECLARE_FUNC(int) ci_acl_type_add(const ci_acl_type_t *type); #ifdef __cplusplus } #endif #endif/* __ACL_H*/ c_icap-0.4.2/include/module.h0000664000175000017500000001031112567550777012760 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __MODULE_H #define __MODULE_H #include #include "request.h" #include "header.h" #include "service.h" #include "cfg_param.h" #ifdef __cplusplus extern "C" { #endif struct ci_request; enum module_type{ UNKNOWN, SERVICE_HANDLER, LOGGER, ACCESS_CONTROLLER, AUTH_METHOD, AUTHENTICATOR, COMMON, MODS_TABLE_END }; typedef struct service_handler_module{ const char *name; const char *extensions; int (*init_service_handler)(struct ci_server_conf *server_conf); int (*post_init_service_handler)(struct ci_server_conf *server_conf); void (*release_service_handler)(); ci_service_module_t *(*create_service)(const char *service_file); struct ci_conf_entry *conf_table; } service_handler_module_t; typedef struct common_module{ const char *name; int (*init_module)(struct ci_server_conf *server_conf); int (*post_init_module)(struct ci_server_conf *server_conf); void (*close_module)(); struct ci_conf_entry *conf_table; } common_module_t; typedef struct logger_module{ const char *name; int (*init_logger)(struct ci_server_conf *server_conf); int (*log_open)(); /*Or better post_init_logger .......*/ void (*log_close)(); void (*log_access)(ci_request_t *req); void (*log_server)(const char *server, const char *format, va_list ap); struct ci_conf_entry *conf_table; } logger_module_t; typedef struct access_control_module{ const char *name; int (*init_access_controller)(struct ci_server_conf *server_conf); int (*post_init_access_controller)(struct ci_server_conf *server_conf); void (*release_access_controller)(); int (*client_access)(ci_request_t *req); int (*request_access)(ci_request_t *req); struct ci_conf_entry *conf_table; } access_control_module_t; typedef struct http_auth_method{ const char *name; int (*init_auth_method)(struct ci_server_conf *server_conf); int (*post_init_auth_method)(struct ci_server_conf *server_conf); void (*close_auth_method)(); void *(*create_auth_data)(const char *authorization_header,const char **username); void (*release_auth_data)(void *data); char *(*authentication_header)(); void (*release_authentication_header)(); struct ci_conf_entry *conf_table; } http_auth_method_t; typedef struct authenticator_module{ const char *name; const char *method; int (*init_authenticator)(struct ci_server_conf *server_conf); int (*post_init_authenticator)(struct ci_server_conf *server_conf); void (*close_authenticator)(); int (*authenticate)(void *data, const char *usedb); struct ci_conf_entry *conf_table; } authenticator_module_t; int init_modules(); int post_init_modules(); void * register_module(const char *module_file,const char *type); logger_module_t *find_logger(const char *name); access_control_module_t *find_access_controller(const char *name); service_handler_module_t *find_servicehandler(const char *name); service_handler_module_t *find_servicehandler_by_ext(const char *extension); http_auth_method_t *find_auth_method_n(const char *method, int len, int *method_id); http_auth_method_t * get_authentication_schema(const char *method_name, authenticator_module_t ***authenticators); void *find_module(const char *name,int *type); int set_method_authenticators(const char *method_name, const char **argv); #ifdef __cplusplus } #endif #endif c_icap-0.4.2/include/header.h0000664000175000017500000001647612567550777012745 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __HEADERS_H #define __HEADERS_H #include "c-icap.h" #ifdef __cplusplus extern "C" { #endif /** \defgroup HEADERS Headers related API \ingroup API * Headers manipulation related API. */ enum ci_request_headers { ICAP_AUTHORIZATION, ICAP_ALLOW, ICAP_FROM, ICAP_HOST, ICAP_REFERER, ICAP_USERAGENT,ICAP_PREVIEW }; extern const char *ci_common_headers[]; extern const char *ci_request_headers[]; extern const char *ci_responce_headers[]; extern const char *ci_options_headers[]; enum ci_encapsulated_entities {ICAP_REQ_HDR, ICAP_RES_HDR, ICAP_REQ_BODY, ICAP_RES_BODY, ICAP_NULL_BODY,ICAP_OPT_BODY }; CI_DECLARE_DATA extern const char *ci_encaps_entities[]; #ifdef __CYGWIN__ const char *ci_encaps_entity_string(int e); #else #define ci_encaps_entity_string(e) (e<=ICAP_OPT_BODY&&e>=ICAP_REQ_HDR?ci_encaps_entities[e]:"UNKNOWN") #endif /** \typedef ci_headers_list_t \ingroup HEADERS * This is a struct which can store a set of headers. * The developers should not touch ci_headers_list_t objects directly but better use the * documented macros and functions */ typedef struct ci_headers_list{ int size; int used; char **headers; int bufsize; int bufused; char *buf; int packed; } ci_headers_list_t; typedef struct ci_encaps_entity{ int start; int type; void *entity; } ci_encaps_entity_t; #define BUFSIZE 4096 #define HEADERSTARTSIZE 64 #define HEADSBUFSIZE BUFSIZE #define MAX_HEADER_SIZE 1023 #define ci_headers_not_empty(h) ((h)->used) #define ci_headers_is_empty(h) ((h)->used==0) /** * Allocate memory for a ci_headers_list_t object and initialize it. \ingroup HEADERS \return the allocated object on success, NULL otherwise. * */ CI_DECLARE_FUNC(ci_headers_list_t *) ci_headers_create(); /** * Destroy a ci_headers_list_t object \ingroup HEADERS \param heads is a pointer to the ci_headers_list_t object to be destroyed * */ CI_DECLARE_FUNC(void) ci_headers_destroy(ci_headers_list_t *heads); /** * Resets and initialize a ci_headers_list_t object \ingroup HEADERS \param heads pointer to the ci_headers_list_t object to be reset * */ CI_DECLARE_FUNC(void) ci_headers_reset(ci_headers_list_t *heads); CI_DECLARE_FUNC(int) ci_headers_setsize(ci_headers_list_t *heads, int size); /** * Add a header to a ci_headers_list_t object \ingroup HEADERS \param heads is a pointer to the ci_headers_list_t object in which the header will be added \param header is the header to be added \return Pointer to the newly add header on success, NULL otherwise * *example usage: \code ci_headers_add(heads,"Content-Length: 1025") \endcode * */ CI_DECLARE_FUNC(const char *) ci_headers_add(ci_headers_list_t *heads, const char *header); /** * Append a headers list object to an other headers list \ingroup HEADERS \param heads is a pointer to the ci_headers_list_t object in which the headers will be added \param someheaders is a ci_headers_list_t object which contains the headers will be added to the heads \return non zero on success zero otherwise */ CI_DECLARE_FUNC(int) ci_headers_addheaders(ci_headers_list_t *heads,const ci_headers_list_t *someheaders); /** * Removes a header from a header list \ingroup HEADERS \param heads is a pointer to the ci_headers_list_t object \param header is the name of the header to be removed \return non zero on success, zero otherwise * *example usage: \code ci_headers_remove(heads,"Content-Length") \endcode * */ CI_DECLARE_FUNC(int) ci_headers_remove(ci_headers_list_t *heads, const char *header); /** * Search for a header in a header list \ingroup HEADERS \param heads is a pointer to the ci_headers_list_t object \param header is the name of the header \return a pointer to the start of the first occurrence of the header on success, NULL otherwise * *example usage: \code char *head; head=ci_headers_search(heads,"Content-Length") \endcode * In this example on success the head pointer will point to a \em "Content-Lenght: 1025" string * */ CI_DECLARE_FUNC(const char *) ci_headers_search(ci_headers_list_t *heads, const char *header); /** * Search for a header in a header list and return the value of the first occurrence of this header \ingroup HEADERS \param heads is a pointer to the ci_headers_list_t object \param header is the name of the header \return a pointer to the start of the header on success, NULL otherwise * *example usage: \code char *headval; int content_length; headval = ci_headers_value(heads,"Content-Length"); content_length = strtol(headval,NULL,10); \endcode * */ CI_DECLARE_FUNC(const char *) ci_headers_value(ci_headers_list_t *heads, const char *header); /** * Search for a header in a header list and copy the value to a buffer if exist \ingroup HEADERS \param heads is a pointer to the ci_headers_list_t object \param header is the name of the header \param buf is the buffer to store header value \param len is the size of the buffer buf \return a pointer to the buf on success, NULL otherwise * *example usage: \code char *headval; char buf[1024]; int content_length; headval = ci_headers_copy_value(heads, "Content-Length", buf, sizeof(buf)); if (headval) printf("Content-Length: %s\n", buf); \endcode * */ CI_DECLARE_FUNC(const char *) ci_headers_copy_value(ci_headers_list_t *heads, const char *header, char *buf, size_t len); /** * Run the given function for each header name/value pair \ingroup HEADERS \param heads is a pointer to the ci_headers_list_t object \param data is a pointer to data which will passed as first argument to the fn function \param fn is a pointer to a function which will run for each header name/value pair. \return non zero on success, zero otherwise */ CI_DECLARE_FUNC(int) ci_headers_iterate(ci_headers_list_t *heads, void *data, void (*fn)(void *data, const char *header_name, const char *header_value)); /*The following headers are only used internally */ CI_DECLARE_FUNC(void) ci_headers_pack(ci_headers_list_t *heads); CI_DECLARE_FUNC(int) ci_headers_unpack(ci_headers_list_t *heads); CI_DECLARE_FUNC(int) sizeofheader(ci_headers_list_t *heads); CI_DECLARE_FUNC(ci_encaps_entity_t) *mk_encaps_entity(int type,int val); CI_DECLARE_FUNC(void) destroy_encaps_entity(ci_encaps_entity_t *e); CI_DECLARE_FUNC(int) get_encaps_type(const char *buf,int *val,char **endpoint); CI_DECLARE_FUNC(int) sizeofencaps(ci_encaps_entity_t *e); #ifdef __CI_COMPAT #define ci_headers_make ci_header_create #endif #ifdef __cplusplus } #endif #endif c_icap-0.4.2/include/util.h0000664000175000017500000000402312567550776012452 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __UTIL_H #define __UTIL_H #include "array.h" #ifdef __cplusplus extern "C" { #endif #define STR_TIME_SIZE 64 CI_DECLARE_FUNC(void) ci_strtime(char *buf); CI_DECLARE_FUNC(void) ci_strtime_rfc822(char *buf); CI_DECLARE_FUNC(int) ci_mktemp_file(char*dir,char *name_template,char *filename); CI_DECLARE_FUNC(int) ci_usleep(unsigned long usec); #ifdef _WIN32 CI_DECLARE_FUNC(int) mkstemp(char *filename); CI_DECLARE_FUNC(struct tm*) localtime_r(const time_t *t, struct tm *tm); CI_DECLARE_FUNC(struct tm*) gmtime_r(const time_t *t, struct tm *tm); #endif CI_DECLARE_FUNC(const char *) ci_strnstr(const char *s, const char *find, size_t slen); CI_DECLARE_FUNC(const char *) ci_strncasestr(const char *s, const char *find, size_t slen); CI_DECLARE_FUNC(const char *) ci_strcasestr(const char *str, const char *find); /*Handle M/m/k/K suffixes and try to detect errors*/ CI_DECLARE_FUNC(long int) ci_atol_ext(const char *str, const char **error); CI_DECLARE_FUNC(void) ci_str_trim(char *str); CI_DECLARE_FUNC(char *) ci_str_trim2(char *s); CI_DECLARE_FUNC(char *) ci_strerror(int error, char *buf, size_t buflen); CI_DECLARE_FUNC(ci_dyn_array_t *) ci_parse_key_value_list(const char *str, char sep); #ifdef __cplusplus } #endif #endif c_icap-0.4.2/include/mem.h0000664000175000017500000000623712567550777012265 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __MEM_H #define __MEM_H #include "c-icap.h" #ifdef __cplusplus extern "C" { #endif enum allocator_types {OS_ALLOC, SERIAL_ALLOC, POOL_ALLOC, PACK_ALLOC}; typedef struct ci_mem_allocator { void *(*alloc)(struct ci_mem_allocator *,size_t size); void (*free)(struct ci_mem_allocator *,void *); void (*reset)(struct ci_mem_allocator *); void (*destroy)(struct ci_mem_allocator *); void *data; char *name; int type; int must_free; } ci_mem_allocator_t; CI_DECLARE_DATA extern ci_mem_allocator_t *default_allocator; CI_DECLARE_FUNC(void) ci_mem_allocator_destroy(ci_mem_allocator_t *allocator); CI_DECLARE_FUNC(ci_mem_allocator_t *) ci_create_os_allocator(); CI_DECLARE_FUNC(ci_mem_allocator_t *) ci_create_serial_allocator(int size); /*pack_allocator related functions ....*/ CI_DECLARE_FUNC(ci_mem_allocator_t *) ci_create_pack_allocator(char *memblock, size_t size); CI_DECLARE_FUNC(int) ci_pack_allocator_data_size(ci_mem_allocator_t *allocator); CI_DECLARE_FUNC(void *) ci_pack_allocator_alloc(ci_mem_allocator_t *allocator,size_t size); CI_DECLARE_FUNC(void) ci_pack_allocator_free(ci_mem_allocator_t *allocator,void *p); /*The following six functions are only for c-icap internal use....*/ CI_DECLARE_FUNC(ci_mem_allocator_t *)ci_create_pack_allocator_on_memblock(char *memblock, size_t size); CI_DECLARE_FUNC(size_t) ci_pack_allocator_required_size(); CI_DECLARE_FUNC(void *) ci_pack_allocator_alloc_unaligned(ci_mem_allocator_t *allocator, size_t size); CI_DECLARE_FUNC(void *) ci_pack_allocator_alloc_from_rear(ci_mem_allocator_t *allocator, int size); CI_DECLARE_FUNC(void) ci_pack_allocator_set_start_pos(ci_mem_allocator_t *allocator, void *p); CI_DECLARE_FUNC(void) ci_pack_allocator_set_end_pos(ci_mem_allocator_t *allocator, void *p); CI_DECLARE_FUNC(int) ci_buffers_init(); CI_DECLARE_FUNC(void) ci_buffers_destroy(); CI_DECLARE_FUNC(void *) ci_buffer_alloc(int block_size); CI_DECLARE_FUNC(void *) ci_buffer_realloc(void *data, int block_size); CI_DECLARE_FUNC(void) ci_buffer_free(void *data); CI_DECLARE_FUNC(size_t) ci_buffer_blocksize(const void *data); CI_DECLARE_FUNC(int) ci_object_pool_register(const char *name, int size); CI_DECLARE_FUNC(void) ci_object_pool_unregister(int id); CI_DECLARE_FUNC(void *) ci_object_pool_alloc(int id); CI_DECLARE_FUNC(void) ci_object_pool_free(void *ptr); #ifdef __cplusplus } #endif #endif c_icap-0.4.2/include/dlib.h0000664000175000017500000000273512567550776012417 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __DLIB_H #define __DLIB_H #include "c-icap.h" #ifdef _WIN32 #include #endif #ifdef __cplusplus extern "C" { #endif #ifndef _WIN32 #define CI_DLIB_HANDLE void * #else #define CI_DLIB_HANDLE HMODULE #endif CI_DECLARE_FUNC(CI_DLIB_HANDLE) ci_module_load(const char *module_file, const char *default_path); CI_DECLARE_FUNC(void *) ci_module_sym(CI_DLIB_HANDLE handle,const char *symbol); CI_DECLARE_FUNC(int) ci_module_unload(CI_DLIB_HANDLE handle,const char *name); /*Utility functions */ CI_DECLARE_FUNC(int) ci_dlib_entry(const char *name,const char *file, CI_DLIB_HANDLE handle); #ifdef __cplusplus } #endif #endif /*__DLIB_H*/ c_icap-0.4.2/include/stats.h0000664000175000017500000000704312567550776012640 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __STATS_H #define __STATS_H #include "c-icap.h" #include "ci_threads.h" #ifdef __cplusplus extern "C" { #endif typedef struct kbs{ uint64_t kb; unsigned int bytes; } kbs_t; #define MEMBLOCK_SIG 0xFAFA struct stat_memblock { unsigned int sig; int counters64_size; int counterskbs_size; uint64_t *counters64; kbs_t *counterskbs; }; struct stat_area { ci_thread_mutex_t mtx; void (*release_mem)(void *); struct stat_memblock *mem_block; }; struct stat_entry { char *label; int type; int gid; }; struct stat_entry_list { struct stat_entry *entries; int size; int entries_num; }; struct stat_groups_list { char **groups; int size; int entries_num; }; CI_DECLARE_DATA extern struct stat_entry_list STAT_INT64; CI_DECLARE_DATA extern struct stat_entry_list STAT_KBS; CI_DECLARE_DATA extern struct stat_groups_list STAT_GROUPS; enum ci_stat_type {STAT_INT64_T, STAT_KBS_T}; CI_DECLARE_DATA extern struct stat_area *STATS; CI_DECLARE_FUNC(int) ci_stat_memblock_size(void); CI_DECLARE_FUNC(int) ci_stat_entry_register(char *label, int type, char *group); CI_DECLARE_FUNC(void) ci_stat_entry_release_lists(); CI_DECLARE_FUNC(void) ci_stat_attach_mem(void *mem_block, int size,void (*release_mem)(void *)); CI_DECLARE_FUNC(void) ci_stat_release(); CI_DECLARE_FUNC(void) ci_stat_uint64_inc(int ID, int count); CI_DECLARE_FUNC(void) ci_stat_kbs_inc(int ID, int count); /*Low level functions */ CI_DECLARE_FUNC(struct stat_area *) ci_stat_area_construct(void *mem_block, int size, void (*release_mem)(void *)); CI_DECLARE_FUNC(void) ci_stat_area_destroy(struct stat_area *area); CI_DECLARE_FUNC(void) ci_stat_area_reset(struct stat_area *area); CI_DECLARE_FUNC(void) ci_stat_area_merge(struct stat_area *dest, struct stat_area *src); /*Stats memblocks low level functions*/ CI_DECLARE_FUNC(void) ci_stat_memblock_merge(struct stat_memblock *dest_block, struct stat_memblock *mem_block); CI_DECLARE_FUNC(void) ci_stat_memblock_reset(struct stat_memblock *block); /*DO NOT USE the folllowings are only for internal c-icap server use!*/ CI_DECLARE_FUNC(void) stat_memblock_fix(struct stat_memblock *mem_block); CI_DECLARE_FUNC(void) stat_memblock_reconstruct(struct stat_memblock *mem_block); /*Private defines and functions*/ #define STATS_LOCK() ci_thread_mutex_lock(&STATS->mtx) #define STATS_UNLOCK() ci_thread_mutex_unlock(&STATS->mtx) #define STATS_INT64_INC(ID, count) (STATS->mem_block->counters64[ID] += count) #define STATS_KBS_INC(ID, count) (STATS->mem_block->counterskbs[ID].bytes += count, STATS->mem_block->counterskbs[ID].kb += (STATS->mem_block->counterskbs[ID].bytes >> 10), STATS->mem_block->counterskbs[ID].bytes &= 0x3FF) #ifdef __cplusplus } #endif #endif c_icap-0.4.2/include/types_ops.h0000664000175000017500000000370512567550776013530 00000000000000/* * Copyright (C) 2004-2010 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __TYPES_OPS_H #define __TYPES_OPS_H #include "c-icap.h" #include "mem.h" #ifdef __cplusplus extern "C" { #endif typedef struct ci_type_ops { void *(*dup)(const char *, ci_mem_allocator_t *); void (*free)(void *key, ci_mem_allocator_t *); int (*compare)(const void *ref_key,const void *check_key); size_t (*size)(const void *key); int (*equal)(const void *ref_key,const void *check_key); } ci_type_ops_t; CI_DECLARE_DATA extern const ci_type_ops_t ci_str_ops; CI_DECLARE_DATA extern const ci_type_ops_t ci_str_ext_ops; CI_DECLARE_DATA extern const ci_type_ops_t ci_int32_ops; CI_DECLARE_DATA extern const ci_type_ops_t ci_uint64_ops; CI_DECLARE_DATA extern const ci_type_ops_t ci_ip_ops; CI_DECLARE_DATA extern const ci_type_ops_t ci_ip_sockaddr_ops; CI_DECLARE_DATA extern const ci_type_ops_t ci_datatype_ops; #ifdef USE_REGEX CI_DECLARE_DATA extern const ci_type_ops_t ci_regex_ops; #define ci_type_ops_is_string(tops) ((tops) == &ci_str_ops || (tops) == &ci_str_ext_ops || (tops) == &ci_regex_ops) #else #define ci_type_ops_is_string(tops) ((tops) == &ci_str_ops || (tops) == &ci_str_ext_ops) #endif #ifdef __cplusplus } #endif #endif c_icap-0.4.2/include/service.h0000664000175000017500000004323412567550776013144 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __SERVICE_H #define __SERVICE_H #include "header.h" #include "cfg_param.h" #include "ci_threads.h" #ifdef __cplusplus extern "C" { #endif /** \defgroup SERVICES Services API \ingroup API * Services related API. For detailed information about implementing a service look the documentation * of struct ci_service_module */ #define CI_MOD_NOT_READY 0 #define CI_MOD_DONE 1 #define CI_MOD_CONTINUE 100 #define CI_MOD_ALLOW204 204 #define CI_MOD_ALLOW206 206 #define CI_MOD_ERROR -1 #define MAX_SERVICE_NAME 63 #define MAX_SERVICE_ARGS 255 #define SRV_ISTAG_SIZE 39 /* contains the ISTag: field, the istag part of server and the istag part of service (32+7) */ #define SRV_ISTAG_POS 13 /* strlen("ISTAG: ")+6, 6 is the size of server part of istag */ #define SERVICE_ISTAG_SIZE 26 #define XINCLUDES_SIZE 511 /* it is enough I think ....*/ #define CI_XCLIENTIP 1 #define CI_XSERVERIP 2 #define CI_XSUBSCRIBERID 4 #define CI_XAUTHENTICATEDUSER 8 #define CI_XAUTHENTICATEDGROUPS 16 struct ci_request; typedef struct ci_service_module ci_service_module_t; enum SERVICE_STATUS {CI_SERVICE_NOT_INITIALIZED=-1, CI_SERVICE_OK=0, CI_SERVICE_ERROR=1 }; /** \typedef ci_service_xdata_t \ingroup SERVICES *Stores required data and settings for a service */ typedef struct ci_service_xdata { ci_thread_rwlock_t lock; int status; struct ci_conf_entry *intl_srv_conf_table; uint64_t xopts; char ISTag[SRV_ISTAG_SIZE+1]; char xincludes[XINCLUDES_SIZE+1]; char TransferPreview[MAX_HEADER_SIZE+1]; char TransferIgnore[MAX_HEADER_SIZE+1]; char TransferComplete[MAX_HEADER_SIZE+1]; int preview_size; int max_connections; int options_ttl; int allow_204; int allow_206; int disable_206; /*even if service support it do not use 206*/ /*statistics IDS*/ int stat_bytes_in; int stat_bytes_out; int stat_http_bytes_in; int stat_http_bytes_out; int stat_body_bytes_in; int stat_body_bytes_out; int stat_reqmods; int stat_respmods; int stat_options; int stat_allow204; } ci_service_xdata_t; /** \ingroup SERVICES * Is the structure which implements a service * * To implement a service someones needs to implement the member functions of this struct. These functions * will be called by c-icap as follows: * - New request arrives for this service -> The ci_service_module::mod_init_request_data called * - The icap client sends preview data -> The ci_service_module::mod_check_preview_handler called. * If this function return CI_MOD_ALLOW204 the ICAP transaction stops here. If this function return * CI_MOD_CONTINUE the ICAP client will send the rest body data if exists. * - The client starts sends more data -> ci_service_module::mod_service_io called multiple times until the * client has send all the body data. The service can start send data using this function to the client * before all data has received * - The client has send all data -> the ci_service_module::mod_end_of_data_handler called * - The client waits to read the rest data from c-icap -> ci_service_module::mod_service_io called multiple * times until all the body data send to the client */ struct ci_service_module{ /** \example services/echo/srv_echo.c \ingroup SERVICES \brief The srv_echo.c is an example service implementation, which does not modifies the content * */ /** \brief The service name */ const char *mod_name; /** \brief Service short description */ const char *mod_short_descr; /** \brief Service type * * The service type can be ICAP_RESPMOD for a responce modification service, * ICAP_REQMOD for request modification service or ICAP_RESPMOD|ICAP_REQMOD for * a service implements both response and request modification */ int mod_type; /** \brief Pointer to the function called when the service loaded. * * This function called exactly when the service loaded by c-icap. Can be used to initialize * the service. \param srv_xdata Pointer to the ci_service_xdata_t object of this service \param server_conf Pointer to the struct holds the main c-icap server configuration \return CI_OK on success, CI_ERROR on any error. */ int (*mod_init_service)(ci_service_xdata_t *srv_xdata,struct ci_server_conf *server_conf); /** \brief Pointer to the function which called after the c-icap initialized, but before * the c-icap start serves requests. * * This function can be used to initialize the service. Unlike to the * ci_service_module::mod_init_service when this function called the c-icap has initialized * and it is known other system parameters like the services and modules which are loaded, * network ports and addresses c-icap is listening etc. \param srv_xdata Pointer to the ci_service_xadata_t object of this service \param server_conf Pointer to the struct holds the main c-icap server configuration \return CI_OK on success, CI_ERROR on errors. */ int (*mod_post_init_service)(ci_service_xdata_t *srv_xdata,struct ci_server_conf *server_conf); /** \brief Pointer to the function which called on c-icap server shutdown * * This function can be used to release service allocated resources */ void (*mod_close_service)(); /** \brief Pointer to the function called when a new request for this services arrives *to c-icap server. * * This function should inititalize the data and structures required for serving the request. \param req a pointer to the related ci_request_t structure \return a void pointer to the user defined data required for serving the request. * The developer can obtain the service data from the related ci_request_t object using the * macro ci_service_data */ void *(*mod_init_request_data)(struct ci_request *req); /** \brief Pointer to the function which releases the service data. * * This function called after the user request served to release the service data \param srv_data pointer to the service data returned by the ci_service_module::mod_init_request_data call */ void (*mod_release_request_data)(void *srv_data); /** \brief Pointer to the function which is used to preview the ICAP client request * * The client if supports preview sends some data for examination. * The service using this function will decide if the client request must processed so the client * must send more data or no modification/processing needed so the request ended here. \param preview_data Pointer to the preview data \param preview_data_len The size of preview data \param req pointer to the related ci_request struct \return CI_MOD_CONTINUE if the client must send more data, CI_MOD_ALLOW204 if the service does * not want to modify anything, or CI_ERROR on errors. */ int (*mod_check_preview_handler)(char *preview_data,int preview_data_len,struct ci_request *req); /** \brief Pointer to the function called when the icap client has send all the data to the service * *This function called when the ICAP client has send all data. \param req pointer to the related ci_request struct \return CI_MOD_DONE if all are OK, CI_MOD_ALLOW204 if the ICAP client request supports 204 responses * and we are not planning to modify anything, or CI_ERROR on errors. * The service must not return CI_MOD_ALLOW204 if has already send some data to the client, or the * client does not support allow204 responses. To examine if client supports 204 responses the * developer should use the ci_req_allow204 macro */ int (*mod_end_of_data_handler)(struct ci_request *req); /** \brief Pointer to the function called to read/send body data from/to icap client. * * This function reads body data from the ICAP client and sends back the modified body data * To allow c-icap send data to the ICAP client before all data received by the c-icap a call * to the ci_req_unlock_data function required. \param wbuf The buffer for writing data to the ICAP client \param wlen The size of the write buffer. It must modified to be the size of writing data. If * the service has send all the data to the client this parameter must set to CI_EOF. \param rbuf Pointer to the data read from the ICAP client \param rlen The lenght of the data read from the ICAP client. If this function for a reason * can not read all the data, it must modify the rlen to be equal to the read data \param iseof It has non zero value if the data in rbuf buffer are the last data from the ICAP client. \param req pointer to the related ci_request struct \return Return CI_OK if all are OK or CI_ERROR on errors */ int (*mod_service_io)(char *wbuf,int *wlen,char *rbuf,int *rlen,int iseof, struct ci_request *req); /** \brief Pointer to the config table of the service * * Is an array which contains the definitions of configuration parameters used by the service. * The configuration parameters defined in this array can be used in c-icap.conf file. */ struct ci_conf_entry *mod_conf_table; /** \brief NULL pointer * * This field does not used. Set it to NULL. */ void *mod_data; }; typedef struct service_alias { char alias[MAX_SERVICE_NAME+1]; char args[MAX_SERVICE_ARGS+1]; ci_service_module_t *service; } service_alias_t; /*Internal function */ ci_service_module_t *add_service(ci_service_module_t *service); ci_service_module_t *register_service(const char *module_file); service_alias_t *add_service_alias(const char *service_alias, const char *service_name,const char *args); ci_service_module_t *find_service(const char *service_name); service_alias_t *find_service_alias(const char *service_name); ci_service_xdata_t *service_data(ci_service_module_t *srv); int init_services(); int post_init_services(); int release_services(); /*Library functions */ /*Undocumented, are not usefull to users*/ CI_DECLARE_FUNC(void) ci_service_data_read_lock(ci_service_xdata_t *srv_xdata); CI_DECLARE_FUNC(void) ci_service_data_read_unlock(ci_service_xdata_t *srv_xdata); /** \ingroup SERVICES \brief Sets the ISTAG for the service. * *Normally this function called in ci_service_module::mod_init_service() or ci_service_module::mod_post_init_service() *function, while the service initialization. \param srv_xdata is a pointer to the c-icap internal service data. \param istag is a string contains the new ISTAG for the service. The istag size can not be more than a size of * SERVICE_ISTAG_SIZE. If the lenght of istag is greater than SERVICE_ISTAG_SIZE the extra bytes ignored. */ CI_DECLARE_FUNC(void) ci_service_set_istag(ci_service_xdata_t *srv_xdata, const char *istag); /** \ingroup SERVICES \brief Sets the service x-headers mask which defines the X-Headers supported by the service.The c-icap * server will adverdise these headers in options responses. * * Normally this function called in ci_service_module::mod_init_service() or ci_service_module::mod_post_init_service() * function, while the service initialization. \param srv_xdata is a pointer to the c-icap internal service data. \param xopts is a compination of one or more of the following defines: * - CI_XCLIENTIP: Refers to the X-Client-IP header. The HTTP proxy (or the ICAP client) will sends * the ip address of the HTTP client using this header if supports this header. * - CI_XSERVERIP: The X-Server-IP header. The HTTP proxy will incluse the IP of the HTTP destination * host in the X-Server-IP header if supports this header. * - CI_XSUBSCRIBERID: The X-Subscriber-ID header. This header can include a unique subscriber ID of the * user who issued the HTTP request * - CI_XAUTHENTICATEDUSER: The X-Authenticated-User header. If the user has been authenticated on * HTTP proxy the HTTP proxy will send the authenticated user name. * - CI_XAUTHENTICATEDGROUPS: The X-Authenticated-Group header. If the user has been authenticated on * HTTP proxy and belongs to some groups the HTTP proxy will send these groups using this header. * * example usage: \code * ci_service_set_xopts(srv_xdata,CI_XCLIENTIP|CI_XAUTHENTICATEDUSER); \endcode * * For more informations about ICAP common X-Headers look at: * http://www.icap-forum.org/documents/specification/draft-stecher-icap-subid-00.txt */ CI_DECLARE_FUNC(void) ci_service_set_xopts(ci_service_xdata_t *srv_xdata, uint64_t xopts); /** \ingroup SERVICES \brief it is similar to the function ci_service_set_xopts but just adds (not sets) the X-Headers * defined by the xopts parameter to the existing x-headers mask of service. * */ CI_DECLARE_FUNC(void) ci_service_add_xopts(ci_service_xdata_t *srv_xdata, uint64_t xopts); /** \ingroup SERVICES \brief Set the list of file extensions that should previewed by the service. * * The c-icap will inform the ICAP client that should send preview data for the files which have * the extensions contained in the preview string. The wildcard value "*" specifies all files * extensions, which is the default. \param srv_xdata is a pointer to the c-icap internal service data. \param preview is the string which contains the list of the file extensions. * * example usage: \code * ci_service_set_transfer_preview(srv_xdata,"zip, tar"); \endcode */ CI_DECLARE_FUNC(void) ci_service_set_transfer_preview(ci_service_xdata_t *srv_xdata,const char *preview); /** \ingroup SERVICES \brief Set the list of file extensions that should NOT be send for this service. * * The c-icap will inform the ICAP client that should not send files which have the extensions * contained in the ignore string. \param srv_xdata is a pointer to the c-icap internal service data. \param ignore is the string which contains the list of the file extensions. * * example usage: \code * ci_service_set_transfer_ignore(srv_xdata,"gif, jpeg"); \endcode */ CI_DECLARE_FUNC(void) ci_service_set_transfer_ignore(ci_service_xdata_t *srv_xdata, const char *ignore); /** \ingroup SERVICES \brief Set the list of file extensions that should be send in their entirety (without preview) to this service. * * The c-icap will inform the ICAP client that should send files which have the extensions * contained in the complete string, in their entirety to this service. \param srv_xdata is a pointer to the c-icap internal service data. \param complete is the string which contains the list of the file extensions. * *example usage: \code * ci_service_set_transfer_complete(srv_xdata,"exe, bat, com, ole"); \endcode */ CI_DECLARE_FUNC(void) ci_service_set_transfer_complete(ci_service_xdata_t *srv_xdata, const char *complete); /** \ingroup SERVICES \brief Sets the maximum preview size supported by this service * \param srv_xdata is a pointer to the c-icap internal service data. \param preview is the size of preview data supported by this service */ CI_DECLARE_FUNC(void) ci_service_set_preview(ci_service_xdata_t *srv_xdata, int preview); /** \ingroup SERVICES \brief Enable the allow 204 responses for this service. * * The service will supports the allow 204 responses if the icap client support it too. \param srv_xdata is a pointer to the c-icap internal service data. */ CI_DECLARE_FUNC(void) ci_service_enable_204(ci_service_xdata_t *srv_xdata); /** \ingroup SERVICES \brief Enable the Partial Content 206 responses for this service. * * The service will supports the Partial Content 206 responses if the icap client support it too. \param srv_xdata is a pointer to the c-icap internal service data. */ CI_DECLARE_FUNC(void) ci_service_enable_206(ci_service_xdata_t *srv_xdata); /** \ingroup SERVICES \brief Sets the maximum connection should opened by icap client to the c-icap for this service * \param srv_xdata is a pointer to the c-icap internal service data. \param max_connections is the maximum connections */ CI_DECLARE_FUNC(void) ci_service_set_max_connections(ci_service_xdata_t *srv_xdata, int max_connections); /** \ingroup SERVICES \brief Sets the Options ttl for this service * \param srv_xdata is a pointer to the c-icap internal service data. \param ttl is the ttl value in seconds */ CI_DECLARE_FUNC(void) ci_service_set_options_ttl(ci_service_xdata_t *srv_xdata, int ttl); CI_DECLARE_FUNC(void) ci_service_add_xincludes(ci_service_xdata_t *srv_xdata, char **xincludes); #ifdef __CI_COMPAT #define service_module_t ci_service_module_t #define service_extra_data_t ci_service_xdata_t /*The Old CI_X* defines*/ #define CI_XClientIP 1 #define CI_XServerIP 2 #define CI_XSubscriberID 4 #define CI_XAuthenticatedUser 8 #define CI_XAuthenticatedGroups 16 #endif #ifdef __cplusplus } #endif #endif c_icap-0.4.2/include/body.h0000664000175000017500000001577512567550776012452 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __BODY_H #define __BODY_H #include "c-icap.h" #include #include "util.h" #include "array.h" #ifdef __cplusplus extern "C" { #endif #define CI_MEMBUF_NULL_TERMINATED 0x01 #define CI_MEMBUF_HAS_EOF 0x02 #define CI_MEMBUF_RO 0x04 #define CI_MEMBUF_CONST 0x08 #define CI_MEMBUF_FOREIGN_BUF 0x10 /*Flags can be set by user: */ #define CI_MEMBUF_USER_FLAGS (CI_MEMBUF_NULL_TERMINATED | CI_MEMBUF_RO) #define CI_MEMBUF_FROM_CONTENT_FLAGS (CI_MEMBUF_NULL_TERMINATED | CI_MEMBUF_RO | CI_MEMBUF_CONST | CI_MEMBUF_HAS_EOF) typedef struct ci_membuf{ int endpos; int readpos; int bufsize; int unlocked; unsigned int flags; char *buf; ci_array_t *attributes; } ci_membuf_t; CI_DECLARE_FUNC(struct ci_membuf *) ci_membuf_new(); CI_DECLARE_FUNC(struct ci_membuf *) ci_membuf_new_sized(int size); CI_DECLARE_FUNC(struct ci_membuf *) ci_membuf_from_content(char *buf, size_t buf_size, size_t content_size, unsigned int flags); CI_DECLARE_FUNC(void) ci_membuf_free(struct ci_membuf *); CI_DECLARE_FUNC(int) ci_membuf_write(struct ci_membuf *body, const char *buf,int len, int iseof); CI_DECLARE_FUNC(int) ci_membuf_read(struct ci_membuf *body,char *buf,int len); CI_DECLARE_FUNC(int) ci_membuf_attr_add(struct ci_membuf *body,const char *attr, const void *val, size_t val_size); CI_DECLARE_FUNC(const void *) ci_membuf_attr_get(struct ci_membuf *body,const char *attr); CI_DECLARE_FUNC(int) ci_membuf_truncate(struct ci_membuf *body, int new_size); CI_DECLARE_FUNC(unsigned int) ci_membuf_set_flag(struct ci_membuf *body, unsigned int flag); #define ci_membuf_lock_all(body) ((body)->unlocked=0) #define ci_membuf_unlock(body, len) ((body)->unlocked=len) #define ci_membuf_unlock_all(body) ((body)->unlocked=-1) #define ci_membuf_size(body) ((body)->endpos) #define ci_membuf_flag(body, flag) ((body)->flags & flag) /*****************************************************************/ /* Cached file functions and structure */ #define CI_FILE_USELOCK 0x01 #define CI_FILE_HAS_EOF 0x02 #define CI_FILE_RING_MODE 0x04 typedef struct ci_cached_file{ ci_off_t endpos; ci_off_t readpos; int bufsize; int flags; ci_off_t unlocked; char *buf; int fd; char filename[CI_FILENAME_LEN+1]; ci_array_t *attributes; } ci_cached_file_t; CI_DECLARE_DATA extern int CI_BODY_MAX_MEM; CI_DECLARE_DATA extern char *CI_TMPDIR; CI_DECLARE_FUNC(ci_cached_file_t) * ci_cached_file_new(int size); CI_DECLARE_FUNC(void) ci_cached_file_destroy(ci_cached_file_t *); CI_DECLARE_FUNC(int) ci_cached_file_write(ci_cached_file_t *body, const char *buf,int len, int iseof); CI_DECLARE_FUNC(int) ci_cached_file_read(ci_cached_file_t *body,char *buf,int len); CI_DECLARE_FUNC(void) ci_cached_file_reset(ci_cached_file_t *body,int new_size); CI_DECLARE_FUNC(void) ci_cached_file_release(ci_cached_file_t *body); #define ci_cached_file_lock_all(body) (body->flags|=CI_FILE_USELOCK,body->unlocked=0) #define ci_cached_file_unlock(body, len) (body->unlocked=len) #define ci_cached_file_unlock_all(body) (body->flags&=~CI_FILE_USELOCK,body->unlocked=0) #define ci_cached_file_size(body) (body->endpos) #define ci_cached_file_ismem(body) (body->fd<0) #define ci_cached_file_read_pos(body) (body->readpos) #define ci_cached_file_haseof(body) (body->flags&CI_FILE_HAS_EOF) /*****************************************************************/ /* simple file function and structures */ typedef struct ci_simple_file{ ci_off_t endpos; ci_off_t readpos; ci_off_t max_store_size; ci_off_t bytes_in; ci_off_t bytes_out; unsigned int flags; ci_off_t unlocked; int fd; char filename[CI_FILENAME_LEN+1]; ci_array_t *attributes; #if defined(USE_POSIX_MAPPED_FILES) char *mmap_addr; ci_off_t mmap_size; #endif } ci_simple_file_t; CI_DECLARE_FUNC(ci_simple_file_t) * ci_simple_file_new(ci_off_t maxsize); CI_DECLARE_FUNC(ci_simple_file_t) * ci_simple_file_named_new(char *tmp,char*filename,ci_off_t maxsize); CI_DECLARE_FUNC(void) ci_simple_file_release(ci_simple_file_t *); CI_DECLARE_FUNC(void) ci_simple_file_destroy(ci_simple_file_t *body); CI_DECLARE_FUNC(int) ci_simple_file_write(ci_simple_file_t *body, const char *buf,int len, int iseof); CI_DECLARE_FUNC(int) ci_simple_file_read(ci_simple_file_t *body,char *buf,int len); CI_DECLARE_FUNC(int) ci_simple_file_truncate(ci_simple_file_t *body, ci_off_t new_size); #if defined(USE_POSIX_MAPPED_FILES) /*Currently it is just creates a MAP_PRIVATE memory. Only CI_MEMBUF_CONST flag is supported. */ CI_DECLARE_FUNC(ci_membuf_t *) ci_simple_file_to_membuf(ci_simple_file_t *body, unsigned int flags); CI_DECLARE_FUNC(const char *) ci_simple_file_to_const_string(ci_simple_file_t *body); #endif #define ci_simple_file_lock_all(body) (body->flags|=CI_FILE_USELOCK,body->unlocked=0) #define ci_simple_file_unlock(body, len) (body->unlocked=len) #define ci_simple_file_unlock_all(body) (body->flags&=~CI_FILE_USELOCK,body->unlocked=0) #define ci_simple_file_size(body) (body->endpos) #define ci_simple_file_haseof(body) (body->flags&CI_FILE_HAS_EOF) /*******************************************************************/ /*ring memory buffer functions and structures */ typedef struct ci_ring_buf { char *buf; char *end_buf; char *read_pos; char *write_pos; int full; } ci_ring_buf_t; CI_DECLARE_FUNC(struct ci_ring_buf *) ci_ring_buf_new(int size); CI_DECLARE_FUNC(void) ci_ring_buf_destroy(struct ci_ring_buf *buf); CI_DECLARE_FUNC(int) ci_ring_buf_write(struct ci_ring_buf *buf, const char *data,int size); CI_DECLARE_FUNC(int) ci_ring_buf_read(struct ci_ring_buf *buf, char *data,int size); /*low level functions for ci_ring_buf*/ CI_DECLARE_FUNC(int) ci_ring_buf_write_block(struct ci_ring_buf *buf, char **wb, int *len); CI_DECLARE_FUNC(int) ci_ring_buf_read_block(struct ci_ring_buf *buf, char **rb, int *len); CI_DECLARE_FUNC(void) ci_ring_buf_consume(struct ci_ring_buf *buf, int len); CI_DECLARE_FUNC(void) ci_ring_buf_produce(struct ci_ring_buf *buf, int len); #ifdef __cplusplus } #endif #endif c_icap-0.4.2/include/proc_threads_queues.h0000664000175000017500000000661612567550776015553 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef _PROC_THREADS_QUEUES_H #define _PROC_THREADS_QUEUES_H #include "net_io.h" #include "ci_threads.h" #include "proc_mutex.h" #include "shared_mem.h" #include "stats.h" #ifdef __cplusplus extern "C" { #endif enum KILL_MODE {NO_KILL=0,GRACEFULLY,IMMEDIATELY}; #ifdef _WIN32 #define process_pid_t HANDLE #define ci_pipe_t HANDLE #else #define process_pid_t int #define ci_pipe_t int #endif struct connections_queue{ ci_connection_t *connections; int used; int size; ci_thread_mutex_t queue_mtx; ci_thread_mutex_t cond_mtx; ci_thread_cond_t queue_cond; }; typedef struct child_shared_data{ int freeservers; int usedservers; int requests; int connections; process_pid_t pid; int idle; int to_be_killed; int father_said; ci_pipe_t pipe; struct stat_memblock *stats; int stats_size; } child_shared_data_t; struct server_statistics { unsigned int started_childs; unsigned int closed_childs; unsigned int crashed_childs; }; struct childs_queue{ child_shared_data_t *childs; int size; int shared_mem_size; int stats_block_size; void *stats_area; struct stat_memblock *stats_history; ci_shared_mem_id_t shmid; ci_proc_mutex_t queue_mtx; struct server_statistics *srv_stats; }; struct connections_queue *init_queue(int size); void destroy_queue(struct connections_queue *q); int put_to_queue(struct connections_queue *q,ci_connection_t *con); int get_from_queue(struct connections_queue *q, ci_connection_t *con); int wait_for_queue(struct connections_queue *q); #define connections_pending(q) (q->used) int create_childs_queue(struct childs_queue *q, int size); int destroy_childs_queue(struct childs_queue *q); void announce_child(struct childs_queue *q, process_pid_t pid); int attach_childs_queue(struct childs_queue *q); int dettach_childs_queue(struct childs_queue *q); int childs_queue_is_empty(struct childs_queue *q); child_shared_data_t *get_child_data(struct childs_queue *q, process_pid_t pid); child_shared_data_t *register_child(struct childs_queue *q, process_pid_t pid, int maxservers, ci_pipe_t pipe ); int remove_child(struct childs_queue *q, process_pid_t pid, int status); int find_a_child_to_be_killed(struct childs_queue *q); int find_a_child_nrequests(struct childs_queue *q,int max_requests); int find_an_idle_child(struct childs_queue *q); int childs_queue_stats(struct childs_queue *q, int *childs, int *freeservers, int *used, int *maxrequests); void dump_queue_statistics(struct childs_queue *q); #ifdef __cplusplus } #endif #endif c_icap-0.4.2/include/log.h0000664000175000017500000000242212567550777012260 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __LOG_H #define __LOG_H #include "request.h" #ifdef __cplusplus extern "C" { #endif int log_open(); void log_close(); void log_reset(); void log_flush(); void log_access(ci_request_t *req,int status); void log_server(ci_request_t *req, const char *format, ... ); void vlog_server(ci_request_t *req, const char *format, va_list ap); /* The followings can be used by modules */ CI_DECLARE_FUNC(char *) logformat_fmt(const char *name); #ifdef __cplusplus } #endif #endif c_icap-0.4.2/include/lookup_table.h0000664000175000017500000001117512567550776014163 00000000000000/* * Copyright (C) 2004-2009 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __LOOKUP_TABLE_H #define __LOOKUP_TABLE_H #include "c-icap.h" #include "mem.h" #include "types_ops.h" #include "array.h" #ifdef __cplusplus extern "C" { #endif /** \defgroup LOOKUPTABLE Lookup tables api \ingroup API \brief Macros, functions and structures used to implement and use lookup tables * * Lookup tables can considered as simple read only databases where the user can * search a set of values using a key */ struct ci_lookup_table; struct ci_lookup_table_type { void *(*open)(struct ci_lookup_table *table); void (*close)(struct ci_lookup_table *table); void *(*search)(struct ci_lookup_table *table, void *key, void ***vals); void (*release_result)(struct ci_lookup_table *table_data, void **val); const void * (*get_row)(struct ci_lookup_table *table, const void *key, const char *columns[], void ***vals); char *type; }; /** * \brief The lookup table struct * \ingroup LOOKUPTABLE */ struct ci_lookup_table { void *(*open)(struct ci_lookup_table *table); void (*close)(struct ci_lookup_table *table); void *(*search)(struct ci_lookup_table *table, void *key, void ***vals); void (*release_result)(struct ci_lookup_table *table, void **val); const void * (*get_row)(struct ci_lookup_table *table, const void *key, const char *columns[], void ***vals); char *type; char *path; char *args; int cols; ci_str_vector_t *col_names; const ci_type_ops_t *key_ops; const ci_type_ops_t *val_ops; ci_mem_allocator_t *allocator; const struct ci_lookup_table_type *_lt_type; void *data; }; CI_DECLARE_FUNC(struct ci_lookup_table_type *) ci_lookup_table_type_register(struct ci_lookup_table_type *lt_type); CI_DECLARE_FUNC(void) ci_lookup_table_type_unregister(struct ci_lookup_table_type *lt_type); CI_DECLARE_FUNC(const struct ci_lookup_table_type *) ci_lookup_table_type_search(const char *type); /** * \brief Create a lookup table * \ingroup LOOKUPTABLE * \param table The path of the lookup table (eg file:/etc/c-icap/users.txt or ldap://hostname/o=base?cn,uid?uid=chtsanti) \return A pointer to a lookup table object */ CI_DECLARE_FUNC(struct ci_lookup_table *) ci_lookup_table_create(const char *table); /** * \brief Destroy a lookup table. * \ingroup LOOKUPTABLE * \param lt Pointer to the lookup table will be destroyed. */ CI_DECLARE_FUNC(void) ci_lookup_table_destroy(struct ci_lookup_table *lt); /** * \brief Initializes the lookup table. * * \param table The lookup table object */ CI_DECLARE_FUNC(void *) ci_lookup_table_open(struct ci_lookup_table *table); /** * \brief Search for an object in the lookup table which matches a key. * * \param table The lookup table object * \param key The key value to search for * \param vals In this variable stored a 2d array which contains the return values * \return NULL if none object matches, pointer to the object key value. */ CI_DECLARE_FUNC(const char *) ci_lookup_table_search(struct ci_lookup_table *table, const char *key, char ***vals); /** * \brief Releases the data values returned from the search method. * * \param table The lookup table object * \param val The 2d array returned from the search method */ CI_DECLARE_FUNC(void) ci_lookup_table_release_result(struct ci_lookup_table *table, void **val); /** * \brief Search for an object in the lookup table which supports named columns. * * \param table The lookup table object * \param key The key value to search for * \param columns NULL terminated array with the names of the columns to retrieve. * \param vals In this variable stored a 2d array which contains the requested row * \return NULL if none object matches, pointer to the object key value. */ CI_DECLARE_FUNC(const char *) ci_lookup_table_get_row(struct ci_lookup_table *table, const char *key, const char *columns[], char ***vals); #ifdef __cplusplus } #endif #endif c_icap-0.4.2/include/simple_api.h0000664000175000017500000003701712567550776013630 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __SIMPLE_API_H #define __SIMPLE_API_H #include "c-icap.h" #include "request.h" #ifdef __cplusplus extern "C" { #endif /** \defgroup HTTP API for HTTP object manipulation \ingroup API * Macros, functions and structures used for manipulating the encupsulated HTTP objects * (HTTP requests or HTTP responses). */ /** \defgroup UTILITY utility funtions \ingroup API * Utility functions */ /*The following defines are request related and should be moved to request.h include file*/ /** \def ci_req_lock_data(ci_request_t) \ingroup REQUEST * Lock a ci_request_t object. After called the c-icap server stops sending body data * to the ICAP client. \param req is pointer to an object of type ci_request_t */ #define ci_req_lock_data(req) ((req)->data_locked=1) /** \def ci_req_unlock_data(ci_request_t) \ingroup REQUEST * Unlock a ci_request_t object. When called the c-icap server will start sending body data * to the ICAP client. \param req is pointer to an object of type ci_request_t */ #define ci_req_unlock_data(req) ((req)->data_locked=0) /** \def ci_req_hasbody(ci_request_t) \ingroup REQUEST \param req is pointer to an object of type ci_request_t \return true (non zero int) if the ICAP request contains body data else zero */ #define ci_req_hasbody(req) ((req)->hasbody) /** \def ci_req_type(ci_request_t) \ingroup REQUEST \return ICAP_OPTIONS, ICAP_REQMOD or ICAP_RESPMOD if the ICAP request is options, * request modification or response modification ICAP request */ #define ci_req_type(req) ((req)->type) /** \def ci_req_preview_size(ci_request_t) \ingroup REQUEST \param req is pointer to an object of type ci_request_t \return The ICAP preview size */ #define ci_req_preview_size(req) ((req)->preview) /*The preview data size*/ /** \def ci_req_allow204(ci_request_t) \ingroup REQUEST \param req is pointer to an object of type ci_request_t \return True (non zero int) if the ICAP request supports "Allow 204" */ #define ci_req_allow204(req) ((req)->allow204) /** \def ci_req_allow206(ci_request_t) \ingroup REQUEST \param req is pointer to an object of type ci_request_t \return True (non zero int) if the ICAP request supports "Allow 206" */ #define ci_req_allow206(req) ((req)->allow206) /** \def ci_req_allow206_outside_preview(ci_request_t) \ingroup REQUEST \param req is pointer to an object of type ci_request_t \return True (non zero int) if the ICAP request supports "Allow 206" outside preview requests */ #define ci_req_allow206_outside_preview(req) ((req)->allow206 && (req)->allow204) /** \def ci_req_sent_data(ci_request_t) \ingroup REQUEST \param req is pointer to an object of type ci_request_t \return True (non zero int) if the c-icap server has send data to the client */ #define ci_req_sent_data(req)((req)->status) /** \def ci_req_hasalldata(ci_request_t) \ingroup REQUEST \param req is pointer to an object of type ci_request_t \return True (non zero int) if the ICAP client has sent all the data (headers and body data) * to the ICAP server */ #define ci_req_hasalldata(req)((req)->eof_received) /** * Decodes a base64 encoded string. \ingroup UTILITY * \param str is a buffer which holds the base64 encoded data \param result is a buffer where the decoded data will be stored \param len is the length of the result buffer \return the number of decoded bytes */ CI_DECLARE_FUNC(int) ci_base64_decode(const char *str,char *result,int len); /** * Produces a base64 encoded string. \ingroup UTILITY * \param data is a buffer which holds the data to be encoded \param datalen is the length of the data buffer \param out is a buffer where the encoded data will be stored \param outlen is the length of the out buffer \return the number of decoded bytes */ CI_DECLARE_FUNC(int) ci_base64_encode(const unsigned char *data, size_t datalen, char *out, size_t outlen); enum { CI_ENCODE_NONE=0, CI_ENCODE_GZIP, CI_ENCODE_DEFLATE, CI_ENCODE_BZIP2, CI_ENCODE_UNKNOWN }; /** * Uncompress a zipped string. \ingroup UTILITY * \param compress_method CI_ENCODE_GZIP, CI_ENCODED_DEFLATE or CI_CI_ENCODE_BZIP2 \param buf is a buffer which holds the zipped data \param len is the length of the buffer buf \param unzipped_buf is the buffer where to store unzipped data \param unzipped_buf_len is the length of the buffer to store unzipped data, and updated with the length of unzipped data \return CI_OK on success CI_ERROR on error */ CI_DECLARE_FUNC(int) ci_uncompress_preview(int compress_method, const char *buf, int len, char *unzipped_buf, int *unzipped_buf_len); /** * Decodes a base64 encoded string, and also allocate memory for the result. \ingroup UTILITY * \param str is a buffer which holds the base64 encoded data \return a pointer to the decoded string. It uses malloc to allocate space for the * decoded string so the free function should used to release allocated memory. */ CI_DECLARE_FUNC(char *) ci_base64_decode_dup(const char *str); /** */ /** * Returns the HTTP response headers. \ingroup HTTP * * This function is only valid for an ICAP responce modification request. If the ICAP request is not * responce modification ICAP request or there are not response headers (HTTP 0.9) * the function returns NULL. \param req A pointer to the current ICAP request object. \return Pointer to the HTTP response headers or NULL. */ CI_DECLARE_FUNC(ci_headers_list_t *) ci_http_response_headers(ci_request_t *req); /** \ingroup HTTP \brief Returns the HTTP request headers. * * This function can used for an responce or request modification ICAP request to get * the HTTP request headers \param req is a pointer to the current ICAP request object. \return Pointer to the HTTP request headers or NULL if fails. */ CI_DECLARE_FUNC(ci_headers_list_t *) ci_http_request_headers(ci_request_t *req); /** \ingroup HTTP \brief Add a custom header to the HTTP response headers. * * This function can used to add custom headers to the HTTP response and can be used only * for response modification ICAP requests \param req is a pointer to the current ICAP request object. \param header is a string contains the header in the form "Header: value" \return Pointer to the header or NULL if fails. */ CI_DECLARE_FUNC(const char *) ci_http_response_add_header(ci_request_t *req,const char *header); /** \ingroup HTTP \brief Add a custom header to the HTTP request headers. * * This function can used to add custom headers to the HTTP request and can be used only * for request modification ICAP requests \param req is a pointer to the current ICAP request object. \param header is a string contains the header in the form "Header: value" \return Pointer to the header or NULL if fails. */ CI_DECLARE_FUNC(const char *) ci_http_request_add_header(ci_request_t *req,const char *header); /** \ingroup HTTP \brief Remove a header from the HTTP response headers. * * This function can used to remove a header from the HTTP response and can be used only * for response modification ICAP requests \param req is a pointer to the current ICAP request object. \param header is a string contains the header name \return Non zero if success or zero otherwise */ CI_DECLARE_FUNC(int) ci_http_response_remove_header(ci_request_t *req, const char *header); /** \ingroup HTTP \brief Remove a header from the HTTP request headers. * * This function can used to remove a header from the HTTP request and can be used only * for request modification ICAP requests \param req is a pointer to the current ICAP request object. \param header is a string contains the header name \return Non zero if success or zero otherwise */ CI_DECLARE_FUNC(int) ci_http_request_remove_header(ci_request_t *req, const char *header); /** \ingroup HTTP \brief Get the value of the requested header from the HTTP response headers. * * This function can used to get the value of a header from the HTTP response headers. It can be used only * for response modification ICAP requests \param req is a pointer to the current ICAP request object. \param head_name is a string contains the header name \return A string with the header value on success NULL otherwise */ CI_DECLARE_FUNC(const char *) ci_http_response_get_header(ci_request_t *req, const char *head_name); /** \ingroup HTTP \brief Get the value of the requested header from the HTTP request headers. * * This function can used to get the value of a header from the HTTP request headers. It can be used * on both request and response modification ICAP requests. \param req is a pointer to the current ICAP request object. \param head_name is a string contains the header name \return A string with the header value on success NULL otherwise */ CI_DECLARE_FUNC(const char *) ci_http_request_get_header(ci_request_t *req, const char *head_name); /** \ingroup HTTP \brief Completelly erase and initialize the HTTP response headers. * * This function is usefull when the full rewrite of the HTTP response required. After this function called, * the HTTP response should filled with new HTTP headers, before send back to the ICAP client. * An example of usage of this function is in antivirus service when a virus detected in HTTP response, * so the service blocks the response and sends a new HTTP object (a new html page, with HTTP headers) * informing the user about the virus. * It can be used with response modification ICAP requests. \param req is a pointer to the current ICAP request object. \return non zero on success zero otherwise */ CI_DECLARE_FUNC(int) ci_http_response_reset_headers(ci_request_t *req); /** \ingroup HTTP \brief Completelly erase and initialize the HTTP request headers. * * This function is usefull when an HTTP request required should replaced by an other.After this function called, * the HTTP request should filled with new HTTP headers, before send back to the ICAP client. * It can be used to implement a HTTP redirector. * It can be used with request modification ICAP requests. \param req is a pointer to the current ICAP request object. \return non zero on success zero otherwise */ CI_DECLARE_FUNC(int) ci_http_request_reset_headers(ci_request_t *req); /** \ingroup HTTP \brief Creates a new HTTP response. * * This function is usefull when the service wants to respond with a self created message to a response or * request modification ICAP request. * It can be used with both request and response modification ICAP requests. \param req is a pointer to the current ICAP request object. \param has_reshdr if it is non zero the HTTP response contrains HTTP headers (a non HTTP 0.9 response) \param has_body if it is non zero the HTTP response contains HTTP body data \return non zero on success zero otherwise */ CI_DECLARE_FUNC(int) ci_http_response_create(ci_request_t *req, int has_reshdr ,int has_body); /** \ingroup HTTP \brief Creates a new HTTP request. * * This function is usefull to develop icap clients \param req is a pointer to the current ICAP request object. \param has_body if it is non zero the HTTP request contains HTTP body data \return non zero on success zero otherwise */ CI_DECLARE_FUNC(int) ci_http_request_create(ci_request_t * req, int has_body); /** \ingroup HTTP \brief Returns the value of the Content-Length header of the HTTP response or HTTP request for a * response modification or request modification ICAP requests respectively. * * If the header Content-Length is not included in HTTP response * It can be used with both request and response modification ICAP requests. \param req is a pointer to the current ICAP request object. \return The content length on success or a negative number otherwise */ CI_DECLARE_FUNC(ci_off_t) ci_http_content_length(ci_request_t *req); /** \ingroup HTTP \brief Returns the request line (e.g "GET /index.html HTTP 1.0") from http request headers * * It can be used with both request and response modification ICAP requests. \param req is a pointer to the current ICAP request object. \return The request line in success or NULL otherwise */ CI_DECLARE_FUNC(const char *) ci_http_request(ci_request_t *req); /** \ingroup HTTP \brief Returns the URL (e.g "http://www.chtsanti.net") from http request * * It can be used with both request and response modification ICAP requests. \param req is a pointer to the current ICAP request object. \param buf a buffer to store the url \param buf_size the "buf" buffer size \return The bytes written to the "buf" buffer */ CI_DECLARE_FUNC(int) ci_http_request_url(ci_request_t * req, char *buf, int buf_size); /** \ingroup HTTP \brief Return the http client ip address if this information is available \param req is a pointer to the current ICAP request object. \return A const pointer to a ci_ip_t object contain the client ip address or NULL */ CI_DECLARE_FUNC(const ci_ip_t *) ci_http_client_ip(ci_request_t * req); /** \ingroup REQUEST \brief Add an icap X-header to the icap response headers * * It can be used with both request and response modification ICAP requests. \param req is a pointer to the current ICAP request object. \param header is the header to add in the form "Header: Value" \return pointer to the header in success or NULL otherwise */ CI_DECLARE_FUNC(const char *) ci_icap_add_xheader(ci_request_t *req, const char *header); /** \ingroup REQUEST \brief Append the icap X-headers to the icap response headers * * It can be used with both request and response modification ICAP requests. \param req is a pointer to the current ICAP request object. \param headers is a pointer to the headers object to add \return pointer to the header in success or NULL otherwise */ CI_DECLARE_FUNC(int) ci_icap_append_xheaders(ci_request_t *req,ci_headers_list_t *headers); #ifdef __CI_COMPAT #define ci_respmod_headers ci_http_response_headers #define ci_reqmod_headers ci_http_request_headers #define ci_respmod_add_header ci_http_response_add_header #define ci_reqmod_add_header ci_http_request_add_header #define ci_respmod_remove_header ci_http_response_remove_header #define ci_reqmod_remove_header ci_http_request_remove_header #define ci_respmod_get_header ci_http_response_get_header #define ci_reqmod_get_header ci_http_request_get_header #define ci_respmod_reset_headers ci_http_response_reset_headers #define ci_reqmod_reset_headers ci_http_request_reset_headers #define ci_request_create_respmod ci_http_response_create #define ci_content_lenght ci_http_content_length #define ci_request_add_xheader ci_icap_add_xheader #endif #ifdef __cplusplus } #endif #endif c_icap-0.4.2/include/txt_format.h0000664000175000017500000000453612567550777013676 00000000000000/* * Copyright (C) 2004-2009 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __TXT_FORMAT_H #define __TXT_FORMAT_H #include "request.h" #ifdef __cplusplus extern "C" { #endif /** * \defgroup FORMATING Text formating api * \ingroup API * Functions and structures used for text formating */ /** * \brief This structure used to implement text formating directives * \ingroup FORMATING */ struct ci_fmt_entry { /** * \brief The formating directive (eg "%a") */ const char *directive; /** * \brief A short description */ const char *description; /** * \brief Pointer to the function which implements the text formating for this directive * \param req_data Pointer to the current request structure * \param buf The output buffer * \param len The length of the buffer * \param param Parameter of the directive * \return Non zero on success, zero on error */ int (*format)(ci_request_t *req_data, char *buf, int len, const char *param); }; /** * \brief Produces formated text based on template text. * \ingroup FORMATING * \param req_data The current request * \param fmt The format string * \param buffer The output buffer * \param len The length of the output buffer * \param user_table An array of user defined directives * \return Non zero on success, zero on error * * This function uses the internal formating directives table. Also the user can define his own table. */ CI_DECLARE_FUNC(int) ci_format_text(ci_request_t *req_data, const char *fmt, char *buffer, int len, struct ci_fmt_entry *user_table); #ifdef __cplusplus } #endif #endif c_icap-0.4.2/include/c-icap.h0000664000175000017500000001202112567550776012626 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __C_ICAP_H #define __C_ICAP_H #if defined (_MSC_VER) #include "c-icap-conf-w32.h" #else #include "c-icap-conf.h" #endif #ifdef __SYS_TYPES_H_EXISTS #include #endif #ifdef __INTTYPES_H_EXISTS #include #endif /*some defines */ #ifdef _WIN32 # define CI_FILENAME_LEN _MAX_PATH # define CI_MAX_PATH _MAX_PATH #else # if defined(MAXPATHLEN) # define CI_MAX_PATH MAXPATHLEN # elif defined(PATH_MAX) # define CI_MAX_PATH PATH_MAX # else # define CI_MAX_PATH 4096 # endif # define CI_FILENAME_LEN CI_MAX_PATH #endif #ifdef _WIN32 # if defined(CI_BUILD_LIB) # define CI_DECLARE_FUNC(type) __declspec(dllexport) type # define CI_DECLARE_DATA __declspec(dllexport) # else # define CI_DECLARE_FUNC(type) __declspec(dllimport) type # define CI_DECLARE_DATA __declspec(dllimport) # endif # if defined (CI_BUILD_MODULE) # define CI_DECLARE_MOD_DATA __declspec(dllexport) # define CI_DECLARE_MOD_FUNC(type) __declspec(dllexport) type # endif #else /* */ #if defined (USE_VISIBILITY_ATTRIBUTE) #define CI_DECLARE_FUNC(type) __attribute__ ((visibility ("default"))) type #define CI_DECLARE_DATA __attribute__ ((visibility ("default"))) #define CI_DECLARE_MOD_DATA __attribute__ ((visibility ("default"))) #else #define CI_DECLARE_FUNC(type) type #define CI_DECLARE_DATA #define CI_DECLARE_MOD_DATA #endif #endif /* Here we are define the ci_off_t type to support large files We must be careful here, the off_t type is unsigned integer. -A comment about lfs: In Solaris and Linux to have lfs support, if you are using only lseek and open function, you are using off_t type for offsets and compile the program with -D_FILE_OFFSET_BITS=64. This flag forces the compiler to typedefs the off_t type as an 64bit integer, uses open64, lseek64, mkstemp64 and fopen64 functions. Instead for fseek and ftell the functions fseeko and ftello must be used. This functions uses off_t argument's instead of long. Currently we are not using fseek and ftell in c-icap. The open's manual page says that the flag O_LARGEFILE must be used. Looks that it does not actually needed for linux and solaris (version 10) (but must be checked again......) The off_t type in my linux system is a signed integer, but I am not sure if it is true for all operating systems */ typedef off_t ci_off_t; #if CI_SIZEOF_OFF_T > 4 # define PRINTF_OFF_T "lld" # define CAST_OFF_T long long int # define ci_strto_off_t strtoll # define CI_STRTO_OFF_T_MAX LLONG_MAX # define CI_STRTO_OFF_T_MIN LLONG_MIN #else # define PRINTF_OFF_T "ld" # define CAST_OFF_T long int # define ci_strto_off_t strtol # define CI_STRTO_OFF_T_MAX LONG_MAX # define CI_STRTO_OFF_T_MIN LONG_MIN #endif /* Detect n-bytes alignment. Old 8 bytes alignment macro: #define _CI_ALIGN(val) ((val+7)&~7) */ struct _ci_align_test {char n[1]; double d;}; #define _CI_NBYTES_ALIGNMENT ((size_t) &(((struct _ci_align_test *)0)[0].d)) #define _CI_ALIGN(val) ((val+(_CI_NBYTES_ALIGNMENT - 1))&~(_CI_NBYTES_ALIGNMENT - 1)) #define ICAP_OPTIONS 0x01 #define ICAP_REQMOD 0x02 #define ICAP_RESPMOD 0x04 CI_DECLARE_DATA extern const char *ci_methods[]; #define ci_method_support(METHOD, METHOD_DEF) (METHOD&METHOD_DEF) #define ci_method_string(method) (method<=ICAP_RESPMOD && method>=ICAP_OPTIONS ?ci_methods[method]:"UNKNOWN") enum ci_error_codes { EC_100, EC_200, EC_204, EC_206, EC_400, EC_401, EC_403, EC_404, EC_405, EC_407, EC_408, EC_500, EC_501, EC_502, EC_503, EC_505, EC_MAX }; typedef struct ci_error_code{ int code; char *str; } ci_error_code_t; CI_DECLARE_DATA extern const struct ci_error_code ci_error_codes[]; #define ci_error_code(ec) (ec>=EC_100&&ec=EC_100&&ectypes_num:0) #define ci_magic_groups_num(db)(db!=NULL?db->groups_num:0) #define ci_data_type_name(db,i)(db!=NULL?db->types[i].name:NULL) #define ci_data_type_groups(db,i)(db!=NULL && i< db->types_num && i >=0?db->types[i].groups:NULL) #define ci_data_type_descr(db,i)(db!=NULL && i< db->types_num && i >=0?db->types[i].descr:NULL) #define ci_data_group_name(db,i)(db!=NULL && i< db->groups_num && i >=0?db->groups[i].name:NULL) enum {CI_ASCII_DATA,CI_ISO8859_DATA,CI_XASCII_DATA,CI_UTF_DATA,CI_HTML_DATA,CI_BIN_DATA}; enum {CI_TEXT_DATA,CI_OCTET_DATA}; /*low level functions should not used by users*/ CI_DECLARE_FUNC(struct ci_magics_db) *ci_magics_db_build(const char *filename); CI_DECLARE_FUNC(int) ci_magics_db_file_add(struct ci_magics_db *db,const char *filename); CI_DECLARE_FUNC(int) ci_get_data_type_id(struct ci_magics_db *db,const char *name); CI_DECLARE_FUNC(int) ci_get_data_group_id(struct ci_magics_db *db,const char *group); CI_DECLARE_FUNC(int) ci_belongs_to_group(struct ci_magics_db *db, int type, int group); CI_DECLARE_FUNC(int) ci_filetype(struct ci_magics_db *db,const char *buf, int buflen); CI_DECLARE_FUNC(int) ci_extend_filetype(struct ci_magics_db *db, ci_request_t *req, const char *buf,int len,int *iscompressed); /*And the c-icap Library functions*/ /** * Read the magics db from a file and create a ci_magics_db object. * \ingroup DATATYPE * * The user normaly does not need to call this function inside c-icap server. * It is not a thread safe function, should called only during icap library * initialization before threads started. \param filename is the name of the file contains the db \return a pointer to a ci_magics_db object */ CI_DECLARE_FUNC(struct ci_magics_db) *ci_magic_db_load(const char *filename); CI_DECLARE_FUNC(void) ci_magic_db_free(); /** * Return the type of data of an c-icap request object. * \ingroup DATATYPE * * This function checks the preview data of the request. * If the data are encoded this function try to uncompress them before * data type recognition * \param req the c-icap request (ci_request_t) data \param isencoded set to CI_ENCODE_GZIP, CI_ENCODE_DEFLATE or * CI_ENCODE_UNKNOWN if the data are encoded with an unknown method \return the data type or -1 if the data type recognition fails for a reason * (eg no preview data, of library not initialized) */ CI_DECLARE_FUNC(int) ci_magic_req_data_type(ci_request_t *req, int *isencoded); CI_DECLARE_FUNC(int) ci_magic_data_type(const char *buf, int buflen); CI_DECLARE_FUNC(int) ci_magic_data_type_ext(ci_headers_list_t *headers, const char *buf,int len,int *iscompressed); /** * Finds the type id from type name. * \ingroup DATATYPE * \param name is the name of the magic type \return the type id */ CI_DECLARE_FUNC(int) ci_magic_type_id(const char *name); /** * Finds the group id from group name. * \ingroup DATATYPE * \param group is the name of the group \return the group id */ CI_DECLARE_FUNC(int) ci_magic_group_id(const char *group); /** * Checks if a magic type belongs to a magic types group. * \ingroup DATATYPE * \param type is the type id to check \param group is the group id \return non zero if the type belongs to group, zero otherwise */ CI_DECLARE_FUNC(int) ci_magic_group_check(int type, int group); /** * The number of types stored in internal magic db. * \ingroup DATATYPE * \return the number of stored magic types */ CI_DECLARE_FUNC(int) ci_magic_types_count(); /** * The number of groups stored in internal magic db. * \ingroup DATATYPE * \return the number of stored magic groups */ CI_DECLARE_FUNC(int) ci_magic_groups_count(); /** * Retrieve the name of a magic type. * \ingroup DATATYPE * \param type the type id \return the name of the type or NULL if the type does not exists */ CI_DECLARE_FUNC(char *) ci_magic_type_name(int type); /** * Retrieve the short description of a magic type. * \ingroup DATATYPE * \param type the type id \return the short description if the type or NULL if the type does not exists */ CI_DECLARE_FUNC(char *) ci_magic_type_descr(int type); /** * Retrieve the name of a magic types group. * \ingroup DATATYPE * \param group the group id \return the name of the group or NULL if the group does not exists */ CI_DECLARE_FUNC(char *) ci_magic_group_name(int group); #ifdef __cplusplus } #endif #endif c_icap-0.4.2/include/array.h0000664000175000017500000006303712567550776012625 00000000000000/* * Copyright (C) 2011 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __ARRAY_H #define __ARRAY_H #include "c-icap.h" #include "mem.h" #ifdef __cplusplus extern "C" { #endif /** \defgroup ARRAYS Arrays, stacks, queues and vectors related API \ingroup API * Arrays, stacks, queues and vectors related API. */ typedef struct ci_array_item{ char *name; void *value; } ci_array_item_t; /** \defgroup SIMPLE_ARRAYS Simple arrays related API \ingroup ARRAYS * Arrays which store name/value pair items */ /** \typedef ci_array_t \ingroup SIMPLE_ARRAYS * The ci_array_t objects can store a list of name/value pairs. Currently * can grow up to a fixed size. */ typedef struct ci_array { ci_array_item_t *items; char *mem; size_t max_size; unsigned int count; ci_mem_allocator_t *alloc; } ci_array_t; /** \def ci_array_value(array, pos) \ingroup SIMPLE_ARRAYS * Return the value of item on position 'pos' */ #define ci_array_value(array, pos) (pos < (array)->count ? (array)->items[pos].value : NULL) /** \def ci_array_name(array, pos) \ingroup SIMPLE_ARRAYS * Return the name of item on position 'pos' */ #define ci_array_name(array, pos) (pos < (array)->count ? (array)->items[pos].name : NULL) /** \def ci_array_size(array) \ingroup SIMPLE_ARRAYS * Return the size of array 'array' */ #define ci_array_size(array) ((array)->count) /** * Allocate the required memory and initialize an ci_array_t object \ingroup SIMPLE_ARRAYS \param max_mem_size the maximum memory to use \return the allocated object on success, or NULL on failure * */ CI_DECLARE_FUNC(ci_array_t *) ci_array_new(size_t max_mem_size); /** * Create and initialize an ci_array_t object for the given number of items \ingroup SIMPLE_ARRAYS \param items the maximum aray items \param item_size the items size \return the allocated object on success, or NULL on failure */ CI_DECLARE_FUNC(ci_array_t *) ci_array_new2(size_t items, size_t item_size); /** * Destroy an ci_array_t object \ingroup SIMPLE_ARRAYS \param array a pointer to ci_array_t object to be destroyed * */ CI_DECLARE_FUNC(void) ci_array_destroy(ci_array_t *array); /** * Add an name/value pair item to the array. \ingroup SIMPLE_ARRAYS \param array a pointer to the ci_array_t object \param name the name part of the name/value pair item to add \param value the value part of the name/value pair item to add \param size the size of the value part of the new item. \return a pointer to the new array item on success, NULL otherwise */ CI_DECLARE_FUNC(const ci_array_item_t *) ci_array_add(ci_array_t *array, const char *name, const void *value, size_t size); /** * Delete the last element of the array. \ingroup SIMPLE_ARRAYS \param array a pointer to the ci_array_t object \return a pointer to the popped array item on success, NULL otherwise */ CI_DECLARE_FUNC(const ci_array_item_t *)ci_array_pop(ci_array_t *array); /** * Search in an array for an item with the given name \ingroup SIMPLE_ARRAYS \param array a pointer to the ci_array_t object \param name the item to be search for. \return pointer to the value pair of the array item if found, NULL otherwise */ CI_DECLARE_FUNC(const void *) ci_array_search(ci_array_t *array, const char *name); /** * Run the given function for each array item \ingroup SIMPLE_ARRAYS \param array a pointer to the ci_array_t object \param data a pointer to data which will be passed on fn function \param fn a pointer to the function which will be run for each array item. The iteration will stop if the fn function return non zero value */ CI_DECLARE_FUNC(void) ci_array_iterate(const ci_array_t *array, void *data, int (*fn)(void *data, const char *name, const void *)); /** * Get an item of the array. \ingroup SIMPLE_ARRAYS \param array a pointer to the ci_array_t object \param pos The position of the item in array \return a pointer to the array item on success, NULL otherwise */ CI_DECLARE_FUNC(const ci_array_item_t *)ci_array_get_item(ci_array_t *array, int pos); /** \defgroup STR_ARRAYS Arrays of strings related API \ingroup SIMPLE_ARRAYS * Arrays which store name/value pair items */ /** \typedef ci_str_array_t \ingroup STR_ARRAYS * An alias to the ci_array_t object. It is used to store items with string * values to an array. * The ci_str_array_new, ci_str_array_destroy, ci_str_array_add, ci_str_array_search * and ci_str_array_iterate defines are similar to the equivalent ci_array_* * functions with the required typecasting to work with strings. */ typedef ci_array_t ci_str_array_t; #define ci_str_array_new ci_array_new #define ci_str_array_destroy ci_array_destroy #define ci_str_array_add(array, name, value) ci_array_add(array, name, value, (strlen(value)+1)) #define ci_str_array_pop(array) ci_array_pop(array) #define ci_str_array_get_item(array, pos) ci_array_get_item(array, pos) #define ci_str_array_search(array, name) (const char *)ci_array_search(array, name) #define ci_str_array_iterate ci_array_iterate #define ci_str_array_value(array, pos) ci_array_value(array, pos) #define ci_str_array_name(array, pos) ci_array_name(array, pos) #define ci_str_array_size(array) ci_array_size(array) /** \defgroup PTR_ARRAYS Arrays of pointers \ingroup SIMPLE_ARRAYS * Arrays of name/pointers to objects pairs */ /** \typedef ci_ptr_array_t \ingroup PTR_ARRAYS * The ci_ptr_array_t objects can store a list of name and pointer to object * pairs. It is similar to the ci_array_t object but does not store the value * but a pointer to the value. */ typedef ci_array_t ci_ptr_array_t; /** \def ci_ptr_array_value(ptr_array, pos) \ingroup PTR_ARRAYS * Return the value of item at position 'pos' */ #define ci_ptr_array_value(array, pos) ci_array_value(array, pos) /** \def ci_ptr_array_value(ptr_array, pos) \ingroup PTR_ARRAYS * Return the name of item at position 'pos' */ #define ci_ptr_array_name(array, pos) ci_array_name(array, pos) /** \def ci_ptr_array_value(ptr_array) \ingroup PTR_ARRAYS * Return the size of ptr_array */ #define ci_ptr_array_size(array) ci_array_size(array) /** \def ci_ptr_array_new() \ingroup PTR_ARRAYS * Create a new ci_ptr_array_t object. Similar to the ci_array_new() function. */ #define ci_ptr_array_new ci_array_new /** * Create and initialize an ci_ptr_array_t object for the given number of items \ingroup PTR_ARRAYS \param items the maximum aray items \return the allocated object on success, or NULL on failure */ CI_DECLARE_FUNC(ci_ptr_array_t *) ci_ptr_array_new2(size_t items); /** \def ci_ptr_array_destroy(ptr_array) \ingroup PTR_ARRAYS * Destroy a ci_ptr_array_t object. Similar to the ci_array_destroy function */ #define ci_ptr_array_destroy(ptr_array) ci_array_destroy(ptr_array) /** * Search in an array for an item with the given name \ingroup PTR_ARRAYS \param array a pointer to the ci_ptr_array_t object \param name the item to be search for. \return pointer to the value pair of the array item if found, NULL otherwise */ CI_DECLARE_FUNC(void *) ci_ptr_array_search(ci_ptr_array_t *array, const char *name); /** \def ci_ptr_array_iterate(ptr_array, data, fn) \ingroup PTR_ARRAYS * Run the function fn for each item of the ci_ptr_array_t object. Similar to * the ci_array_iterate function */ #define ci_ptr_array_iterate(ptr_array, data, fn) ci_array_iterate(ptr_array, data, fn) /** * Add an name/value pair item to the ci_ptr_array_t object. \ingroup PTR_ARRAYS \param ptr_array a pointer to the ci_ptr_array_t object \ param name the name part of the name/value pair item to be added \ param value a pointer to the value part of the name/value pair item to be added \return a pointer to the new array item on success, NULL otherwise * */ CI_DECLARE_FUNC(const ci_array_item_t *) ci_ptr_array_add(ci_ptr_array_t *ptr_array, const char *name, void *value); /** * Pop and delete the last item of a ci_ptr_array_t object. \ingroup PTR_ARRAYS \param ptr_array a pointer to the ci_ptr_array_t object \return a pointer to the popped array item */ CI_DECLARE_FUNC(const ci_array_item_t *) ci_ptr_array_pop(ci_ptr_array_t *ptr_array); /** * Pop and delete the last item of a ci_ptr_array_t object. \ingroup PTR_ARRAYS \param ptr_array a pointer to the ci_ptr_array_t object \param name a pointer to a buffer where the name of the poped item will be store, or NULL \param name_size the size of name buffer \return a pointer to the value of the popped item */ CI_DECLARE_FUNC(void *) ci_ptr_array_pop_value(ci_ptr_array_t *ptr_array, char *name, size_t name_size); /** \def ci_ptr_array_get_item() \ingroup PTR_ARRAYS * Get an array item. Wrapper to the ci_array_get_item() function. */ #define ci_ptr_array_get_item(array, pos) ci_array_get_item(array, pos) /** \defgroup DYNAMIC_ARRAYS Dynamic arrays related API \ingroup ARRAYS * Arrays which store name/value pair items, and can grow unlimited. * */ /** \typedef ci_dyn_array_t \ingroup DYNAMIC_ARRAYS * The ci_dyn_array_t objects can store a list of name/value pairs. * The memory RAM space of dynamic array items can not be released * before the ci_dyn_array destroyed. */ typedef struct ci_dyn_array { ci_array_item_t **items; int count; int max_items; ci_mem_allocator_t *alloc; } ci_dyn_array_t; /** \def ci_dyn_array_get_item(array, pos) \ingroup DYNAMIC_ARRAYS * Return the ci_array_item_t item on position 'pos' */ #define ci_dyn_array_get_item(array, pos) (pos < (array)->count ? (array)->items[pos] : NULL) /** \def ci_dyn_array_value(array, pos) \ingroup DYNAMIC_ARRAYS * Return the value of item on position 'pos' */ #define ci_dyn_array_value(array, pos) ((pos < (array)->count && (array)->items[pos] != NULL) ? (array)->items[pos]->value : NULL) /** \def ci_dyn_array_name(array, pos) \ingroup DYNAMIC_ARRAYS * Return the name of item on position 'pos' */ #define ci_dyn_array_name(array, pos) ((pos < (array)->count && (array)->items[pos] != NULL) ? (array)->items[pos]->name : NULL) /** \def ci_dyn_array_size(array) \ingroup DYNAMIC_ARRAYS * Return the size of array 'array' */ #define ci_dyn_array_size(array) ((array)->count) /** * Allocate the required memory and initialize an ci_dyn_array_t object \ingroup DYNAMIC_ARRAYS \param mem_size the initial size to use for dyn_array \return the allocated object on success, or NULL on failure * */ CI_DECLARE_FUNC(ci_dyn_array_t *) ci_dyn_array_new(size_t mem_size); /** * Create and initialize an ci_dyn_array_t object for the given number of items \ingroup DYNAMIC_ARRAYS \param items the maximum aray items \param item_size the items size \return the allocated object on success, or NULL on failure */ CI_DECLARE_FUNC(ci_dyn_array_t *) ci_dyn_array_new2(size_t items, size_t item_size); /** * Destroy an ci_dyn_array_t object \ingroup DYNAMIC_ARRAYS \param array a pointer to ci_dyn_array_t object to be destroyed */ CI_DECLARE_FUNC(void) ci_dyn_array_destroy(ci_dyn_array_t *array); /** * Add an name/value pair item to a dynamic array. \ingroup DYNAMIC_ARRAYS \param array a pointer to the ci_dyn_array_t object \param name the name part of the name/value pair item to be added \param value the value part of the name/value pair item to be added \param size the size of the value part of the new item. \return a pointer to the new array item on success, NULL otherwise */ CI_DECLARE_FUNC(const ci_array_item_t *) ci_dyn_array_add(ci_dyn_array_t *array, const char *name, const void *value, size_t size); /** * Search in an dynamic array for an item with the given name \ingroup DYNAMIC_ARRAYS \param array a pointer to the ci_dyn_array_t object \param name the item to be search for. \return pointer to the value pair of the array item if found, NULL otherwise */ CI_DECLARE_FUNC(const void *) ci_dyn_array_search(ci_dyn_array_t *array, const char *name); /** * Run the given function for each dynamic array item \ingroup DYNAMIC_ARRAYS \param array a pointer to the ci_dyn_array_t object \param data a pointer to data which will be passed on fn function \param fn a pointer to the function which will be run for each array item. The iteration will stop if the fn function return non zero value. */ CI_DECLARE_FUNC(void) ci_dyn_array_iterate(const ci_dyn_array_t *array, void *data, int (*fn)(void *data, const char *name, const void *)); /** \defgroup PTR_DYNAMIC_ARRAYS Dynamic arrays of pointers related API \ingroup DYNAMIC_ARRAYS * Arrays which store name/value pair items */ /** \typedef ci_ptr_dyn_array_t \ingroup PTR_DYNAMIC_ARRAYS * An alias to the ci_dyn_array_t object. It is used to store pointers * to an array. * The ci_ptr_dyn_array_new, ci_ptr_dyn_array_destroy, ci_ptr_dyn_array_search * and ci_ptr_dyn_array_iterate defines are equivalent to the ci_dyn_array_* * functions with the required typecasting. */ typedef ci_dyn_array_t ci_ptr_dyn_array_t; #define ci_ptr_dyn_array_new(size) ci_dyn_array_new(size) #define ci_ptr_dyn_array_new2(items, item_size) ci_dyn_array_new2(items, item_size) #define ci_ptr_dyn_array_destroy(ptr_array) ci_dyn_array_destroy(ptr_array) #define ci_ptr_dyn_array_search(ptr_array, name) ci_dyn_array_search(ptr_array, name) #define ci_ptr_dyn_array_iterate(ptr_array, data, fn) ci_dyn_array_iterate(ptr_array, data, fn) #define ci_ptr_dyn_array_get_item(array, pos) ci_dyn_array_get_item(array, pos) #define ci_ptr_dyn_array_value(array, pos) ci_dyn_array_value(array, pos) #define ci_ptr_dyn_array_name(array, pos) ci_dyn_array_name(array, pos) #define ci_ptr_dyn_array_size(array) ci_dyn_array_size(array) /** * Add an name/value pair item to the array. \ingroup PTR_DYNAMIC_ARRAYS \param ptr_array a pointer to the ci_ptr_dyn_array_t object \param name the name part of the name/pointer pair item to be added \param pointer the pointer part of the name/value pair item to be added \return a pointer to the new array item on success, NULL otherwise */ CI_DECLARE_FUNC(const ci_array_item_t *) ci_ptr_dyn_array_add(ci_ptr_dyn_array_t *ptr_array, const char *name, void *pointer); /** \defgroup VECTORS Simple vectors related API \ingroup ARRAYS * Structure which can store lists of objects */ /** \typedef ci_vector_t \ingroup VECTORS * The ci_vector_t objects can store a list of objects. Currently can grow up * to a fixed size. */ typedef struct ci_vector { void **items; void **last; char *mem; size_t max_size; int count; ci_mem_allocator_t *alloc; } ci_vector_t; /** * Allocate the required memory and initialize a ci_vector_t object \ingroup VECTORS \param max_size the maximum memory to use \return the allocated object on success, or NULL on failure */ CI_DECLARE_FUNC(ci_vector_t *) ci_vector_create(size_t max_size); /** * Destroy an ci_vector_t object \ingroup VECTORS \param vector a pointer to ci_vector_t object to be destroyed */ CI_DECLARE_FUNC(void) ci_vector_destroy(ci_vector_t *vector); /** * Add an item to the vector. \ingroup VECTORS \param vector a pointer to the ci_vector_t object \param obj pointer to the object to add in vector \param size the size of the new item. \return a pointer to the new item on success, NULL otherwise */ CI_DECLARE_FUNC(void *) ci_vector_add(ci_vector_t *vector, const void *obj, size_t size); /** * Run the given function for each vector item \ingroup VECTORS \param vector a pointer to the ci_vector_t object \param data a pointer to data which will be passed to the fn function \param fn a pointer to the function which will be run for each vector item. The iteration will stop if the fn function return non zero value. */ CI_DECLARE_FUNC(void) ci_vector_iterate(const ci_vector_t *vector, void *data, int (*fn)(void *data, const void *)); /** * Delete the last element of a vector. \ingroup VECTORS \param vector a pointer to the ci_vector_t object \return a pointer to the popped vector item on success, NULL otherwise */ CI_DECLARE_FUNC(void *) ci_vector_pop(ci_vector_t *vector); /** \def ci_vector_get(vector, i) \ingroup VECTORS * Return a pointer to the i item of the vector */ #define ci_vector_get(vector, i) (i < vector->count ? (const void *)vector->items[i]: (const void *)NULL) CI_DECLARE_FUNC(const void **) ci_vector_cast_to_voidvoid(ci_vector_t *vector); CI_DECLARE_FUNC(ci_vector_t *)ci_vector_cast_from_voidvoid(const void **p); /** \defgroup STR_VECTORS Vectors of strings \ingroup VECTORS * */ /** \typedef ci_str_vector_t \ingroup STR_VECTORS * The ci_str_vector is used to implement string vectors. * The ci_str_vector_create, ci_str_vector_destroy, ci_str_vector_add, * and ci_str_vector_pop defines are similar and equivalent to the ci_vector_* * functions. */ typedef ci_vector_t ci_str_vector_t; #define ci_str_vector_create ci_vector_create #define ci_str_vector_destroy ci_vector_destroy #define ci_str_vector_add(vect, string) ((const char *)ci_vector_add(vect, string, (strlen(string)+1))) #define ci_str_vector_get(vector, i) (i < vector->count ? (const char *)vector->items[i]: (const char *)NULL) #define ci_str_vector_pop(vect) ((const char *)ci_vector_pop(vect)) #define ci_str_vector_cast_to_charchar(vector) ((const char **)ci_vector_cast_to_voidvoid(vector)) #define ci_str_vector_cast_from_charchar(p) (ci_vector_cast_from_voidvoid((void **)p)) /** * Run the given function for each string vector item \ingroup STR_VECTORS \param vector a pointer to the ci_vector_t object \param data a pointer to data which will be passed to the fn function \param fn a pointer to the function which will be run for each string vector item. The iteration will stop if the fn function return non zero value. */ CI_DECLARE_FUNC(void) ci_str_vector_iterate(const ci_str_vector_t *vector, void *data, int (*fn)(void *data, const char *)); /** * Search for a string in a string vector. \ingroup STR_VECTORS \param vector a pointer to the ci_vector_t object \param str the string to search for \return a pointer to the new item on success, NULL otherwise */ CI_DECLARE_FUNC(const char *) ci_str_vector_search(ci_str_vector_t *vector, const char *str); /** \defgroup PTR_VECTORS Vectors of pointers \ingroup VECTORS */ /** \typedef ci_ptr_vector_t \ingroup PTR_VECTORS * The ci_ptr_vector is used to implement vectors storing pointers. * The ci_ptr_vector_create, ci_ptr_vector_destroy, ci_ptr_vector_iterate, * and ci_ptr_vector_get defines are similar and equivalent to the ci_vector_* functions. */ typedef ci_vector_t ci_ptr_vector_t; #define ci_ptr_vector_create ci_vector_create #define ci_ptr_vector_destroy ci_vector_destroy #define ci_ptr_vector_iterate ci_vector_iterate #define ci_ptr_vector_get ci_vector_get /** * Add an item to the vector. \ingroup PTR_VECTORS \param vector a pointer to the ci_vector_t object \param pointer the pointer to store in vector \return a pointer to the new item on success, NULL otherwise */ CI_DECLARE_FUNC(void *) ci_ptr_vector_add(ci_vector_t *vector, void *pointer); /** \defgroup LISTS Lists API \ingroup ARRAYS * Lists for storing items, and can grow unlimited. * */ typedef struct ci_list_item{ void *item; struct ci_list_item *next; } ci_list_item_t; /** \typedef ci_list_t \ingroup LISTS * The ci_list_t objects can store a list of objects, with a predefined size. * The list items can be removed. * The memory RAM space of list can not be decreased before the ci_list destroyed. * However the memory of removed items reused. */ typedef struct ci_list { ci_list_item_t *items; ci_list_item_t *last; ci_list_item_t *trash; ci_list_item_t *cursor; ci_list_item_t *tmp; size_t obj_size; ci_mem_allocator_t *alloc; int (*cmp_func)(const void *obj, const void *user_data, size_t user_data_size); int (*copy_func)(void *newObj, const void *oldObj); void (*free_func)(void *obj); } ci_list_t; /** * Allocate the required memory and initialize a ci_list_t object \ingroup LISTS \param init_size the initial memory size to use \param obj_size the size of stored objects. If it is 0 then stores pointers to objects. \return the allocated object on success, or NULL on failure */ CI_DECLARE_FUNC(ci_list_t *) ci_list_create(size_t init_size, size_t obj_size); /** \def ci_list_first(ci_list_t *list) * Gets the first item of the list and updates the list cursor to the next item. * WARNING: do not mix this macro with ci_list_iterate. Use the ci_list_head/ci_list_tail macros instead \ingroup LISTS \param list a pointer to the ci_list_t object \return The first item if exist, NULL otherwise */ #define ci_list_first(list) ((list)->items && (((list)->cursor = (list)->items->next) != NULL || 1) ? (list)->items->item : NULL) /** \def ci_list_next() * Return the next item of the list and updates the list cursor to the next item. * WARNING: do not mix this macro with ci_list_iterate! \ingroup LISTS \param list a pointer to the ci_list_t object \return The next item if exist, NULL otherwise */ #define ci_list_next(list) (((list)->tmp = (list)->cursor) != NULL && (((list)->cursor = (list)->cursor->next) != NULL || 1) ? (list)->tmp->item : NULL) /** \def ci_list_head(list) \ingroup LISTS * Return the head of the list */ #define ci_list_head(list) (list->items != NULL ? list->items->item : NULL) /** \def ci_list_tail(list) \ingroup LISTS * Return last item of the list. */ #define ci_list_tail(list) (list->last != NULL ? list->last->item : NULL) /** * Destroy an ci_list_t object \ingroup LISTS \param list a pointer to ci_list_t object to be destroyed */ CI_DECLARE_FUNC(void) ci_list_destroy(ci_list_t *list); /** * Run the given function for each list item \ingroup LISTS \param list a pointer to the ci_list_t object \param data a pointer to data which will be passed to the fn function \param fn a pointer to the function which will be run for each vector item. The iteration will stop if the fn function return non zero value. */ CI_DECLARE_FUNC(void) ci_list_iterate(ci_list_t *list, void *data, int (*fn)(void *data, const void *obj)); /** * Add an item to the head of list. \ingroup LISTS \param list a pointer to the ci_list_t object \param obj pointer to the object to add in vector \return a pointer to the new item on success, NULL otherwise */ CI_DECLARE_FUNC(const void *) ci_list_push(ci_list_t *list, const void *obj); /** * Add an item to the tail of list. \ingroup LISTS \param list a pointer to the ci_list_t object \param obj pointer to the object to add in vector \return a pointer to the new item on success, NULL otherwise */ CI_DECLARE_FUNC(const void *) ci_list_push_back(ci_list_t *list, const void *data); /** * Remove the first item of the list. \ingroup LISTS \param list a pointer to the ci_list_t object \param obj pointer to an object to store removed item \return a pointer to the obj on success, NULL otherwise */ CI_DECLARE_FUNC(void *) ci_list_pop(ci_list_t *list, void *obj); /** * Remove the last item of the list. \ingroup LISTS \param list a pointer to the ci_list_t object \param obj pointer to an object to store removed item \return a pointer to the obj on success, NULL otherwise */ CI_DECLARE_FUNC(void *) ci_list_pop_back(ci_list_t *list, void *obj); /** * Remove the first found item equal to the obj. \ingroup LISTS \param list a pointer to the ci_list_t object \param obj pointer to an object to remove \return not 0 on success, 0 otherwise */ CI_DECLARE_FUNC(int) ci_list_remove(ci_list_t *list, const void *obj); /** * Return the first found item equal to the obj. \ingroup LISTS \param list a pointer to the ci_list_t object \param obj pointer to an object to remove \return the found item on success, NULL otherwise */ CI_DECLARE_FUNC(const void *) ci_list_search(ci_list_t *list, const void *data); /** * Return the first found item equal to the obj, using the cmp_func as comparison function. \ingroup LISTS \param list a pointer to the ci_list_t object \param obj pointer to an object to remove \param cmp_func the comparison function to use \return the found item on success, NULL otherwise */ CI_DECLARE_FUNC(const void *) ci_list_search2(ci_list_t *list, const void *data, int (*cmp_func)(const void *obj, const void *user_data, size_t user_data_size)); /** * Sorts the list using as compare function the default. \ingroup LISTS \param list a pointer to the ci_list_t object */ CI_DECLARE_FUNC(void) ci_list_sort(ci_list_t *list); /** * Sorts the list using as compare function the cmp_func. \ingroup LISTS \param list a pointer to the ci_list_t object \param cmp_func the compare function to use */ CI_DECLARE_FUNC(void) ci_list_sort2(ci_list_t *list, int (*cmp_func)(const void *obj1, const void *obj2, size_t obj_size)); /* The following three functions are undocumented. Probably will be removed or replaced by others. */ CI_DECLARE_FUNC(void) ci_list_cmp_handler(ci_list_t *list, int (*cmp_func)(const void *obj, const void *user_data, size_t user_data_size)); CI_DECLARE_FUNC(void) ci_list_copy_handler(ci_list_t *list, int (*copy_func)(void *newObj, const void *oldObj)); CI_DECLARE_FUNC(void) ci_list_free_handler(ci_list_t *list, void (*free_func)(void *obj)); #ifdef __cplusplus } #endif #endif /*__ARRAY_H*/ c_icap-0.4.2/include/hash.h0000664000175000017500000000342112567550776012421 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __HASH_H #define __HASH_H #include "c-icap.h" #include "lookup_table.h" #include "mem.h" #ifdef __cplusplus extern "C" { #endif struct ci_hash_entry { unsigned int hash; const void *key; const void *val; struct ci_hash_entry *hnext; }; struct ci_hash_table { struct ci_hash_entry **hash_table; unsigned int hash_table_size; const ci_type_ops_t *ops; ci_mem_allocator_t *allocator; }; CI_DECLARE_FUNC(unsigned int) ci_hash_compute(unsigned long hash_max_value, const void *key, int len); CI_DECLARE_FUNC(struct ci_hash_table *) ci_hash_build(unsigned int hash_size, const ci_type_ops_t *ops, ci_mem_allocator_t *allocator); CI_DECLARE_FUNC(void) ci_hash_destroy(struct ci_hash_table *htable); CI_DECLARE_FUNC(const void *) ci_hash_search(struct ci_hash_table *htable,const void *key); CI_DECLARE_FUNC(void *) ci_hash_add(struct ci_hash_table *htable, const void *key, const void *val); #ifdef __cplusplus } #endif #endif c_icap-0.4.2/include/debug.h0000664000175000017500000000300212567550776012557 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #ifndef __DEBUG_H #define __DEBUG_H #include "c-icap.h" #include #include #ifdef __cplusplus extern "C" { #endif CI_DECLARE_DATA extern int CI_DEBUG_LEVEL; CI_DECLARE_DATA extern int CI_DEBUG_STDOUT; #ifdef _MSC_VER CI_DECLARE_DATA extern void (*__vlog_error)(void *req, const char *format, va_list ap); CI_DECLARE_FUNC(void) __ldebug_printf(int i,const char *format, ...); #define ci_debug_printf __ldebug_printf #else CI_DECLARE_DATA extern void (*__log_error)(void *req, const char *format,... ); #define ci_debug_printf(i, args...) if(i<=CI_DEBUG_LEVEL){ if(__log_error) (*__log_error)(NULL,args); if(CI_DEBUG_STDOUT) printf(args);} #endif #ifdef __cplusplus } #endif #endif /*__DEBUG_H*/ c_icap-0.4.2/include/c-icap-conf.h.in0000664000175000017500000000504412567550776014165 00000000000000/*This is autogenerated file*/ #ifndef __C_ICAP_CONF_H #define __C_ICAP_CONF_H /*C_ICAP VERSION*/ #define C_ICAP_HEX_VERSION @C_ICAP_HEX_VERSION@ /* Define USE_IPV6 if we are supporting ipv6 */ #if @USE_IPV6@ #define USE_IPV6 #endif #if @SYSV_IPC@ #define USE_SYSV_IPC #endif #if @POSIX_MAPPED_FILES@ #define USE_POSIX_MAPPED_FILES #endif #if @POSIX_SHARED_MEM@ #define USE_POSIX_SHARED_MEM #endif #if @SYSV_IPC@ # define USE_SYSV_IPC_MUTEX #endif #if @POSIX_FILE_LOCK@ # define USE_POSIX_FILE_LOCK #endif #if @POSIX_SEMAPHORES@ # define USE_POSIX_SEMAPHORES #endif #if @PTHREADS_RWLOCK@ #define USE_PTHREADS_RWLOCK #endif #if @USE_REGEX@ #define USE_REGEX #endif #if @USE_COMPAT@ #define __CI_COMPAT #endif /*The following maybe should used...*/ #if @SYS_TYPES_H@ #define __SYS_TYPES_H_EXISTS #endif #if @INTTYPES_H@ #define __INTTYPES_H_EXISTS #endif /* The 64 bit data models as described by wikipedia are: Data model short int long long long pointers/size_t LLP64 16 32 32 64 64 LP64 16 32 64 64 64 ILP64 16 64 64 64 64 SILP64 64 64 64 64 64 On most 32bit and 64bit unix machines, 'short' is always 16bit, 'int' is 32bit long is 32bit or 64bit respectively and long long is always 64bit. We are going to define: off_t as long on 32bit machines and long long on 64bit (sizeof(void*)==8) size_t as long on 32bit machines and long long on 64bit The c-icap should not use int32_t/uint32_t/int16_t/uint16_t types */ #define CI_SIZEOF_VOID_P @DEFINE_SIZE_VOID_P@ /* typedef off_t if does not define. */ #if @DEFINE_OFF_T@ #if CI_SIZEOF_VOID_P == 8 typedef long long off_t; #define CI_SIZEOF_OFF_T 8 #elif CI_SIZEOF_VOID_P == 4 typedef long off_t; #define CI_SIZEOF_OFF_T 4 #else #error "Unhandled size of void *" #endif #else /*if @DEFINE_OFF_T@*/ #define CI_SIZEOF_OFF_T @DEFINE_SIZE_OFF_T@ #endif /* typedef size_t if does not define. */ #if @DEFINE_SIZE_T@ #if SIZEOF_VOID_P == 8 typedef unsigned long long size_t; #elif SIZEOF_VOID_P == 4 typedef unsigned int size_t; #else #error "Unhandled size of void *" #endif #endif #if @DEFINE_UINT8@ typedef unsigned char uint8_t; #endif #if @DEFINE_INT8@ typedef char int8_t; #endif #if @DEFINE_UINT64@ typedef unsigned long long uint64_t; #endif #if @DEFINE_INT64@ typedef long long int64_t; #endif #if @VISIBILITY_ATTR@ #define USE_VISIBILITY_ATTRIBUTE #endif #endif c_icap-0.4.2/filetype.c0000664000175000017500000005574012567550777011703 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include #include #include #ifdef HAVE_ZLIB #include #endif #ifdef HAVE_BZLIB #include #endif #include "simple_api.h" #include "debug.h" #include "request.h" #include "mem.h" #include "filetype.h" static struct ci_magics_db *_MAGIC_DB = NULL; struct ci_data_type predefined_types[] = { {"ASCII", "ASCII text file", {CI_TEXT_DATA, -1}}, {"ISO-8859", "ISO-8859 text file", {CI_TEXT_DATA, -1}}, {"EXT-ASCII", "Extended ASCII (Mac,IBM PC etc.)", {CI_TEXT_DATA, -1}}, {"UTF", "Unicode text file ", {CI_TEXT_DATA, -1}}, {"HTML", "HTML text", {CI_TEXT_DATA, -1}}, {"BINARY", "Unknown data", {CI_OCTET_DATA, -1}}, {"", "", {-1}} }; struct ci_data_group predefined_groups[] = { {"TEXT", "All texts"}, {"DATA", "Undefined data type"}, {"", ""} }; struct ci_magic_record { int offset; unsigned char magic[MAGIC_SIZE + 1]; size_t len; char type[NAME_SIZE + 1]; char *groups[MAX_GROUPS + 1]; char descr[DESCR_SIZE + 1]; }; #define DECLARE_ARRAY_FUNCTIONS(structure,array,type,size) int array##_init(structure *db){ \ if((db->array=malloc(size*sizeof(type)))==NULL) \ return 0; \ db->array##_num=0; \ db->array##_size=size;\ return 1; \ } #define CHECK_SIZE(db,array,type,size) if(db->array##_num >= db->array##_size){\ if((newdata=realloc(db->array,(db->array##_size+size)*sizeof(type)))==NULL)\ return -1;\ db->array##_size +=size; \ db->array =newdata;\ } DECLARE_ARRAY_FUNCTIONS(struct ci_magics_db, types, struct ci_data_type, 50) DECLARE_ARRAY_FUNCTIONS(struct ci_magics_db, groups, struct ci_data_group, 15) DECLARE_ARRAY_FUNCTIONS(struct ci_magics_db, magics, struct ci_magic, 50) int types_add(struct ci_magics_db *db, const char *name, const char *descr, int *groups) { struct ci_data_type *newdata; int indx, i; CHECK_SIZE(db, types, struct ci_data_type, 50) indx = db->types_num; db->types_num++; strcpy(db->types[indx].name, name); strcpy(db->types[indx].descr, descr); i = 0; while (groups[i] >= 0 && i < MAX_GROUPS) { db->types[indx].groups[i] = groups[i]; i++; } db->types[indx].groups[i] = -1; return indx; } int groups_add(struct ci_magics_db *db, const char *name, const char *descr) { struct ci_data_group *newdata; int indx; CHECK_SIZE(db, groups, struct ci_data_group, 15) indx = db->groups_num; db->groups_num++; strcpy(db->groups[indx].name, name); strcpy(db->groups[indx].descr, descr); return indx; } int magics_add(struct ci_magics_db *db, int offset, unsigned char *magic, size_t len, int type) { struct ci_magic *newdata; int indx; CHECK_SIZE(db, magics, struct ci_magic, 50) indx = db->magics_num; db->magics_num++; db->magics[indx].type = type; db->magics[indx].offset = offset; db->magics[indx].len = len; memcpy(db->magics[indx].magic, magic, len); return indx; } int ci_get_data_type_id(struct ci_magics_db *db, const char *name) { int i = 0; for (i = 0; i < db->types_num; i++) { if (strcasecmp(name, db->types[i].name) == 0) return i; } return -1; } int ci_get_data_group_id(struct ci_magics_db *db, const char *group) { int i = 0; for (i = 0; i < db->groups_num; i++) { if (strcasecmp(group, db->groups[i].name) == 0) return i; } return -1; } int ci_belongs_to_group(struct ci_magics_db *db, int type, int group) { int i; if (db->types_num < type) return 0; i = 0; while (db->types[type].groups[i] >= 0 && i < MAX_GROUPS) { if (db->types[type].groups[i] == group) return 1; i++; } return 0; } void free_records_group(struct ci_magic_record *record) { int i; i = 0; while (record->groups[i] != NULL) { free(record->groups[i]); record->groups[i] = NULL; i++; } } #define RECORD_LINE 32768 static int parse_record(char *line, struct ci_magic_record *record) { char *s, *end, num[4]; int len, c, i; if ((len = strlen(line)) < 4) /*must have at least 4 ':' */ return 0; if (line[0] == '#') /*Comment ....... */ return 0; line[--len] = '\0'; /*the \n at the end of */ s = line; errno = 0; record->offset = strtol(s, &end, 10); if (*end != ':' || errno != 0) return 0; s = end + 1; i = 0; end = line + len; while (*s != ':' && s < end && i < MAGIC_SIZE) { if (*s == '\\') { s++; if (*s == 'x') { s++; num[0] = *(s++); num[1] = *(s++); num[2] = '\0'; c = strtol(num, NULL, 16); } else { num[0] = *(s++); num[1] = *(s++); num[2] = *(s++); num[3] = '\0'; c = strtol(num, NULL, 8); } if (c > 256 || c < 0) { return -2; } record->magic[i++] = c; } else { record->magic[i++] = *s; s++; } } record->len = i; if (s >= end || *s != ':') { /*End of the line..... parse error */ return -2; } s++; if ((end = strchr(s, ':')) == NULL) { return -2; /*Parse error */ } *end = '\0'; strncpy(record->type, s, NAME_SIZE); record->type[NAME_SIZE] = '\0'; s = end + 1; if ((end = strchr(s, ':')) == NULL) { return -2; /*Parse error */ } *end = '\0'; strncpy(record->descr, s, DESCR_SIZE); record->descr[DESCR_SIZE] = '\0'; s = end + 1; i = 0; while ((end = strchr(s, ':')) != NULL) { *end = '\0'; record->groups[i] = malloc(NAME_SIZE + 1); strncpy(record->groups[i], s, NAME_SIZE); record->groups[i][NAME_SIZE] = '\0'; i++; if (i >= MAX_GROUPS - 1) break; s = end + 1; } record->groups[i] = malloc(NAME_SIZE + 1); strncpy(record->groups[i], s, NAME_SIZE); record->groups[i][NAME_SIZE] = '\0'; i++; record->groups[i] = NULL; return 1; } struct ci_magics_db *ci_magics_db_init() { struct ci_magics_db *db; int i; db = malloc(sizeof(struct ci_magics_db)); if (!db) return NULL; types_init(db); groups_init(db); magics_init(db); i = 0; /*Copy predefined types */ while (predefined_types[i].name[0] != '\0') { types_add(db, predefined_types[i].name, predefined_types[i].descr, predefined_types[i].groups); i++; } i = 0; /*Copy predefined groups */ while (predefined_groups[i].name[0] != '\0') { groups_add(db, predefined_groups[i].name, predefined_groups[i].descr); i++; } return db; } void ci_magics_db_release(struct ci_magics_db *db) { free(db->types); free(db->groups); free(db->magics); free(db); } int ci_magics_db_file_add(struct ci_magics_db *db, const char *filename) { int type; int ret, group, i, lineNum; int groups[MAX_GROUPS + 1]; char line[RECORD_LINE]; struct ci_magic_record record; FILE *f; if ((f = fopen(filename, "r")) == NULL) { ci_debug_printf(1, "Error opening magic file: %s\n", filename); return 0; } lineNum = 0; ret = 0; while (fgets(line, RECORD_LINE, f) != NULL) { lineNum ++; ret = parse_record(line, &record); if (!ret) continue; if (ret < 0) break; if ((type = ci_get_data_type_id(db, record.type)) < 0) { i = 0; while (record.groups[i] != NULL && i < MAX_GROUPS) { if ((group = ci_get_data_group_id(db, record.groups[i])) < 0) { group = groups_add(db, record.groups[i], ""); } groups[i] = group; i++; } groups[i] = -1; type = types_add(db, record.type, record.descr, groups); if (type < 0) { ret = -2; break; } } magics_add(db, record.offset, record.magic, record.len, (unsigned int) type); free_records_group(&record); } fclose(f); if (ret < 0) { /*An error occured ..... */ ci_debug_printf(1, "Error reading magic file (%d), line number: %d\nBuggy line: %s\n", ret, lineNum, line); return 0; } ci_debug_printf(3, "In database: magic: %d, types: %d, groups: %d\n", db->magics_num, db->types_num, db->groups_num); return 1; } struct ci_magics_db *ci_magics_db_build(const char *filename) { struct ci_magics_db *db; if ((db = ci_magics_db_init()) != NULL) ci_magics_db_file_add(db, filename); return db; } int check_magics(struct ci_magics_db *db, const char *buf, int buflen) { int i; for (i = 0; i < db->magics_num; i++) { if (buflen >= db->magics[i].offset + db->magics[i].len) { if (memcmp (buf + db->magics[i].offset, db->magics[i].magic, db->magics[i].len) == 0) { return db->magics[i].type; } } } return -1; } /*The folowing table taking from the file project........*/ /*0 are the characters which never appears in text */ #define T 1 /* character appears in plain ASCII text */ #define I 2 /* character appears in ISO-8859 text */ #define X 4 /* character appears in non-ISO extended ASCII (Mac, IBM PC) */ static const char text_chars[256] = { /* BEL BS HT LF FF CR */ 0, 0, 0, 0, 0, 0, 0, T, T, T, T, 0, T, T, 0, 0, /* 0x0X */ /* ESC */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, T, 0, 0, 0, 0, /* 0x1X */ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x2X */ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x3X */ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x4X */ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x5X */ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x6X */ T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, 0, /* 0x7X */ /* NEL */ X, X, X, X, X, T, X, X, X, X, X, X, X, X, X, X, /* 0x8X */ X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, /* 0x9X */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xaX */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xbX */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xcX */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xdX */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xeX */ I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I /* 0xfX */ }; /* ASCII if res<=1 ISO if res<=3 EXTEND if res<=7 */ int check_ascii(unsigned char *buf, int buflen) { unsigned int i, res = 0, type; for (i = 0; i < buflen; i++) { /*May be only a small number (30-50 bytes) of the first data must be checked */ if ((type = text_chars[buf[i]]) == 0) return -1; res = res | type; } if (res <= 1) return CI_ASCII_DATA; if (res <= 3) return CI_ISO8859_DATA; return CI_XASCII_DATA; /*Extend ascii for web pages? */ } static unsigned int utf_boundaries[] = { 0x0, 0x0, 0x07F, 0x7FF, 0xFFFF, 0x1FFFFF, 0x3FFFFFF }; int isUTF8(unsigned char *c, int size) { int i, r_size = 0; unsigned int ucs_c = 0; if (text_chars[(int) *c] == T) return 1; if ((*c & 0xE0) == 0xC0) { /*2 byte unicode char ... */ ucs_c = (*c) & 0x1F; r_size = 2; } else if ((*c & 0xF0) == 0xE0) { /*3 byte unicode char */ ucs_c = (*c) & 0x0F; r_size = 3; } else if ((*c & 0xF8) == 0xF0) { /*4 byte unicode char */ ucs_c = (*c) & 0x07; r_size = 4; } else if ((*c & 0xFC) == 0xF8) { /*5 byte unicode char */ ucs_c = (*c) & 0x03; r_size = 5; } else if ((*c & 0xFE) == 0xFC) { /*6 byte unicode char */ ucs_c = (*c) & 0x01; r_size = 6; } if (!r_size /*|| r_size >4 */ ) /*In practice there are not yet 5 and 6 sized utf characters */ return 0; for (i = 1; i < r_size && i < size; i++) { if ((*(c + i) & 0xC0) != 0x80) return 0; ucs_c = (ucs_c << 6) | (*(c + i) & 0x3F); } if (i < r_size) { /*Not enough length ... */ return -1; } if (ucs_c <= utf_boundaries[r_size]) { /*Over long character .... */ return 0; } /* check UTF-16 surrogates? ........ */ if ((ucs_c >= 0xd800 && ucs_c <= 0xdfff) || ucs_c == 0xfffe || ucs_c == 0xffff) { return 0; } return r_size; } int check_unicode(unsigned char *buf, int buflen) { int i, ret = 0; int endian = 0; /*check for utf8 ........ */ for (i = 0; i < buflen; i += ret) { if ((ret = isUTF8(buf + i, buflen - i)) <= 0) break; } if (ret < 0 && i == 0) ret = 0; /*Not enough data to check */ if (ret) /*Even if the last char is unknown ret!=0 mean is utf */ return CI_UTF_DATA; /*... but what about if buflen is about 2 or 3 bytes long ? */ /*check for utf16 .... */ if (buflen < 2) return -1; /*I read somewhere that only Microsoft uses the first 2 bytes to identify utf16 documents */ if (buf[0] == 0xff && buf[1] == 0xfe) /*Litle endian utf16 */ endian = 0; else if (buf[0] == 0xfe && buf[1] == 0xff) /*big endian utf16 .... */ endian = 1; else return -1; /*The only check we can do is for the ascii characters ...... */ for (i = 2; i < buflen; i += 2) { if (endian) { if (buf[i] == 0 && buf[i + 1] < 128 && text_chars[buf[i + 1]] != T) return -1; } else { if (buf[i + 1] == 0 && buf[i] < 128 && text_chars[buf[i]] != T) return -1; } } /*utf32 ????? who are using it? */ return CI_UTF_DATA; } int ci_filetype(struct ci_magics_db *db, const char *buf, int buflen) { int ret; if ((ret = check_magics(db, buf, buflen)) >= 0) return ret; /*At the feature the check_ascii and check_unicode must be merged ....*/ if ((ret = check_ascii((unsigned char *) buf, buflen)) >= 0) return ret; if ((ret = check_unicode((unsigned char *) buf, buflen)) >= 0) { return CI_UTF_DATA; } return CI_BIN_DATA; /*binary data */ } int extend_object_type(struct ci_magics_db *db, ci_headers_list_t *headers, const char *buf, int len, int *iscompressed) { int file_type; int unzip_error = 0; int unzipped_buf_len = 0; char *unzipped_buf = NULL; const char *checkbuf = buf; const char *content_type = NULL; const char *content_encoding = NULL; *iscompressed = CI_ENCODE_NONE; if (len <= 0) return CI_BIN_DATA; if (headers) { content_encoding = ci_headers_value(headers, "Content-Encoding"); if (content_encoding) { ci_debug_printf(8, "Content-Encoding :%s\n", content_encoding); /*the following must be faster in the feature...... */ if (strcasestr(content_encoding, "gzip") != NULL) { *iscompressed = CI_ENCODE_GZIP; } else if (strcasestr(content_encoding, "deflate") != NULL) { *iscompressed = CI_ENCODE_DEFLATE; } else if (strcasestr(content_encoding, "bzip2") != NULL) { *iscompressed = CI_ENCODE_BZIP2; } else *iscompressed = CI_ENCODE_UNKNOWN; /* Bzip2 comressed data are not usefull on preview data, because ci_uncompress_preview in most cases will not be able to decompress preview data window, because requires large blocks of data to start decompression. */ if (*iscompressed == CI_ENCODE_GZIP #if 0 || *iscompressed == CI_ENCODE_BZIP2 #endif || *iscompressed == CI_ENCODE_DEFLATE) { unzipped_buf = ci_buffer_alloc(len); /*Will I implement memory pools? when????? */ unzipped_buf_len = len; if (ci_uncompress_preview (*iscompressed, buf, len, unzipped_buf, &unzipped_buf_len) != CI_ERROR) { /* 1) unzip and 2) checkbuf eq to unziped data 3) len eq to unzipped data len */ checkbuf = unzipped_buf; len = unzipped_buf_len; } else { ci_debug_printf(3, "Error uncompressing encoded object\n"); ci_buffer_free(unzipped_buf); unzipped_buf = NULL; unzip_error = 1; } } } } file_type = ci_filetype(db, checkbuf, len); ci_debug_printf(7, "File type returned :%s,%s\n", ci_data_type_name(db, file_type), ci_data_type_descr(db, file_type)); /*The following until we have an internal html recognizer ..... */ if (ci_belongs_to_group(db, file_type, CI_TEXT_DATA) && headers && (content_type = ci_headers_value(headers, "Content-Type")) != NULL) { if (strcasestr(content_type, "text/html") || strcasestr(content_type, "text/css") || strcasestr(content_type, "text/javascript")) file_type = CI_HTML_DATA; } #ifndef HAVE_ZLIB /*if we do not have a zlib try to get file info from headers....... */ else if (file_type == ci_get_data_type_id(db, "GZip") && content_encoding != NULL) { if (content_type && (strcasestr(content_type, "text/html") || strcasestr(content_type, "text/css") || strcasestr(content_type, "text/javascript"))) file_type = CI_HTML_DATA; } #endif ci_debug_printf(7, "The file type now is :%s,%s\n", ci_data_type_name(db, file_type), ci_data_type_descr(db, file_type)); #ifdef HAVE_ZLIB if (unzipped_buf) ci_buffer_free(unzipped_buf); #endif return file_type; } int ci_extend_filetype(struct ci_magics_db *db, ci_request_t * req, const char *buf, int len, int *iscompressed) { ci_headers_list_t *heads; if (ci_req_type(req) == ICAP_RESPMOD) heads = ci_http_response_headers(req); else heads = NULL; return extend_object_type(db, heads, buf, len, iscompressed); } struct ci_magics_db *ci_magic_db_load(const char *filename) { if (!_MAGIC_DB) return (_MAGIC_DB = ci_magics_db_build(filename)); if (ci_magics_db_file_add(_MAGIC_DB, filename)) return _MAGIC_DB; else return NULL; } void ci_magic_db_free() { if (_MAGIC_DB) ci_magics_db_release(_MAGIC_DB); _MAGIC_DB = NULL; } int ci_magic_req_data_type(ci_request_t *req, int *isencoded) { if (!_MAGIC_DB) return -1; if (!req->preview_data.used) return -1; if (req->preview_data_type <0 ) /*if there is not a cached value compute it*/ req->preview_data_type = ci_extend_filetype(_MAGIC_DB, req, req->preview_data.buf, req->preview_data.used, isencoded); return req->preview_data_type; } int ci_magic_data_type(const char *buf, int len) { if (!_MAGIC_DB) return -1; return ci_filetype(_MAGIC_DB, buf, len); } int ci_magic_data_type_ext(ci_headers_list_t *headers, const char *buf, int len, int *iscompressed) { if (!_MAGIC_DB) return -1; return extend_object_type(_MAGIC_DB, headers, buf, len, iscompressed); } int ci_magic_type_id(const char *name) { if (!_MAGIC_DB) return -1; return ci_get_data_type_id(_MAGIC_DB, name); } int ci_magic_group_id(const char *group) { if (!_MAGIC_DB) return -1; return ci_get_data_group_id(_MAGIC_DB, group); } int ci_magic_group_check(int type, int group) { if (!_MAGIC_DB) return 0; return ci_belongs_to_group(_MAGIC_DB, type, group); } int ci_magic_types_count() { return ci_magic_types_num(_MAGIC_DB); } int ci_magic_groups_count() { return ci_magic_groups_num(_MAGIC_DB); } char * ci_magic_type_name(int type) { if (!_MAGIC_DB || type <= 0 || type >= ci_magic_types_num(_MAGIC_DB)) return NULL; return ci_data_type_name(_MAGIC_DB, type); } char * ci_magic_type_descr(int type) { if (!_MAGIC_DB || type <= 0 || type >= ci_magic_types_num(_MAGIC_DB)) return NULL; return ci_data_type_descr(_MAGIC_DB, type); } char * ci_magic_group_name(int group) { if (!_MAGIC_DB || group <= 0 || group >= ci_magic_groups_num(_MAGIC_DB)) return NULL; return ci_data_group_name(_MAGIC_DB, group); } c_icap-0.4.2/md5.c0000664000175000017500000001764112567550776010544 00000000000000/* * This code implements the MD5 message-digest algorithm. * The algorithm is due to Ron Rivest. This code was * written by Colin Plumb in 1993, no copyright is claimed. * This code is in the public domain; do with it what you wish. * * Equivalent code is available from RSA Data Security, Inc. * This code has been tested against that, and is equivalent, * except that you don't need to include two pages of legalese * with every copy. * * To compute the message digest of a chunk of bytes, declare an * MD5Context structure, pass it to MD5Init, call MD5Update as * needed on buffers full of bytes, and then call MD5Final, which * will fill a supplied 16-byte array with the digest. */ #include "common.h" #include "md5.h" static void MD5Transform(uint32_t buf[4], uint32_t in[16]); #ifdef WORDS_BIGENDIAN #define byteReverse(buf, len) /* Nothing */ #else /* * Note: this code is harmless on little-endian machines. */ static void byteReverse(unsigned char *buf, unsigned longs) { uint32_t t; do { t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 | ((unsigned) buf[1] << 8 | buf[0]); *(uint32_t *) buf = t; buf += 4; } while (--longs); } #endif /* * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious * initialization constants. */ void ci_MD5Init(struct ci_MD5Context *ctx) { ctx->buf[0] = 0x67452301; ctx->buf[1] = 0xefcdab89; ctx->buf[2] = 0x98badcfe; ctx->buf[3] = 0x10325476; ctx->bits[0] = 0; ctx->bits[1] = 0; } /* * Update context to reflect the concatenation of another buffer full * of bytes. */ void ci_MD5Update(struct ci_MD5Context *ctx, const unsigned char *buf, size_t len) { uint32_t t; /* Update bitcount */ t = ctx->bits[0]; if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t) ctx->bits[1]++; /* Carry from low to high */ ctx->bits[1] += len >> 29; t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ /* Handle any leading odd-sized chunks */ if (t) { unsigned char *p = (unsigned char *) ctx->in + t; t = 64 - t; if (len < t) { memcpy(p, buf, len); return; } memcpy(p, buf, t); byteReverse(ctx->in, 16); MD5Transform(ctx->buf, (uint32_t *) ctx->in); buf += t; len -= t; } /* Process data in 64-byte chunks */ while (len >= 64) { memcpy(ctx->in, buf, 64); byteReverse(ctx->in, 16); MD5Transform(ctx->buf, (uint32_t *) ctx->in); buf += 64; len -= 64; } /* Handle any remaining bytes of data. */ memcpy(ctx->in, buf, len); } /* * Final wrapup - pad to 64-byte boundary with the bit pattern * 1 0* (64-bit count of bits processed, MSB-first) */ void ci_MD5Final(unsigned char digest[16], struct ci_MD5Context *ctx) { unsigned count; unsigned char *p; uint32_t *uin; /* Compute number of bytes mod 64 */ count = (ctx->bits[0] >> 3) & 0x3F; /* Set the first char of padding to 0x80. This is safe since there is always at least one byte free */ p = ctx->in + count; *p++ = 0x80; /* Bytes of padding needed to make 64 bytes */ count = 64 - 1 - count; /* Pad out to 56 mod 64 */ if (count < 8) { /* Two lots of padding: Pad the first block to 64 bytes */ memset(p, 0, count); byteReverse(ctx->in, 16); MD5Transform(ctx->buf, (uint32_t *) ctx->in); /* Now fill the next block with 56 bytes */ memset(ctx->in, 0, 56); } else { /* Pad block to 56 bytes */ memset(p, 0, count - 8); } byteReverse(ctx->in, 14); /* Append length in bits and transform */ uin = (uint32_t *) ctx->in; uin[14] = ctx->bits[0]; uin[15] = ctx->bits[1]; MD5Transform(ctx->buf, (uint32_t *) ctx->in); byteReverse((unsigned char *) ctx->buf, 4); memcpy(digest, ctx->buf, 16); memset(ctx, 0, sizeof(struct ci_MD5Context)); /* In case it's sensitive */ } /* The four core functions - F1 is optimized somewhat */ /* #define F1(x, y, z) (x & y | ~x & z) */ #define F1(x, y, z) (z ^ (x & (y ^ z))) #define F2(x, y, z) F1(z, x, y) #define F3(x, y, z) (x ^ y ^ z) #define F4(x, y, z) (y ^ (x | ~z)) /* This is the central step in the MD5 algorithm. */ #define MD5STEP(f, w, x, y, z, data, s) \ ( w += f(x, y, z) + data, w = w<>(32-s), w += x ) /* * The core of the MD5 algorithm, this alters an existing MD5 hash to * reflect the addition of 16 longwords of new data. MD5Update blocks * the data and converts bytes into longwords for this routine. */ static void MD5Transform(uint32_t buf[4], uint32_t in[16]) { register uint32_t a, b, c, d; a = buf[0]; b = buf[1]; c = buf[2]; d = buf[3]; MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); buf[0] += a; buf[1] += b; buf[2] += c; buf[3] += d; } c_icap-0.4.2/NEWS0000664000175000017500000000000012567550776010367 00000000000000c_icap-0.4.2/default_acl.c0000664000175000017500000001176512567550777012324 00000000000000/* * Copyright (C) 2004 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include "request.h" #include "module.h" #include "cfg_param.h" #include "debug.h" #include "access.h" #include "simple_api.h" #include "acl.h" #include "net_io.h" #include "common.h" /*********************************************************************************************/ /* Default Authenticator definitions */ int default_acl_init(struct ci_server_conf *server_conf); int default_acl_post_init(struct ci_server_conf *server_conf); void default_acl_release(); int default_acl_client_match(ci_request_t *req); int default_acl_request_match(ci_request_t *req); int cfg_default_acl_add(const char *directive, const char **argv, void *setdata); int cfg_default_acl_access(const char *directive, const char **argv, void *setdata); ci_access_entry_t *acl_connection_access_list = NULL; ci_access_entry_t *acl_access_list = NULL; /*Configuration Table .....*/ static struct ci_conf_entry acl_conf_variables[] = { {"acl", NULL, cfg_default_acl_add, NULL}, {"client_access", NULL, cfg_default_acl_access, NULL}, {"icap_access", NULL, cfg_default_acl_access, NULL}, {NULL, NULL, NULL, NULL} }; access_control_module_t default_acl = { "default_acl", default_acl_init, default_acl_post_init, /*post_init */ default_acl_release, default_acl_client_match, default_acl_request_match, acl_conf_variables }; int default_acl_init(struct ci_server_conf *server_conf) { return 1; } int default_acl_post_init(struct ci_server_conf *server_conf) { return 1; } void default_acl_release() { ci_access_entry_release(acl_access_list); ci_access_entry_release(acl_connection_access_list); acl_access_list = NULL; acl_connection_access_list = NULL; } int default_acl_client_match(ci_request_t *req) { return ci_access_entry_match_request(acl_connection_access_list, req); } int default_acl_request_match(ci_request_t *req) { return ci_access_entry_match_request(acl_access_list, req); } int cfg_default_acl_add(const char *directive, const char **argv, void *setdata) { return 1; } int cfg_default_acl_access(const char *directive, const char **argv, void *setdata) { int type, argc, error=0; int only_connection =0; const char *acl_spec_name; ci_access_entry_t **tolist,*access_entry; const ci_acl_spec_t *acl_spec; const ci_acl_type_t *spec_type ; if (argv[0] == NULL || argv[1] == NULL) { ci_debug_printf(1, "Parse error in directive %s \n", directive); return 0; } if (strcmp("client_access", directive)==0) { tolist = &acl_connection_access_list; only_connection = 1; } else if(strcmp("icap_access", directive)==0) { tolist = &acl_access_list; } else return 0; if (strcmp(argv[0], "allow") == 0) { type = CI_ACCESS_ALLOW; } else if (strcmp(argv[0], "deny") == 0) { type = CI_ACCESS_DENY; } else { ci_debug_printf(1, "Invalid directive :%s. Disabling %s acl rule \n", argv[0], argv[1]); return 0; } if ((access_entry = ci_access_entry_new(tolist, type)) == NULL) { ci_debug_printf(1,"Error creating new access entry as %s access list\n", argv[0]); return 0; } ci_debug_printf(2,"Creating new access entry as %s with specs:\n", argv[0]); for(argc=1; argv[argc] != NULL; argc++){ acl_spec_name = argv[argc]; acl_spec = ci_acl_search(acl_spec_name); if (acl_spec) spec_type = acl_spec->type; else spec_type = NULL; if(only_connection && spec_type && strcmp(spec_type->name,"port") != 0 && strcmp(spec_type->name,"src") != 0 && strcmp(spec_type->name,"srvip") != 0 ) { ci_debug_printf(1, "Only \"port\", \"src\" and \"srvip\" acl types allowed in client_access access list (given :%s)\n", acl_spec_name); error = 1; } else { /*TODO: check return type.....*/ ci_access_entry_add_acl_by_name(access_entry, acl_spec_name); ci_debug_printf(2,"\tAdding acl spec: %s\n", acl_spec_name); } } if(error) return 0; else return 1; } c_icap-0.4.2/configure0000775000175000017500000170011712601747523011603 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for c_icap 0.4.2. # # # Copyright (C) 1992-1996, 1998-2012 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 more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= 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 IFS=$as_save_IFS ;; 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 $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; 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 if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # 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 as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # 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 sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='c_icap' PACKAGE_TARNAME='c_icap' PACKAGE_VERSION='0.4.2' PACKAGE_STRING='c_icap 0.4.2' PACKAGE_BUGREPORT='' PACKAGE_URL='' ac_unique_file="aserver.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS USEMEMCACHED_FALSE USEMEMCACHED_TRUE USELDAP_FALSE USELDAP_TRUE USEBDB_FALSE USEBDB_TRUE USEPERL_FALSE USEPERL_TRUE USE_REGEX_FALSE USE_REGEX_TRUE ISCYGWIN_FALSE ISCYGWIN_TRUE MODULES_CFLAGS MODULES_LIBADD PTHREADS_RWLOCK POSIX_SHARED_MEM POSIX_FILE_LOCK POSIX_SEMAPHORES POSIX_MAPPED_FILES SYSV_IPC DEFINE_INT64 DEFINE_UINT64 DEFINE_INT8 DEFINE_UINT8 DEFINE_SIZE_VOID_P DEFINE_SIZE_OFF_T DEFINE_OFF_T DEFINE_SIZE_T USE_REGEX PCRE_ADD_FLAG PCRE_ADD_LDADD INTTYPES_H SYS_TYPES_H MEMCACHED_CFLAGS MEMCACHED_LDFLAGS LDAP_ADD_FLAG LDAP_ADD_LDADD BDB_ADD_FLAG BDB_ADD_LDADD BZLIB_ADD_FLAG BZLIB_ADD_LDADD ZLIB_ADD_FLAG ZLIB_ADD_LDADD DL_ADD_FLAG perlldflags perlccflags perllib perlcore doxygen_bin has_doxygen USE_COMPAT USE_IPV6 VISIBILITY_ATTR INVISIBILITY_CFLAG THREADS_LDFLAGS THREADS_LDADD target_os target_vendor target_cpu target C_ICAP_HEX_VERSION LIBTOOL_DEPS OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP SED LIBTOOL OBJDUMP DLLTOOL AS host_os host_vendor host_cpu host build_os build_vendor build_cpu build EGREP GREP CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE CICAPLIB_VERSION target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_maintainer_mode enable_silent_rules enable_dependency_tracking enable_static enable_shared with_pic enable_fast_install with_gnu_ld with_sysroot enable_libtool_lock enable_large_files enable_ipv6 enable_sysvipc enable_lib_compat with_perl with_zlib with_bzlib with_bdb with_ldap with_memcached with_pcre ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # 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. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -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) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$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 ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$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 ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) 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 ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$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_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=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 ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_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'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" 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 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 ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # 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 the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | 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 test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # 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 c_icap 0.4.2 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 \`..'] 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] --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] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/c_icap] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of c_icap 0.4.2:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-static[=PKGS] build static libraries [default=no] --enable-shared[=PKGS] build shared libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-large-files Enable large files support --enable-ipv6 Enable ipv6 support --enable-sysvipc Enable SYSV/IPC for shared memory if supported --enable-lib-compat Enable library compatibility with older c-icap versions Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot=DIR Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --with-perl Path to perl binary --with-zlib Path to zlib library --with-bzlib Path to bzlib library --with-bdb Where to find Berkeley DB library --with-ldap Where to find LDAP libraries --with-memcached Where to find Memcached library --with-pcre Path to PCRE library Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory 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 the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested 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 else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF c_icap configure 0.4.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 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 fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes # INCLUDES, setting VAR accordingly. Returns whether the value could be # computed ac_fn_c_compute_int () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid; break else as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=$ac_mid; break else as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid else as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; '') ac_retval=1 ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 static long int longval () { return $2; } static unsigned long int ulongval () { return $2; } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (($2) < 0) { long int i = longval (); if (i != ($2)) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ($2)) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : echo >>conftest.val; read $3 &5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by c_icap $as_me 0.4.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { 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` /usr/bin/hostinfo = `(/usr/bin/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=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&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_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=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append 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 as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset 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: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > 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 cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } 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. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_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 $ac_precious_vars; 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,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_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 # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_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. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## 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 CICAPLIB_VERSION=4:2:0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$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 ac_config_headers="$ac_config_headers autoconf.h" am__api_version='1.14' 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 as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_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 rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir 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. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$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' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # 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 ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file 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 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". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file 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 $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='c_icap' VERSION='0.4.2' 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"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&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_fn_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" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM 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. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; 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 | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" 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 DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-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='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&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". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # 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. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; 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 ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #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)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h 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=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_bigendian=no else ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac else enable_static=no fi enable_dlopen=yes # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AS"; then ac_cv_prog_AS="$AS" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AS="${ac_tool_prefix}as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AS=$ac_cv_prog_AS if test -n "$AS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 $as_echo "$AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_AS"; then ac_ct_AS=$AS # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AS"; then ac_cv_prog_ac_ct_AS="$ac_ct_AS" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AS="as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AS=$ac_cv_prog_ac_ct_AS if test -n "$ac_ct_AS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 $as_echo "$ac_ct_AS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_AS" = x; then AS="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AS=$ac_ct_AS fi else AS="$ac_cv_prog_AS" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi ;; esac test -z "$AS" && AS=as test -z "$DLLTOOL" && DLLTOOL=dlltool test -z "$OBJDUMP" && OBJDUMP=objdump case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.2' macro_revision='1.3337' ltmain="$ac_aux_dir/ltmain.sh" # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case "$ECHO" in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST 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_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 $as_echo "${with_sysroot}" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[012]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac else enable_shared=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac else pic_mode=default fi test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/${ac_tool_prefix}file; then lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/file; then lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) link_all_deplibs=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi link_all_deplibs=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_="/usr/lib:/lib" fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' ${wl}-bernotok' allow_undefined_flag=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test "$lt_cv_ld_force_load" = "yes"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test "$GCC" = yes; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test x"$lt_cv_prog_compiler__b" = xyes; then archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test "$with_gnu_ld" = no; then hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test "$lt_cv_irix_exported_symbol" = yes; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${wl}-z,text' allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([A-Za-z]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi fi fi fi fi fi ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC="$lt_save_CC" ac_config_commands="$ac_config_commands libtool" # Only expand once: C_ICAP_HEX_VERSION=`echo $PACKAGE_VERSION | $AWK -f $srcdir/build/c_icap_version.awk` { $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 $as_echo_n "checking target system type... " >&6; } if ${ac_cv_target+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$target_alias" = x; then ac_cv_target=$ac_cv_host else ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 $as_echo "$ac_cv_target" >&6; } case $ac_cv_target in *-*-*) ;; *) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; esac target=$ac_cv_target ac_save_IFS=$IFS; IFS='-' set x $ac_cv_target shift target_cpu=$1 target_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: target_os=$* IFS=$ac_save_IFS case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- case "$target_os" in linux*) CFLAGS="-D_REENTRANT $CFLAGS" THREADS_LDADD="-lpthread" THREADS_LDFLAGS="" ;; solaris2.*) CFLAGS="-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS $CFLAGS" LIBS="-lsocket -lnsl -lrt $LIBS" THREADS_LDADD="-lpthread" THREADS_LDFLAGS="" ;; freebsd5*) ## If I understand how all those threading models works correctly ## in FreeBSD I will make an option in configure script ## --with-freebsd-threads={c_r,pthreads,linuxthreads,thr} ## If I am correct I must compile c-icap with the way ## external libraries are compiled. (The clamav uses -lc_r and I had problems ## using a different threading model) ## FreeBSD linuxthreads flags # CFLAGS="-D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads $CFLAGS" # THREADS_LDADD="-llthread -lgcc_r" # THREADS_LDFLAGS="-L/usr/local/lib" ## FreeBSD Standard threads CFLAGS="-pthread -D_THREAD_SAFE $CFLAGS" THREADS_LDADD="-XCClinker -lc_r" THREADS_LDFLAGS="" ## FreeBSD has pthreads rwlocks from version 3 (I think) # AC_DEFINE(HAVE_PTHREADS_RWLOCK,1,[Define HAVE_PTHREADS_RWLOCK if pthreads library supports rwlocks]) ## 1:1 threads # CFLAGS="-D_THREAD_SAFE $CFLAGS" # THREADS_LDADD="-XCClinker -lthr" # THREADS_LDFLAGS="" ;; freebsd6*) CFLAGS="-D_THREAD_SAFE $CFLAGS" THREADS_LDADD="-XCClinker -lthr" THREADS_LDFLAGS="" ;; cygwin*) CFLAGS="-D_REENTRANT $CFLAGS" THREADS_LDADD="-lpthread" THREADS_LDFLAGS=""; iscygwin="yes" ;; *) CFLAGS="-D_REENTRANT $CFLAGS" THREADS_LDADD="-lpthread" THREADS_LDFLAGS="" ;; esac TEST_LIBS="$TEST_LIBS $THREADS_LDADD" if test "x$GCC" != "x" ; then ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" if test "x$ac_cv_header_minix_config_h" = xyes; then : MINIX=yes else MINIX= fi if test "$MINIX" = yes; then $as_echo "#define _POSIX_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h $as_echo "#define _MINIX 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } if ${ac_cv_safe_to_define___extensions__+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_safe_to_define___extensions__=yes else ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } test $ac_cv_safe_to_define___extensions__ = yes && $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h $as_echo "#define _ALL_SOURCE 1" >>confdefs.h $as_echo "#define _GNU_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h fi CFLAGS="$CFLAGS -Wall" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((visibility(\"default\")))" >&5 $as_echo_n "checking for __attribute__((visibility(\"default\")))... " >&6; } if ${ac_cv_default_visibility_attribute+:} false; then : $as_echo_n "(cached) " >&6 else echo 'int __attribute__ ((visibility ("default"))) foo_visible (void) { return 1; } int foo_invisible(void) {return 1;}' > conftest.c ac_cv_default_visibility_attribute=no if { ac_try='${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s 1>&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then if grep '\.hidden.*foo_invisible' conftest.s >/dev/null && ! grep '\.hidden.*foo_visible' conftest.s >/dev/null; then ac_cv_default_visibility_attribute=yes fi # Else try to detect visibility for Sun solaris: # CC -xldscope={global|hidden} # and use __global/__hidden inside C code # elif fi rm -f conftest.* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_default_visibility_attribute" >&5 $as_echo "$ac_cv_default_visibility_attribute" >&6; } INVISIBILITY_CFLAG="" VISIBILITY_ATTR="0" if test $ac_cv_default_visibility_attribute = yes; then $as_echo "#define HAVE_VISIBILITY_ATTRIBUTE 1" >>confdefs.h INVISIBILITY_CFLAG="-fvisibility=hidden" VISIBILITY_ATTR="1" fi # Check whether --enable-large_files was given. if test "${enable_large_files+set}" = set; then : enableval=$enable_large_files; if test $enableval = "yes"; then large_file_support="yes" else large_file_support="no" fi else large_file_support="yes" fi echo "checking whether large file support should enabled:"$large_file_support if test $large_file_support = "yes"; then CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64" #here I must put a check if the -D_FILE_OFFSET_BITS makes the off_t an 64bit integer # and if not supported warning the user #Possibly checks for systems which supports large files using different defines.... #later ....... fi USE_IPV6="0" # Check whether --enable-ipv6 was given. if test "${enable_ipv6+set}" = set; then : enableval=$enable_ipv6; if test $enableval = "yes"; then ipv6_support="yes" $as_echo "#define HAVE_IPV6 1" >>confdefs.h USE_IPV6="1" fi else ipv6_support="no" fi # Check whether --enable-sysvipc was given. if test "${enable_sysvipc+set}" = set; then : enableval=$enable_sysvipc; if test $enableval = "yes"; then sysvipc="yes" else sysvipc="no" fi else sysvipc="yes" fi USE_COMPAT="0" { $as_echo "$as_me:${as_lineno-$LINENO}: checking Keep library compatibility" >&5 $as_echo_n "checking Keep library compatibility... " >&6; } # Check whether --enable-lib_compat was given. if test "${enable_lib_compat+set}" = set; then : enableval=$enable_lib_compat; if test $enableval = "yes"; then lib_compat="yes" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } USE_COMPAT="1" fi else lib_compat="no" { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Checks for programs # Extract the first word of "doxygen", so it can be a program name with args. set dummy doxygen; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_has_doxygen+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$has_doxygen"; then ac_cv_prog_has_doxygen="$has_doxygen" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_has_doxygen=""yes"" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_has_doxygen" && ac_cv_prog_has_doxygen=""no"" fi fi has_doxygen=$ac_cv_prog_has_doxygen if test -n "$has_doxygen"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $has_doxygen" >&5 $as_echo "$has_doxygen" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test a"$has_doxygen" = "ayes"; then doxygen_bin=doxygen else doxygen_bin="echo Doxygen is not installed /" fi # Checks for libraries # Check whether --with-perl was given. if test "${with_perl+set}" = set; then : withval=$with_perl; case "$withval" in yes) perlbin="perl" ;; no ) perlbin=""; perlcore=""; ;; * ) perlbin=$withval ;; esac else perlbin=""; perlcore=""; fi if test a"$perlbin" != a; then perlcore=`$perlbin -MConfig -e 'print $Config{archlib}'`/CORE; perllib=`$perlbin -MConfig -e 'print $Config{libs}'`; perlccflags=`$perlbin -MConfig -e 'print $Config{ccflags}'`; perlldflags=`$perlbin -MConfig -e 'print $Config{ccdlflags}'`; fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : DL_ADD_FLAG=" -ldl" fi # Check whether --with-zlib was given. if test "${with_zlib+set}" = set; then : withval=$with_zlib; case "$withval" in yes) zlib=yes; ;; no) zlib=no; ;; *) zlib=$withval; ;; esac else zlib=yes fi if test a"$zlib" != "ano"; then if test a"$zlib" != "ayes"; then OLDCFLAGS=$CFLAGS OLDLDFLAGS=$LDFLAGS CFLAGS="$CFLAGS -I$zlib/include" LDFLAGS="$LDFLAGS -L$zlib/lib" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflate in -lz" >&5 $as_echo_n "checking for inflate in -lz... " >&6; } if ${ac_cv_lib_z_inflate+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char inflate (); int main () { return inflate (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_z_inflate=yes else ac_cv_lib_z_inflate=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflate" >&5 $as_echo "$ac_cv_lib_z_inflate" >&6; } if test "x$ac_cv_lib_z_inflate" = xyes; then : ZLIB_ADD_LDADD="-L$zlib/lib -lz";ZLIB_ADD_FLAG="-I$zlib/include"; $as_echo "#define HAVE_ZLIB 1" >>confdefs.h else zlib=no fi CFLAGS=$OLDCFLAGS LDFLAGS=$OLDLDFLAGS else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflate in -lz" >&5 $as_echo_n "checking for inflate in -lz... " >&6; } if ${ac_cv_lib_z_inflate+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char inflate (); int main () { return inflate (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_z_inflate=yes else ac_cv_lib_z_inflate=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflate" >&5 $as_echo "$ac_cv_lib_z_inflate" >&6; } if test "x$ac_cv_lib_z_inflate" = xyes; then : ZLIB_ADD_LDADD=" -lz"; $as_echo "#define HAVE_ZLIB 1" >>confdefs.h else zlib=no fi fi fi if test a"$zlib" = "ano"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"zlib required for the c-icap's internal filetype recognizer!\"" >&5 $as_echo "$as_me: WARNING: \"zlib required for the c-icap's internal filetype recognizer!\"" >&2;} fi # Check whether --with-bzlib was given. if test "${with_bzlib+set}" = set; then : withval=$with_bzlib; case "$withval" in yes) bzlib=yes; ;; no) bzlib=no; ;; *) bzlib=$withval; ;; esac else bzlib=yes fi if test a"$bzlib" != "ano"; then if test a"$bzlib" != "ayes"; then OLDCFLAGS=$CFLAGS OLDLDFLAGS=$LDFLAGS CFLAGS="$CFLAGS -I$bzlib/include" LDFLAGS="$LDFLAGS -L$bzlib/lib" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BZ2_bzDecompressInit in -lbz2" >&5 $as_echo_n "checking for BZ2_bzDecompressInit in -lbz2... " >&6; } if ${ac_cv_lib_bz2_BZ2_bzDecompressInit+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbz2 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char BZ2_bzDecompressInit (); int main () { return BZ2_bzDecompressInit (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_bz2_BZ2_bzDecompressInit=yes else ac_cv_lib_bz2_BZ2_bzDecompressInit=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bz2_BZ2_bzDecompressInit" >&5 $as_echo "$ac_cv_lib_bz2_BZ2_bzDecompressInit" >&6; } if test "x$ac_cv_lib_bz2_BZ2_bzDecompressInit" = xyes; then : BZLIB_ADD_LDADD="-L$bzlib/lib -lbz2";BZLIB_ADD_FLAG="-I$bzlib/include"; $as_echo "#define HAVE_BZLIB 1" >>confdefs.h else bzlib=no fi CFLAGS=$OLDCFLAGS LDFLAGS=$OLDLDFLAGS else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BZ2_bzDecompressInit in -lbz2" >&5 $as_echo_n "checking for BZ2_bzDecompressInit in -lbz2... " >&6; } if ${ac_cv_lib_bz2_BZ2_bzDecompressInit+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbz2 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char BZ2_bzDecompressInit (); int main () { return BZ2_bzDecompressInit (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_bz2_BZ2_bzDecompressInit=yes else ac_cv_lib_bz2_BZ2_bzDecompressInit=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bz2_BZ2_bzDecompressInit" >&5 $as_echo "$ac_cv_lib_bz2_BZ2_bzDecompressInit" >&6; } if test "x$ac_cv_lib_bz2_BZ2_bzDecompressInit" = xyes; then : BZLIB_ADD_LDADD=" -lbz2"; $as_echo "#define HAVE_BZLIB 1" >>confdefs.h else bzlib=no fi fi fi if test a"$bzlib" = "ano"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"bzlib required for the c-icap's internal filetype recognizer!\"" >&5 $as_echo "$as_me: WARNING: \"bzlib required for the c-icap's internal filetype recognizer!\"" >&2;} fi libdb="yes" libdbpath="" # Check whether --with-bdb was given. if test "${with_bdb+set}" = set; then : withval=$with_bdb; case "$withval" in yes) libdb="yes" ;; no ) libdb="no" ;; * ) libdb="yes" libdbpath=$withval ;; esac fi if test a"$libdb" != "ano"; then if test a"$libdbpath" = "a"; then # Save old LDFLAGS and LIBS OLDLDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS" OLDLIBS=$LIBS LIBS="-ldb $OLDLIBS" echo -n "checking for Berkeley DB under standard directories... " cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main(){ int major,minor,patch; if (!db_version(&major,&minor,&patch)) return -1; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : BDB_ADD_LDADD=" -ldb"; libdb="yes"; echo "yes" else libdb="no"; echo "no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext #restore LDFLAGS LDFLAGS=$OLDLDFLAGS LIBS=$OLDLIBS else # Save old CFLAGS/LDFLAGS/LIBS OLDCFLAGS=$CFLAGS OLDLDFLAGS=$LDFLAGS OLDLIBS=$LIBS CFLAGS="-I$libdbpath/include $CFLAGS" LDFLAGS="-L$libdbpath/lib $LDFLAGS" LIBS="-ldb $OLDLIBS" echo -n "checking for Berkeley DB under $libdbpath... " cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main(){ int major,minor,patch; if (!db_version(&major,&minor,&patch)) return -1; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : BDB_ADD_LDADD="-L$libdbpath/lib -ldb"; BDB_ADD_FLAG="-I$libdbpath/include";libdb="yes"; echo "yes" else libdb="no"; echo "no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext #restore CFLAGS/LDFLAGS CFLAGS=$OLDCFLAGS LDFLAGS=$OLDLDFLAGS LIBS=$OLDLIBS fi if test a"$libdb" = "ano"; then # Here we still was not able to find a working Berkeley DB library. # We are going to see if we can found a Berkeley DB located under a # libdbpath/include/db4x and lbdbpath/lib/db4x directories. if test a"$libdbpath" = "a"; then # if libdbpath is not given try with libdbpat="/usr" libdbpath="/usr" fi # Save old CFLAGS/LDFLAGS OLDCFLAGS=$CFLAGS OLDLDFLAGS=$LDFLAGS OLDLIBS=$LIBS LIBS="-ldb $OLDLIBS" for DBVER in 54 53 52 51 50 49 48 47 46 45 44 43 42; do if test -d $libdbpath/include/db$DBVER; then echo -n "checking for Berleley DB under $libdbpath/include/db$DBVER and $libdbpath/lib/db$DBVER... " CFLAGS="-I$libdbpath/include/db$DBVER $OLDCFLAGS" LDFLAGS="-L$libdbpath/lib/db$DBVER $OLDLDFLAGS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main(){ int major,minor,patch; if (!db_version(&major,&minor,&patch)) return -1; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : echo yes;BDB_ADD_LDADD="-L$libdbpath/lib/db$DBVER -ldb"; BDB_ADD_FLAG="-I$libdbpath/include/db$DBVER";libdb="yes"; else libdb="no"; echo "no"; fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi if test a"$libdb" = "ayes"; then break; fi done #restore CFLAGS/LDFLAGS CFLAGS=$OLDCFLAGS LDFLAGS=$OLDLDFLAGS LIBS=$OLDLIBS fi fi if test a"$libdb" = "ayes"; then $as_echo "#define HAVE_BDB 1" >>confdefs.h fi libldap="yes" # Check whether --with-ldap was given. if test "${with_ldap+set}" = set; then : withval=$with_ldap; case "$withval" in yes) libldap="yes" ;; no ) libldap="no" ;; * ) libldap=$withval ;; esac fi if test a"$libldap" != "ano"; then if test a"$libldap" != "ayes"; then OLDCFLAGS=$CFLAGS OLDLDFLAGS=$LDFLAGS CFLAGS="$CFLAGS -I$libldap/include" LDFLAGS="$LDFLAGS -L$libldap/lib" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_search_ext_s in -lldap" >&5 $as_echo_n "checking for ldap_search_ext_s in -lldap... " >&6; } if ${ac_cv_lib_ldap_ldap_search_ext_s+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lldap $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char ldap_search_ext_s (); int main () { return ldap_search_ext_s (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ldap_ldap_search_ext_s=yes else ac_cv_lib_ldap_ldap_search_ext_s=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_ldap_search_ext_s" >&5 $as_echo "$ac_cv_lib_ldap_ldap_search_ext_s" >&6; } if test "x$ac_cv_lib_ldap_ldap_search_ext_s" = xyes; then : LDAP_ADD_LDADD="-L$libldap/lib -lldap"; LDAP_ADD_FLAG="-I$libldap/include"; $as_echo "#define HAVE_LDAP 1" >>confdefs.h else libldap="no" fi CFLAGS=$OLDCFLAGS LDFLAGS=$OLDLDFLAGS else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_search_ext_s in -lldap" >&5 $as_echo_n "checking for ldap_search_ext_s in -lldap... " >&6; } if ${ac_cv_lib_ldap_ldap_search_ext_s+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lldap $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char ldap_search_ext_s (); int main () { return ldap_search_ext_s (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ldap_ldap_search_ext_s=yes else ac_cv_lib_ldap_ldap_search_ext_s=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldap_ldap_search_ext_s" >&5 $as_echo "$ac_cv_lib_ldap_ldap_search_ext_s" >&6; } if test "x$ac_cv_lib_ldap_ldap_search_ext_s" = xyes; then : LDAP_ADD_LDADD="-lldap"; $as_echo "#define HAVE_LDAP 1" >>confdefs.h else libldap="no" fi fi fi # Detect memcached library libmemcached="yes" libmemcachedpath="" # Check whether --with-memcached was given. if test "${with_memcached+set}" = set; then : withval=$with_memcached; case "$withval" in yes) libmemcached="yes" ;; no ) libmemcached="no" ;; * ) libmemcachedpath=$withval libmemcached="yes" ;; esac fi if test a"$libmemcached" != "ano"; then OLDCPPFLAGS=$CPPFLAGS OLDCXXFLAGS=$CXXFLAGS if test a"$libmemcachedpath" != "a"; then CPPFLAGS="-l$libmemcachedpath/include $CPPFLAGS" CXXFLAGS="-l$libmemcachedpath/include $CXXFLAGS" MEMCACHED_LDFLAGS="-L$libmemcachedpath/lib" MEMCACHED_CFLAGS="-I$libmemcachedpath/include" fi for ac_header in libmemcached/memcached.h do : ac_fn_c_check_header_mongrel "$LINENO" "libmemcached/memcached.h" "ac_cv_header_libmemcached_memcached_h" "$ac_includes_default" if test "x$ac_cv_header_libmemcached_memcached_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBMEMCACHED_MEMCACHED_H 1 _ACEOF libmemcached="yes" else libmemcached="no" fi done CPPFLAGS=$OLDCPPFLAGS CXXFLAGS=$OLDCXXFLAGS fi # Check for header files { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* 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 confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #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)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi for ac_header in strings.h unistd.h sys/stat.h limits.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done SYS_TYPES_H="0" for ac_header in sys/types.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default" if test "x$ac_cv_header_sys_types_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_TYPES_H 1 _ACEOF $as_echo "#define HAVE_SYS_TYPES_H 1" >>confdefs.h SYS_TYPES_H="1" fi done INTTYPES_H="0" for ac_header in inttypes.h do : ac_fn_c_check_header_mongrel "$LINENO" "inttypes.h" "ac_cv_header_inttypes_h" "$ac_includes_default" if test "x$ac_cv_header_inttypes_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_INTTYPES_H 1 _ACEOF $as_echo "#define HAVE_INTTYPES_H 1" >>confdefs.h INTTYPES_H="1" fi done # Check for PCRE regex library # Check whether --with-pcre was given. if test "${with_pcre+set}" = set; then : withval=$with_pcre; case "$withval" in yes) pcre=yes; ;; no) pcre=no; ;; *) pcre=$withval; ;; esac else pcre=yes fi if test a"$pcre" != "ano"; then if test a"$pcre" != "ayes"; then OLDCFLAGS=$CFLAGS OLDLDFLAGS=$LDFLAGS CFLAGS="$CFLAGS -I$pcre/include" LDFLAGS="$LDFLAGS -L$pcre/lib" for ac_header in pcre.h do : ac_fn_c_check_header_mongrel "$LINENO" "pcre.h" "ac_cv_header_pcre_h" "$ac_includes_default" if test "x$ac_cv_header_pcre_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PCRE_H 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pcre_exec in -lpcre" >&5 $as_echo_n "checking for pcre_exec in -lpcre... " >&6; } if ${ac_cv_lib_pcre_pcre_exec+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpcre $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pcre_exec (); int main () { return pcre_exec (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pcre_pcre_exec=yes else ac_cv_lib_pcre_pcre_exec=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcre_pcre_exec" >&5 $as_echo "$ac_cv_lib_pcre_pcre_exec" >&6; } if test "x$ac_cv_lib_pcre_pcre_exec" = xyes; then : PCRE_ADD_LDADD="-L$pcre/lib -lpcre";PCRE_ADD_FLAG="-I$pcre/include"; $as_echo "#define HAVE_PCRE 1" >>confdefs.h else pcre=no fi else pcre=no fi done CFLAGS=$OLDCFLAGS LDFLAGS=$OLDLDFLAGS else for ac_header in pcre.h do : ac_fn_c_check_header_mongrel "$LINENO" "pcre.h" "ac_cv_header_pcre_h" "$ac_includes_default" if test "x$ac_cv_header_pcre_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_PCRE_H 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pcre_exec in -lpcre" >&5 $as_echo_n "checking for pcre_exec in -lpcre... " >&6; } if ${ac_cv_lib_pcre_pcre_exec+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpcre $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pcre_exec (); int main () { return pcre_exec (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pcre_pcre_exec=yes else ac_cv_lib_pcre_pcre_exec=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcre_pcre_exec" >&5 $as_echo "$ac_cv_lib_pcre_pcre_exec" >&6; } if test "x$ac_cv_lib_pcre_pcre_exec" = xyes; then : PCRE_ADD_LDADD=" -lpcre"; $as_echo "#define HAVE_PCRE 1" >>confdefs.h else pcre=no fi else pcre=no fi done fi fi posix_regex=no for ac_header in regex.h do : ac_fn_c_check_header_mongrel "$LINENO" "regex.h" "ac_cv_header_regex_h" "$ac_includes_default" if test "x$ac_cv_header_regex_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_REGEX_H 1 _ACEOF posix_regex=yes; $as_echo "#define HAVE_REGEX 1" >>confdefs.h else posix_regex=no fi done USE_REGEX=0 if test a"$pcre" = "ayes" -o a"$posix_regex" = "ayes"; then USE_REGEX=1 fi # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* 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"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 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 sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi DEFINE_SIZE_T="0" ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else DEFINE_SIZE_T="1" fi DEFINE_OFF_T="0" ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" if test "x$ac_cv_type_off_t" = xyes; then : else DEFINE_OFF_T="1" fi # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off_t" >&5 $as_echo_n "checking size of off_t... " >&6; } if ${ac_cv_sizeof_off_t+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (off_t))" "ac_cv_sizeof_off_t" "$ac_includes_default"; then : else if test "$ac_cv_type_off_t" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (off_t) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_off_t=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_off_t" >&5 $as_echo "$ac_cv_sizeof_off_t" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_OFF_T $ac_cv_sizeof_off_t _ACEOF DEFINE_SIZE_OFF_T=$ac_cv_sizeof_off_t # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 $as_echo_n "checking size of void *... " >&6; } if ${ac_cv_sizeof_void_p+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then : else if test "$ac_cv_type_void_p" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (void *) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_void_p=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 $as_echo "$ac_cv_sizeof_void_p" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_VOID_P $ac_cv_sizeof_void_p _ACEOF DEFINE_SIZE_VOID_P=$ac_cv_sizeof_void_p DEFINE_UINT8="0" ac_fn_c_check_type "$LINENO" "uint8_t" "ac_cv_type_uint8_t" "$ac_includes_default" if test "x$ac_cv_type_uint8_t" = xyes; then : else DEFINE_UINT8="1" fi DEFINE_INT8="0" ac_fn_c_check_type "$LINENO" "int8_t" "ac_cv_type_int8_t" "$ac_includes_default" if test "x$ac_cv_type_int8_t" = xyes; then : else DEFINE_INT8="1" fi DEFINE_UINT64="0" ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "$ac_includes_default" if test "x$ac_cv_type_uint64_t" = xyes; then : else DEFINE_UINT64="1" fi DEFINE_INT64="0" ac_fn_c_check_type "$LINENO" "int64_t" "ac_cv_type_int64_t" "$ac_includes_default" if test "x$ac_cv_type_int64_t" = xyes; then : else DEFINE_INT64="1" fi #some type size (currently they are not used) # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 $as_echo_n "checking size of short... " >&6; } if ${ac_cv_sizeof_short+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : else if test "$ac_cv_type_short" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (short) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_short=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 $as_echo "$ac_cv_sizeof_short" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_SHORT $ac_cv_sizeof_short _ACEOF DEFINE_SIZEOFF_SHORT=$ac_cv_sizeof_short # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } if ${ac_cv_sizeof_int+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : else if test "$ac_cv_type_int" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_int=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 $as_echo "$ac_cv_sizeof_int" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int _ACEOF DEFINE_SIZEOFF_INT=$ac_cv_sizeof_int # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 $as_echo_n "checking size of long... " >&6; } if ${ac_cv_sizeof_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : else if test "$ac_cv_type_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 $as_echo "$ac_cv_sizeof_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF DEFINE_SIZEOFF_LONG=$ac_cv_sizeof_long # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 $as_echo_n "checking size of long long... " >&6; } if ${ac_cv_sizeof_long_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then : else if test "$ac_cv_type_long_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long long) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long_long=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5 $as_echo "$ac_cv_sizeof_long_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long _ACEOF DEFINE_SIZEOFF_LONG_LONG=$ac_cv_sizeof_long_long # Checks for library functions. #Here we are changing the LIBS variable and save the current value to OLD_LIBS variable EXTRALIBS="" OLD_LIBS="$LIBS" LIBS="$LIBS $TEST_LIBS" #AC_FUNC_VPRINTF for ac_func in nanosleep do : ac_fn_c_check_func "$LINENO" "nanosleep" "ac_cv_func_nanosleep" if test "x$ac_cv_func_nanosleep" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NANOSLEEP 1 _ACEOF $as_echo "#define HAVE_NANOSLEEP 1" >>confdefs.h fi done for ac_func in inet_aton do : ac_fn_c_check_func "$LINENO" "inet_aton" "ac_cv_func_inet_aton" if test "x$ac_cv_func_inet_aton" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_INET_ATON 1 _ACEOF $as_echo "#define HAVE_INET_ATON 1" >>confdefs.h fi done for ac_func in strnstr do : ac_fn_c_check_func "$LINENO" "strnstr" "ac_cv_func_strnstr" if test "x$ac_cv_func_strnstr" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRNSTR 1 _ACEOF $as_echo "#define HAVE_STRNSTR 1" >>confdefs.h fi done for ac_func in strcasestr do : ac_fn_c_check_func "$LINENO" "strcasestr" "ac_cv_func_strcasestr" if test "x$ac_cv_func_strcasestr" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRCASESTR 1 _ACEOF $as_echo "#define HAVE_STRCASESTR 1" >>confdefs.h fi done for ac_func in strncasestr do : ac_fn_c_check_func "$LINENO" "strncasestr" "ac_cv_func_strncasestr" if test "x$ac_cv_func_strncasestr" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRNCASESTR 1 _ACEOF $as_echo "#define HAVE_STRNCASESTR 1" >>confdefs.h fi done ac_fn_c_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default" if test "x$ac_cv_have_decl_strerror_r" = xyes; then : ac_have_decl=1 else ac_have_decl=0 fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_STRERROR_R $ac_have_decl _ACEOF for ac_func in strerror_r do : ac_fn_c_check_func "$LINENO" "strerror_r" "ac_cv_func_strerror_r" if test "x$ac_cv_func_strerror_r" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRERROR_R 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5 $as_echo_n "checking whether strerror_r returns char *... " >&6; } if ${ac_cv_func_strerror_r_char_p+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_func_strerror_r_char_p=no if test $ac_cv_have_decl_strerror_r = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { char buf[100]; char x = *strerror_r (0, buf, sizeof buf); char *p = strerror_r (0, buf, sizeof buf); return !p || x; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_func_strerror_r_char_p=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else # strerror_r is not declared. Choose between # systems that have relatively inaccessible declarations for the # function. BeOS and DEC UNIX 4.0 fall in this category, but the # former has a strerror_r that returns char*, while the latter # has a strerror_r that returns `int'. # This test should segfault on the DEC system. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default extern char *strerror_r (); int main () { char buf[100]; char x = *strerror_r (0, buf, sizeof buf); return ! isalpha (x); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_strerror_r_char_p=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5 $as_echo "$ac_cv_func_strerror_r_char_p" >&6; } if test $ac_cv_func_strerror_r_char_p = yes; then $as_echo "#define STRERROR_R_CHAR_P 1" >>confdefs.h fi #sysv ipc SYSV_IPC="0" for ac_header in sys/ipc.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/ipc.h" "ac_cv_header_sys_ipc_h" "$ac_includes_default" if test "x$ac_cv_header_sys_ipc_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_IPC_H 1 _ACEOF $as_echo "#define HAVE_SYSV_IPC 1" >>confdefs.h SYSV_IPC="1" fi done POSIX_MAPPED_FILES="0" for ac_func in mmap munmap do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF $as_echo "#define HAVE_POSIX_MAPPED_FILES 1" >>confdefs.h POSIX_MAPPED_FILES="1" fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking if union semun defined" >&5 $as_echo_n "checking if union semun defined... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { union semun a_semun; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : $as_echo "#define HAVE_UNION_SEMUN 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: checking if posix 1003.1b interprocess semaphores works" >&5 $as_echo_n "checking if posix 1003.1b interprocess semaphores works... " >&6; } if ${ac_cv_10031b_ipc_sem+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : as_fn_error $? "cross-compiling, presetting ac_cv_10031b_ipc_sem=(yes|no) will help" "$LINENO" 5 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main(int argc,char **argv){ sem_t s; pid_t pid; int status; if(sem_init(&s,1,1)!=0){ return -1; } if((pid=fork())==0){ if(sem_post(&s)<0){ exit(-1); } exit(0); } else { waitpid(pid,&status,0); if(WEXITSTATUS(status)!=0) exit(-1); } sem_destroy(&s); exit(0); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_10031b_ipc_sem=yes else ac_cv_10031b_ipc_sem=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_10031b_ipc_sem" >&5 $as_echo "$ac_cv_10031b_ipc_sem" >&6; } if test $ac_cv_10031b_ipc_sem = yes; then : $as_echo "#define HAVE_POSIX_SEMAPHORES 1" >>confdefs.h POSIX_SEMAPHORES="1" else POSIX_SEMAPHORES="0" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fcntl file locking works" >&5 $as_echo_n "checking if fcntl file locking works... " >&6; } if ${ac_cv_fcntl+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : as_fn_error $? "cross-compiling, presetting ac_cv_fcntl=(yes|no) will help" "$LINENO" 5 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main(int argc,char **argv){ struct flock fl; int fd; fd=open("autoconf.h.in",O_RDWR); fl.l_type=F_WRLCK; fl.l_whence=SEEK_SET; fl.l_start=0; fl.l_len=0; if(fcntl(fd,F_SETLKW,&fl)<0){ close(fd); return -1; } close(fd); return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_fcntl=yes else ac_cv_fcntl=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_fcntl" >&5 $as_echo "$ac_cv_fcntl" >&6; } if test $ac_cv_fcntl = yes; then : $as_echo "#define HAVE_POSIX_FILE_LOCK 1" >>confdefs.h POSIX_FILE_LOCK="1" else POSIX_FILE_LOCK="0" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if posix shared mem works" >&5 $as_echo_n "checking if posix shared mem works... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { int fd = shm_open("foo", O_CREAT|O_RDWR, S_IRUSR | S_IWUSR); if (fd < 0) return 0; if (shm_unlink("foo") < 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : $as_echo "#define HAVE_POSIX_SHARED_MEM 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } POSIX_SHARED_MEM="1" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } POSIX_SHARED_MEM="0" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test a"$POSIX_SHARED_MEM" = "a1"; then # Linux and solaris define the shm_open in -rt library. # This library already included in LIBS for solaris case "$target_os" in linux*) EXTRALIBS="$EXTRALIBS -lrt" ;; *) esac fi #pthread_rwlock PTHREADS_RWLOCK="0" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if have pthread_rwlock" >&5 $as_echo_n "checking if have pthread_rwlock... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { pthread_rwlock_t lock; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : $as_echo "#define HAVE_PTHREADS_RWLOCK 1" >>confdefs.h PTHREADS_RWLOCK="1" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext #We are pouting back real LIBS variable LIBS=$OLD_LIBS LIBS="$LIBS $EXTRALIBS" #Configure common flags MODULES_LIBADD="" if test a"$iscygwin" != a; then MODULES_LIBADD="-L../../ -licapapi" fi MODULES_CFLAGS="$INVISIBILITY_CFLAG -DCI_BUILD_MODULE" #general parameters if test a"$iscygwin" != a; then ISCYGWIN_TRUE= ISCYGWIN_FALSE='#' else ISCYGWIN_TRUE='#' ISCYGWIN_FALSE= fi # Now determine which modules will going to build ..... if test a"$pcre" = "ayes" -o a"$posix_regex" = "ayes"; then USE_REGEX_TRUE= USE_REGEX_FALSE='#' else USE_REGEX_TRUE='#' USE_REGEX_FALSE= fi if test a"$perlcore" != a; then USEPERL_TRUE= USEPERL_FALSE='#' else USEPERL_TRUE='#' USEPERL_FALSE= fi if test a"$libdb" != ano; then USEBDB_TRUE= USEBDB_FALSE='#' else USEBDB_TRUE='#' USEBDB_FALSE= fi if test a"$libldap" != ano; then USELDAP_TRUE= USELDAP_FALSE='#' else USELDAP_TRUE='#' USELDAP_FALSE= fi if test a"$libmemcached" != ano; then USEMEMCACHED_TRUE= USEMEMCACHED_FALSE='#' else USEMEMCACHED_TRUE='#' USEMEMCACHED_FALSE= fi ac_config_files="$ac_config_files include/c-icap-conf.h Makefile c-icap.conf utils/Makefile services/Makefile services/echo/Makefile services/ex-206/Makefile modules/Makefile tests/Makefile docs/Makefile docs/man/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, we kill variables containing newlines. # 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. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}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 "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} 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}' 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_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ISCYGWIN_TRUE}" && test -z "${ISCYGWIN_FALSE}"; then as_fn_error $? "conditional \"ISCYGWIN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_REGEX_TRUE}" && test -z "${USE_REGEX_FALSE}"; then as_fn_error $? "conditional \"USE_REGEX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USEPERL_TRUE}" && test -z "${USEPERL_FALSE}"; then as_fn_error $? "conditional \"USEPERL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USEBDB_TRUE}" && test -z "${USEBDB_FALSE}"; then as_fn_error $? "conditional \"USEBDB\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USELDAP_TRUE}" && test -z "${USELDAP_FALSE}"; then as_fn_error $? "conditional \"USELDAP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USEMEMCACHED_TRUE}" && test -z "${USEMEMCACHED_FALSE}"; then as_fn_error $? "conditional \"USEMEMCACHED\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $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} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= 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 IFS=$as_save_IFS ;; 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 $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; 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 if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # 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 ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by c_icap $as_me 0.4.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent 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 the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ c_icap config.status 0.4.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. 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=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; 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 || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in AS \ DLLTOOL \ OBJDUMP \ SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ nm_file_list_spec \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ sys_lib_dlsearch_path_spec; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "autoconf.h") CONFIG_HEADERS="$CONFIG_HEADERS autoconf.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "include/c-icap-conf.h") CONFIG_FILES="$CONFIG_FILES include/c-icap-conf.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "c-icap.conf") CONFIG_FILES="$CONFIG_FILES c-icap.conf" ;; "utils/Makefile") CONFIG_FILES="$CONFIG_FILES utils/Makefile" ;; "services/Makefile") CONFIG_FILES="$CONFIG_FILES services/Makefile" ;; "services/echo/Makefile") CONFIG_FILES="$CONFIG_FILES services/echo/Makefile" ;; "services/ex-206/Makefile") CONFIG_FILES="$CONFIG_FILES services/ex-206/Makefile" ;; "modules/Makefile") CONFIG_FILES="$CONFIG_FILES modules/Makefile" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; "docs/Makefile") CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; "docs/man/Makefile") CONFIG_FILES="$CONFIG_FILES docs/man/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; 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 against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries 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[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #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. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # 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. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;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&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf 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. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_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 # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. 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 " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="" # ### BEGIN LIBTOOL CONFIG # Whether or not to build static libraries. build_old_libs=$enable_static # Assembler program. AS=$lt_AS # DLL creation program. DLLTOOL=$lt_DLLTOOL # Object dumper program. OBJDUMP=$lt_OBJDUMP # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot=$lt_sysroot # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # 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 || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi c_icap-0.4.2/services/0000775000175000017500000000000012601747561011572 500000000000000c_icap-0.4.2/services/Makefile.am0000664000175000017500000000027512567550777013566 00000000000000 #SUBDIRS = url_check echo clamav #SUBDIRS = @BUILD_SERVICES@ SUBDIRS = echo ex-206 #SUBDIRS += url_check #if USECLAMAV #SUBDIRS += clamav #endif #if USEPERL #SUBDIRS += a_perl #endif c_icap-0.4.2/services/Makefile.in0000664000175000017500000004652712601747525013575 00000000000000# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ #SUBDIRS = url_check echo clamav #SUBDIRS = @BUILD_SERVICES@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = services DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/autoconf.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ distdir am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BDB_ADD_FLAG = @BDB_ADD_FLAG@ BDB_ADD_LDADD = @BDB_ADD_LDADD@ BZLIB_ADD_FLAG = @BZLIB_ADD_FLAG@ BZLIB_ADD_LDADD = @BZLIB_ADD_LDADD@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CICAPLIB_VERSION = @CICAPLIB_VERSION@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ C_ICAP_HEX_VERSION = @C_ICAP_HEX_VERSION@ DEFINE_INT64 = @DEFINE_INT64@ DEFINE_INT8 = @DEFINE_INT8@ DEFINE_OFF_T = @DEFINE_OFF_T@ DEFINE_SIZE_OFF_T = @DEFINE_SIZE_OFF_T@ DEFINE_SIZE_T = @DEFINE_SIZE_T@ DEFINE_SIZE_VOID_P = @DEFINE_SIZE_VOID_P@ DEFINE_UINT64 = @DEFINE_UINT64@ DEFINE_UINT8 = @DEFINE_UINT8@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_ADD_FLAG = @DL_ADD_FLAG@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTTYPES_H = @INTTYPES_H@ INVISIBILITY_CFLAG = @INVISIBILITY_CFLAG@ LD = @LD@ LDAP_ADD_FLAG = @LDAP_ADD_FLAG@ LDAP_ADD_LDADD = @LDAP_ADD_LDADD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MEMCACHED_CFLAGS = @MEMCACHED_CFLAGS@ MEMCACHED_LDFLAGS = @MEMCACHED_LDFLAGS@ MKDIR_P = @MKDIR_P@ MODULES_CFLAGS = @MODULES_CFLAGS@ MODULES_LIBADD = @MODULES_LIBADD@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_ADD_FLAG = @PCRE_ADD_FLAG@ PCRE_ADD_LDADD = @PCRE_ADD_LDADD@ POSIX_FILE_LOCK = @POSIX_FILE_LOCK@ POSIX_MAPPED_FILES = @POSIX_MAPPED_FILES@ POSIX_SEMAPHORES = @POSIX_SEMAPHORES@ POSIX_SHARED_MEM = @POSIX_SHARED_MEM@ PTHREADS_RWLOCK = @PTHREADS_RWLOCK@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SYSV_IPC = @SYSV_IPC@ SYS_TYPES_H = @SYS_TYPES_H@ THREADS_LDADD = @THREADS_LDADD@ THREADS_LDFLAGS = @THREADS_LDFLAGS@ USE_COMPAT = @USE_COMPAT@ USE_IPV6 = @USE_IPV6@ USE_REGEX = @USE_REGEX@ VERSION = @VERSION@ VISIBILITY_ATTR = @VISIBILITY_ATTR@ ZLIB_ADD_FLAG = @ZLIB_ADD_FLAG@ ZLIB_ADD_LDADD = @ZLIB_ADD_LDADD@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_bin = @doxygen_bin@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ has_doxygen = @has_doxygen@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ perlccflags = @perlccflags@ perlcore = @perlcore@ perlldflags = @perlldflags@ perllib = @perllib@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = echo ex-206 all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu services/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu services/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ 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; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$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 \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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 clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags tags-am uninstall uninstall-am #SUBDIRS += url_check #if USECLAMAV #SUBDIRS += clamav #endif #if USEPERL #SUBDIRS += a_perl #endif # 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: c_icap-0.4.2/services/echo/0000775000175000017500000000000012601747561012510 500000000000000c_icap-0.4.2/services/echo/makefile.w320000664000175000017500000000051612567550777014560 00000000000000!include all: srv_echo.Dll .c.obj: $(cc) /I..\..\include /I..\..\ $(cdebug) $(cflags) $(cvarsdll) -I. -DCI_BUILD_MODULE -DUNICODE $*.c srv_echo.Dll: srv_echo.obj $(link) $(linkdebug) $(dlllflags) /LIBPATH:..\..\ c_icap.lib -def:srv_echo.def -out:$*.Dll $** $(DLL_ENTRY) $(EXTRA_LIBS) clean: del *.obj *.exe *.lib c_icap-0.4.2/services/echo/Makefile.am0000664000175000017500000000041612567550777014501 00000000000000 pkglib_LTLIBRARIES=srv_echo.la INCLUDES = -I$(top_srcdir) srv_echo_la_LIBADD = @MODULES_LIBADD@ srv_echo_la_CFLAGS= @MODULES_CFLAGS@ -I../../include/ srv_echo_la_LDFLAGS= -module -avoid-version srv_echo_la_SOURCES = srv_echo.c EXTRA_DIST= makefile.w32 srv_echo.def c_icap-0.4.2/services/echo/Makefile.in0000664000175000017500000005461412601747525014507 00000000000000# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = services/echo DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/autoconf.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) srv_echo_la_DEPENDENCIES = am_srv_echo_la_OBJECTS = srv_echo_la-srv_echo.lo srv_echo_la_OBJECTS = $(am_srv_echo_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = srv_echo_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(srv_echo_la_CFLAGS) \ $(CFLAGS) $(srv_echo_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(srv_echo_la_SOURCES) DIST_SOURCES = $(srv_echo_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BDB_ADD_FLAG = @BDB_ADD_FLAG@ BDB_ADD_LDADD = @BDB_ADD_LDADD@ BZLIB_ADD_FLAG = @BZLIB_ADD_FLAG@ BZLIB_ADD_LDADD = @BZLIB_ADD_LDADD@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CICAPLIB_VERSION = @CICAPLIB_VERSION@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ C_ICAP_HEX_VERSION = @C_ICAP_HEX_VERSION@ DEFINE_INT64 = @DEFINE_INT64@ DEFINE_INT8 = @DEFINE_INT8@ DEFINE_OFF_T = @DEFINE_OFF_T@ DEFINE_SIZE_OFF_T = @DEFINE_SIZE_OFF_T@ DEFINE_SIZE_T = @DEFINE_SIZE_T@ DEFINE_SIZE_VOID_P = @DEFINE_SIZE_VOID_P@ DEFINE_UINT64 = @DEFINE_UINT64@ DEFINE_UINT8 = @DEFINE_UINT8@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_ADD_FLAG = @DL_ADD_FLAG@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTTYPES_H = @INTTYPES_H@ INVISIBILITY_CFLAG = @INVISIBILITY_CFLAG@ LD = @LD@ LDAP_ADD_FLAG = @LDAP_ADD_FLAG@ LDAP_ADD_LDADD = @LDAP_ADD_LDADD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MEMCACHED_CFLAGS = @MEMCACHED_CFLAGS@ MEMCACHED_LDFLAGS = @MEMCACHED_LDFLAGS@ MKDIR_P = @MKDIR_P@ MODULES_CFLAGS = @MODULES_CFLAGS@ MODULES_LIBADD = @MODULES_LIBADD@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_ADD_FLAG = @PCRE_ADD_FLAG@ PCRE_ADD_LDADD = @PCRE_ADD_LDADD@ POSIX_FILE_LOCK = @POSIX_FILE_LOCK@ POSIX_MAPPED_FILES = @POSIX_MAPPED_FILES@ POSIX_SEMAPHORES = @POSIX_SEMAPHORES@ POSIX_SHARED_MEM = @POSIX_SHARED_MEM@ PTHREADS_RWLOCK = @PTHREADS_RWLOCK@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SYSV_IPC = @SYSV_IPC@ SYS_TYPES_H = @SYS_TYPES_H@ THREADS_LDADD = @THREADS_LDADD@ THREADS_LDFLAGS = @THREADS_LDFLAGS@ USE_COMPAT = @USE_COMPAT@ USE_IPV6 = @USE_IPV6@ USE_REGEX = @USE_REGEX@ VERSION = @VERSION@ VISIBILITY_ATTR = @VISIBILITY_ATTR@ ZLIB_ADD_FLAG = @ZLIB_ADD_FLAG@ ZLIB_ADD_LDADD = @ZLIB_ADD_LDADD@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_bin = @doxygen_bin@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ has_doxygen = @has_doxygen@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ perlccflags = @perlccflags@ perlcore = @perlcore@ perlldflags = @perlldflags@ perllib = @perllib@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = srv_echo.la INCLUDES = -I$(top_srcdir) srv_echo_la_LIBADD = @MODULES_LIBADD@ srv_echo_la_CFLAGS = @MODULES_CFLAGS@ -I../../include/ srv_echo_la_LDFLAGS = -module -avoid-version srv_echo_la_SOURCES = srv_echo.c EXTRA_DIST = makefile.w32 srv_echo.def all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu services/echo/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu services/echo/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } srv_echo.la: $(srv_echo_la_OBJECTS) $(srv_echo_la_DEPENDENCIES) $(EXTRA_srv_echo_la_DEPENDENCIES) $(AM_V_CCLD)$(srv_echo_la_LINK) -rpath $(pkglibdir) $(srv_echo_la_OBJECTS) $(srv_echo_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/srv_echo_la-srv_echo.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< srv_echo_la-srv_echo.lo: srv_echo.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(srv_echo_la_CFLAGS) $(CFLAGS) -MT srv_echo_la-srv_echo.lo -MD -MP -MF $(DEPDIR)/srv_echo_la-srv_echo.Tpo -c -o srv_echo_la-srv_echo.lo `test -f 'srv_echo.c' || echo '$(srcdir)/'`srv_echo.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/srv_echo_la-srv_echo.Tpo $(DEPDIR)/srv_echo_la-srv_echo.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='srv_echo.c' object='srv_echo_la-srv_echo.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(srv_echo_la_CFLAGS) $(CFLAGS) -c -o srv_echo_la-srv_echo.lo `test -f 'srv_echo.c' || echo '$(srcdir)/'`srv_echo.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$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 $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-pkglibLTLIBRARIES install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-pkglibLTLIBRARIES # 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: c_icap-0.4.2/services/echo/srv_echo.def0000664000175000017500000000000112567550777014723 00000000000000 c_icap-0.4.2/services/echo/srv_echo.c0000664000175000017500000002120312567550777014416 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include "service.h" #include "header.h" #include "body.h" #include "simple_api.h" #include "debug.h" int echo_init_service(ci_service_xdata_t * srv_xdata, struct ci_server_conf *server_conf); int echo_check_preview_handler(char *preview_data, int preview_data_len, ci_request_t *); int echo_end_of_data_handler(ci_request_t * req); void *echo_init_request_data(ci_request_t * req); void echo_close_service(); void echo_release_request_data(void *data); int echo_io(char *wbuf, int *wlen, char *rbuf, int *rlen, int iseof, ci_request_t * req); CI_DECLARE_MOD_DATA ci_service_module_t service = { "echo", /* mod_name, The module name */ "Echo demo service", /* mod_short_descr, Module short description */ ICAP_RESPMOD | ICAP_REQMOD, /* mod_type, The service type is responce or request modification */ echo_init_service, /* mod_init_service. Service initialization */ NULL, /* post_init_service. Service initialization after c-icap configured. Not used here */ echo_close_service, /* mod_close_service. Called when service shutdowns. */ echo_init_request_data, /* mod_init_request_data */ echo_release_request_data, /* mod_release_request_data */ echo_check_preview_handler, /* mod_check_preview_handler */ echo_end_of_data_handler, /* mod_end_of_data_handler */ echo_io, /* mod_service_io */ NULL, NULL }; /* The echo_req_data structure will store the data required to serve an ICAP request. */ struct echo_req_data { /*the body data*/ ci_ring_buf_t *body; /*flag for marking the eof*/ int eof; }; /* This function will be called when the service loaded */ int echo_init_service(ci_service_xdata_t * srv_xdata, struct ci_server_conf *server_conf) { ci_debug_printf(5, "Initialization of echo module......\n"); /*Tell to the icap clients that we can support up to 1024 size of preview data*/ ci_service_set_preview(srv_xdata, 1024); /*Tell to the icap clients that we support 204 responses*/ ci_service_enable_204(srv_xdata); /*Tell to the icap clients to send preview data for all files*/ ci_service_set_transfer_preview(srv_xdata, "*"); /*Tell to the icap clients that we want the X-Authenticated-User and X-Authenticated-Groups headers which contains the username and the groups in which belongs. */ ci_service_set_xopts(srv_xdata, CI_XAUTHENTICATEDUSER|CI_XAUTHENTICATEDGROUPS); return CI_OK; } /* This function will be called when the service shutdown */ void echo_close_service() { ci_debug_printf(5,"Service shutdown!\n"); /*Nothing to do*/ } /*This function will be executed when a new request for echo service arrives. This function will initialize the required structures and data to serve the request. */ void *echo_init_request_data(ci_request_t * req) { struct echo_req_data *echo_data; /*Allocate memory fot the echo_data*/ echo_data = malloc(sizeof(struct echo_req_data)); if (!echo_data) { ci_debug_printf(1, "Memory allocation failed inside echo_init_request_data!\n"); return NULL; } /*If the ICAP request encuspulates a HTTP objects which contains body data and not only headers allocate a ci_cached_file_t object to store the body data. */ if (ci_req_hasbody(req)) echo_data->body = ci_ring_buf_new(4096); else echo_data->body = NULL; echo_data->eof = 0; /*Return to the c-icap server the allocated data*/ return echo_data; } /*This function will be executed after the request served to release allocated data*/ void echo_release_request_data(void *data) { /*The data points to the echo_req_data struct we allocated in function echo_init_service */ struct echo_req_data *echo_data = (struct echo_req_data *)data; /*if we had body data, release the related allocated data*/ if(echo_data->body) ci_ring_buf_destroy(echo_data->body); free(echo_data); } static int whattodo = 0; int echo_check_preview_handler(char *preview_data, int preview_data_len, ci_request_t * req) { ci_off_t content_len; /*Get the echo_req_data we allocated using the echo_init_service function*/ struct echo_req_data *echo_data = ci_service_data(req); /*If there are is a Content-Length header in encupsulated Http object read it and display a debug message (used here only for debuging purposes)*/ content_len = ci_http_content_length(req); ci_debug_printf(9, "We expect to read :%" PRINTF_OFF_T " body data\n", (CAST_OFF_T) content_len); /*If there are not body data in HTTP encapsulated object but only headers respond with Allow204 (no modification required) and terminate here the ICAP transaction */ if(!ci_req_hasbody(req)) return CI_MOD_ALLOW204; /*Unlock the request body data so the c-icap server can send data before all body data has received */ ci_req_unlock_data(req); /*If there are not preview data tell to the client to continue sending data (http object modification required). */ if (!preview_data_len) return CI_MOD_CONTINUE; /* In most real world services we should decide here if we must modify/process or not the encupsulated HTTP object and return CI_MOD_CONTINUE or CI_MOD_ALLOW204 respectively. The decision can be taken examining the http object headers or/and the preview_data buffer. In this example service we just use the whattodo static variable to decide if we want to process or not the HTTP object. */ if (whattodo == 0) { whattodo = 1; ci_debug_printf(8, "Echo service will process the request\n"); /*if we have preview data and we want to proceed with the request processing we should store the preview data. There are cases where all the body data of the encapsulated HTTP object included in preview data. Someone can use the ci_req_hasalldata macro to identify these cases*/ if (preview_data_len) { ci_ring_buf_write(echo_data->body, preview_data, preview_data_len); echo_data->eof = ci_req_hasalldata(req); } return CI_MOD_CONTINUE; } else { whattodo = 0; /*Nothing to do just return an allow204 (No modification) to terminate here the ICAP transaction */ ci_debug_printf(8, "Allow 204...\n"); return CI_MOD_ALLOW204; } } /* This function will called if we returned CI_MOD_CONTINUE in echo_check_preview_handler function, after we read all the data from the ICAP client*/ int echo_end_of_data_handler(ci_request_t * req) { struct echo_req_data *echo_data = ci_service_data(req); /*mark the eof*/ echo_data->eof = 1; /*and return CI_MOD_DONE */ return CI_MOD_DONE; } /* This function will called if we returned CI_MOD_CONTINUE in echo_check_preview_handler function, when new data arrived from the ICAP client and when the ICAP client is ready to get data. */ int echo_io(char *wbuf, int *wlen, char *rbuf, int *rlen, int iseof, ci_request_t * req) { int ret; struct echo_req_data *echo_data = ci_service_data(req); ret = CI_OK; /*write the data read from icap_client to the echo_data->body*/ if(rlen && rbuf) { *rlen = ci_ring_buf_write(echo_data->body, rbuf, *rlen); if (*rlen < 0) ret = CI_ERROR; } /*read some data from the echo_data->body and put them to the write buffer to be send to the ICAP client*/ if (wbuf && wlen) { *wlen = ci_ring_buf_read(echo_data->body, wbuf, *wlen); } if(*wlen==0 && echo_data->eof==1) *wlen = CI_EOF; return ret; } c_icap-0.4.2/services/ex-206/0000775000175000017500000000000012601747561012513 500000000000000c_icap-0.4.2/services/ex-206/Makefile.am0000664000175000017500000000035512567550777014506 00000000000000 pkglib_LTLIBRARIES=srv_ex206.la INCLUDES = -I$(top_srcdir) srv_ex206_la_LIBADD = @MODULES_LIBADD@ srv_ex206_la_CFLAGS= @MODULES_CFLAGS@ -I../../include/ srv_ex206_la_LDFLAGS= -module -avoid-version srv_ex206_la_SOURCES = srv_ex206.c c_icap-0.4.2/services/ex-206/Makefile.in0000664000175000017500000005463512601747525014515 00000000000000# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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@ VPATH = @srcdir@ am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = services/ex-206 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/autoconf.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) srv_ex206_la_DEPENDENCIES = am_srv_ex206_la_OBJECTS = srv_ex206_la-srv_ex206.lo srv_ex206_la_OBJECTS = $(am_srv_ex206_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = srv_ex206_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(srv_ex206_la_CFLAGS) \ $(CFLAGS) $(srv_ex206_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(srv_ex206_la_SOURCES) DIST_SOURCES = $(srv_ex206_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BDB_ADD_FLAG = @BDB_ADD_FLAG@ BDB_ADD_LDADD = @BDB_ADD_LDADD@ BZLIB_ADD_FLAG = @BZLIB_ADD_FLAG@ BZLIB_ADD_LDADD = @BZLIB_ADD_LDADD@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CICAPLIB_VERSION = @CICAPLIB_VERSION@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ C_ICAP_HEX_VERSION = @C_ICAP_HEX_VERSION@ DEFINE_INT64 = @DEFINE_INT64@ DEFINE_INT8 = @DEFINE_INT8@ DEFINE_OFF_T = @DEFINE_OFF_T@ DEFINE_SIZE_OFF_T = @DEFINE_SIZE_OFF_T@ DEFINE_SIZE_T = @DEFINE_SIZE_T@ DEFINE_SIZE_VOID_P = @DEFINE_SIZE_VOID_P@ DEFINE_UINT64 = @DEFINE_UINT64@ DEFINE_UINT8 = @DEFINE_UINT8@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DL_ADD_FLAG = @DL_ADD_FLAG@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTTYPES_H = @INTTYPES_H@ INVISIBILITY_CFLAG = @INVISIBILITY_CFLAG@ LD = @LD@ LDAP_ADD_FLAG = @LDAP_ADD_FLAG@ LDAP_ADD_LDADD = @LDAP_ADD_LDADD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MEMCACHED_CFLAGS = @MEMCACHED_CFLAGS@ MEMCACHED_LDFLAGS = @MEMCACHED_LDFLAGS@ MKDIR_P = @MKDIR_P@ MODULES_CFLAGS = @MODULES_CFLAGS@ MODULES_LIBADD = @MODULES_LIBADD@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCRE_ADD_FLAG = @PCRE_ADD_FLAG@ PCRE_ADD_LDADD = @PCRE_ADD_LDADD@ POSIX_FILE_LOCK = @POSIX_FILE_LOCK@ POSIX_MAPPED_FILES = @POSIX_MAPPED_FILES@ POSIX_SEMAPHORES = @POSIX_SEMAPHORES@ POSIX_SHARED_MEM = @POSIX_SHARED_MEM@ PTHREADS_RWLOCK = @PTHREADS_RWLOCK@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ SYSV_IPC = @SYSV_IPC@ SYS_TYPES_H = @SYS_TYPES_H@ THREADS_LDADD = @THREADS_LDADD@ THREADS_LDFLAGS = @THREADS_LDFLAGS@ USE_COMPAT = @USE_COMPAT@ USE_IPV6 = @USE_IPV6@ USE_REGEX = @USE_REGEX@ VERSION = @VERSION@ VISIBILITY_ATTR = @VISIBILITY_ATTR@ ZLIB_ADD_FLAG = @ZLIB_ADD_FLAG@ ZLIB_ADD_LDADD = @ZLIB_ADD_LDADD@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ doxygen_bin = @doxygen_bin@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ has_doxygen = @has_doxygen@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ perlccflags = @perlccflags@ perlcore = @perlcore@ perlldflags = @perlldflags@ perllib = @perllib@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkglib_LTLIBRARIES = srv_ex206.la INCLUDES = -I$(top_srcdir) srv_ex206_la_LIBADD = @MODULES_LIBADD@ srv_ex206_la_CFLAGS = @MODULES_CFLAGS@ -I../../include/ srv_ex206_la_LDFLAGS = -module -avoid-version srv_ex206_la_SOURCES = srv_ex206.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu services/ex-206/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu services/ex-206/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(pkglibdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \ } uninstall-pkglibLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \ done clean-pkglibLTLIBRARIES: -test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES) @list='$(pkglib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } srv_ex206.la: $(srv_ex206_la_OBJECTS) $(srv_ex206_la_DEPENDENCIES) $(EXTRA_srv_ex206_la_DEPENDENCIES) $(AM_V_CCLD)$(srv_ex206_la_LINK) -rpath $(pkglibdir) $(srv_ex206_la_OBJECTS) $(srv_ex206_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/srv_ex206_la-srv_ex206.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< srv_ex206_la-srv_ex206.lo: srv_ex206.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(srv_ex206_la_CFLAGS) $(CFLAGS) -MT srv_ex206_la-srv_ex206.lo -MD -MP -MF $(DEPDIR)/srv_ex206_la-srv_ex206.Tpo -c -o srv_ex206_la-srv_ex206.lo `test -f 'srv_ex206.c' || echo '$(srcdir)/'`srv_ex206.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/srv_ex206_la-srv_ex206.Tpo $(DEPDIR)/srv_ex206_la-srv_ex206.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='srv_ex206.c' object='srv_ex206_la-srv_ex206.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(srv_ex206_la_CFLAGS) $(CFLAGS) -c -o srv_ex206_la-srv_ex206.lo `test -f 'srv_ex206.c' || echo '$(srcdir)/'`srv_ex206.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$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 $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(pkglibdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done 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: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-libtool clean-pkglibLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-pkglibLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkglibLTLIBRARIES .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-pkglibLTLIBRARIES cscopelist-am ctags \ ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-pkglibLTLIBRARIES install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-pkglibLTLIBRARIES # 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: c_icap-0.4.2/services/ex-206/srv_ex206.c0000664000175000017500000001741012601746114014331 00000000000000/* * Copyright (C) 2011 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include "service.h" #include "header.h" #include "body.h" #include "simple_api.h" #include "debug.h" int ex206_init_service(ci_service_xdata_t * srv_xdata, struct ci_server_conf *server_conf); int ex206_check_preview_handler(char *preview_data, int preview_data_len, ci_request_t *); int ex206_end_of_data_handler(ci_request_t * req); void *ex206_init_request_data(ci_request_t * req); void ex206_close_service(); void ex206_release_request_data(void *data); int ex206_io(char *wbuf, int *wlen, char *rbuf, int *rlen, int iseof, ci_request_t * req); CI_DECLARE_MOD_DATA ci_service_module_t service = { "ex206", /* mod_name, The module name */ "Ex206 demo service", /* mod_short_descr, Module short description */ ICAP_RESPMOD | ICAP_REQMOD, /* mod_type, The service type is responce or request modification */ ex206_init_service, /* mod_init_service. Service initialization */ NULL, /* post_init_service. Service initialization after c-icap configured. Not used here */ ex206_close_service, /* mod_close_service. Called when service shutdowns. */ ex206_init_request_data, /* mod_init_request_data */ ex206_release_request_data, /* mod_release_request_data */ ex206_check_preview_handler, /* mod_check_preview_handler */ ex206_end_of_data_handler, /* mod_end_of_data_handler */ ex206_io, /* mod_service_io */ NULL, NULL }; /* The ex206_req_data structure will store the data required to serve an ICAP request. */ struct ex206_req_data { ci_membuf_t *body; int script_size; }; /* This function will be called when the service loaded */ int ex206_init_service(ci_service_xdata_t * srv_xdata, struct ci_server_conf *server_conf) { ci_debug_printf(5, "Initialization of ex206 module......\n"); /*Tell to the icap clients that we can support up to 1024 size of preview data*/ ci_service_set_preview(srv_xdata, 1024); /*Tell to the icap clients that we support 204 responses*/ ci_service_enable_204(srv_xdata); /*Tell to the icap clients that we support 206 responses*/ ci_service_enable_206(srv_xdata); /*Tell to the icap clients to send preview data for all files*/ ci_service_set_transfer_preview(srv_xdata, "*"); return CI_OK; } /* This function will be called when the service shutdown */ void ex206_close_service() { ci_debug_printf(5,"Service shutdown!\n"); /*Nothing to do*/ } /*This function will be executed when a new request for ex206 service arrives. This function will initialize the required structures and data to serve the request. */ void *ex206_init_request_data(ci_request_t * req) { struct ex206_req_data *ex206_data; /*Allocate memory fot the ex206_data*/ ex206_data = malloc(sizeof(struct ex206_req_data)); ex206_data->body = NULL; ex206_data->script_size = 0; /*Return to the c-icap server the allocated data*/ return ex206_data; } /*This function will be executed after the request served to release allocated data*/ void ex206_release_request_data(void *data) { /*The data points to the ex206_req_data struct we allocated in function ex206_init_service */ struct ex206_req_data *ex206_data = (struct ex206_req_data *)data; free(ex206_data); } int ex206_check_preview_handler(char *preview_data, int preview_data_len, ci_request_t * req) { ci_off_t content_len; const char *script = "\n\n\n"; const char *p, *e; char buf[256]; int use_origin = 0; int body_altered = 0; /*Get the ex206_req_data we allocated using the ex206_init_service function*/ struct ex206_req_data *ex206_data = ci_service_data(req); content_len = ci_http_content_length(req); ci_debug_printf(9, "We expect to read :%" PRINTF_OFF_T " body data\n", (CAST_OFF_T) content_len); if (!ci_req_allow206(req)) /*The client does not support allow 206, return allow204*/ return CI_MOD_ALLOW204; ci_debug_printf(8, "Ex206 service will process the request\n"); if (preview_data_len) { if ((p=strncasestr(preview_data, "", preview_data_len - (p-preview_data))) != NULL) { if ((ex206_data->body = ci_membuf_new()) == NULL) return CI_ERROR; /* Copy body data untill the tag*/ ci_membuf_write(ex206_data->body, preview_data, (e - preview_data+1), 0); /* Copy the script */ ci_membuf_write(ex206_data->body, script, strlen(script), 1); ex206_data->script_size = strlen(script); /*Use only the original body after the tag */ use_origin = e - preview_data + 1; ci_request_206_origin_body(req, use_origin); if(content_len > 0) { // The content length increased because the script was added. content_len += ex206_data->script_size; ci_http_response_remove_header(req, "Content-Length"); char head[512]; snprintf(head, 512, "Content-Length: %" PRINTF_OFF_T, (CAST_OFF_T) content_len); ci_http_response_add_header(req, head); } } else //Else no HTML tag use all of the original body data ci_request_206_origin_body(req, 0); } else //Use all of the original body data ci_request_206_origin_body(req, 0); sprintf(buf , "X-Ex206-Service: %s", (body_altered ? "Modified" : "Unmodified")); if (req->type == ICAP_REQMOD) ci_http_request_add_header(req, buf); else if (req->type == ICAP_RESPMOD) ci_http_response_add_header(req, buf); return CI_MOD_ALLOW206; } /* This function will called if we returned CI_MOD_CONTINUE in ex206_check_preview_handler function, after we read all the data from the ICAP client*/ int ex206_end_of_data_handler(ci_request_t * req) { /*struct ex206_req_data *ex206_data = ci_service_data(req);*/ return CI_MOD_DONE; } int ex206_io(char *wbuf, int *wlen, char *rbuf, int *rlen, int iseof, ci_request_t * req) { int ret; struct ex206_req_data *ex206_data = ci_service_data(req); ret = CI_OK; /*write the data read from icap_client to the ex206_data->body*/ if(rlen && rbuf) { /*Client should not send more data here. Just ignore for now*/ } if (!ex206_data->body) { *wlen = CI_EOF; } else if (wbuf && wlen) { /*read some data from the ex206_data->body and put them to the write buffer to be send to the ICAP client*/ *wlen = ci_membuf_read(ex206_data->body, wbuf, *wlen); } return ret; } c_icap-0.4.2/service.c0000664000175000017500000004772412567550777011525 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include "service.h" #include "module.h" #include "header.h" #include "body.h" #include "debug.h" #ifdef _WIN32 #include #endif #include "dlib.h" #include "cfg_param.h" #include "stats.h" #include /*Services tables declarations */ #define STEP 32 static ci_service_module_t **service_list = NULL; static ci_service_xdata_t *service_extra_data_list = NULL; static int service_list_size; static int services_num = 0; static service_alias_t *service_aliases = NULL; static int service_aliases_size; static int service_aliases_num = 0; /**************************************************************/ /*service globale config table */ int cfg_srv_transfer_preview(const char *directive, const char **argv, void *setdata); int cfg_srv_transfer_ignore(const char *directive, const char **argv, void *setdata); int cfg_srv_transfer_complete(const char *directive, const char **argv, void *setdata); int cfg_srv_preview_size(const char *directive, const char **argv, void *setdata); int cfg_srv_max_connections(const char *directive, const char **argv, void *setdata); int cfg_srv_options_ttl(const char *directive, const char **argv, void *setdata); int cfg_srv_allow206(const char *directive, const char **argv, void *setdata); static struct ci_conf_entry services_global_conf_table[] = { {"TransferPreview", NULL, cfg_srv_transfer_preview, NULL}, {"TransferIgnore", NULL, cfg_srv_transfer_ignore, NULL}, {"TransferComplete", NULL, cfg_srv_transfer_complete, NULL}, {"PreviewSize", NULL, cfg_srv_preview_size, NULL}, {"MaxConnections", NULL, cfg_srv_max_connections, NULL}, {"OptionsTTL", NULL, cfg_srv_options_ttl, NULL}, {"Allow206", NULL, cfg_srv_allow206, NULL}, {NULL, NULL, NULL, NULL} }; int cfg_srv_transfer_preview(const char *directive, const char **argv, void *setdata) { struct ci_service_xdata *srv_xdata = ( struct ci_service_xdata *)setdata; if (argv == NULL || argv[0] == NULL) { ci_debug_printf(1, "Missing arguments in directive %s \n", directive); return 0; } ci_debug_printf(2, "Setting parameter :%s=%s\n", directive, argv[0]); ci_service_set_transfer_preview(srv_xdata,argv[0]); return 1; } int cfg_srv_transfer_ignore(const char *directive, const char **argv, void *setdata) { struct ci_service_xdata *srv_xdata = ( struct ci_service_xdata *)setdata; if (argv == NULL || argv[0] == NULL) { ci_debug_printf(1, "Missing arguments in directive %s \n", directive); return 0; } ci_debug_printf(1, "Setting parameter :%s=%s\n", directive, argv[0]); ci_service_set_transfer_ignore(srv_xdata,argv[0]); return 1; } int cfg_srv_transfer_complete(const char *directive, const char **argv, void *setdata) { struct ci_service_xdata *srv_xdata = ( struct ci_service_xdata *)setdata; if (argv == NULL || argv[0] == NULL) { ci_debug_printf(1, "Missing arguments in directive %s \n", directive); return 0; } ci_debug_printf(1, "Setting parameter :%s=%s\n", directive, argv[0]); ci_service_set_transfer_complete(srv_xdata,argv[0]); return 1; } int cfg_srv_preview_size(const char *directive, const char **argv, void *setdata) { int preview; char *end; struct ci_service_xdata *srv_xdata = ( struct ci_service_xdata *)setdata; if (argv == NULL || argv[0] == NULL) { ci_debug_printf(1, "Missing arguments in directive %s \n", directive); return 0; } if (strcmp(argv[0], "-") == 0) { preview = -1; ci_debug_printf(2, "Setting parameter :%s=\"disable\"\n", directive); } else { errno = 0; preview = strtoll(argv[0], &end, 10); if (errno != 0 || preview < 0) { ci_debug_printf(1, "Invalid argument in directive %s \n", directive); return 0; } ci_debug_printf(2, "Setting parameter :%s=%d\n", directive, preview) } ci_service_set_preview(srv_xdata, preview); return 1; } int cfg_srv_max_connections(const char *directive, const char **argv, void *setdata) { int max_connections; char *end; struct ci_service_xdata *srv_xdata = ( struct ci_service_xdata *)setdata; if (argv == NULL || argv[0] == NULL) { ci_debug_printf(1, "Missing arguments in directive %s \n", directive); return 0; } errno = 0; max_connections = strtoll(argv[0], &end, 10); if (errno != 0 || max_connections < 0) { ci_debug_printf(1, "Invalid argument in directive %s \n", directive); return 0; } ci_debug_printf(2, "Setting parameter :%s=%d\n", directive, max_connections); ci_service_set_max_connections(srv_xdata, max_connections); return 1; } int cfg_srv_options_ttl(const char *directive, const char **argv, void *setdata) { int ttl; int u; char *end = NULL; const char *units; struct ci_service_xdata *srv_xdata = ( struct ci_service_xdata *)setdata; if (argv == NULL || argv[0] == NULL) { ci_debug_printf(1, "Missing arguments in directive %s \n", directive); return 0; } errno = 0; ttl = strtoll(argv[0], &end, 10); if (errno != 0 || ttl < 0) { ci_debug_printf(1, "Invalid argument in directive %s \n", directive); return 0; } if (end && *end != '\0') units = end; else if (argv[1] != NULL) units = argv[1]; else units = NULL; if (units) { if (strcasecmp(units, "sec") == 0 || strcasecmp(units, "secs") == 0) u = 1; else if (strcasecmp(units, "min") == 0 || strcasecmp(units, "mins") == 0) u = 60; else if (strcasecmp(units, "hour") == 0 || strcasecmp(units, "hours") == 0) u = 60*60; else { ci_debug_printf(1, "Invalid units %s, in directive %s \n", units, directive); return 0; } } else u = 1; ttl = ttl * u; ci_debug_printf(2, "Setting parameter :%s=%d\n", directive, ttl); ci_service_set_options_ttl(srv_xdata, ttl); return 1; } int cfg_srv_allow206(const char *directive, const char **argv, void *setdata) { struct ci_service_xdata *srv_xdata = ( struct ci_service_xdata *)setdata; if (argv == NULL || argv[0] == NULL) { ci_debug_printf(1, "Missing arguments in directive %s \n", directive); return 0; } ci_debug_printf(1, "Setting parameter :%s=%s\n", directive, argv[0]); if (strcasecmp(argv[0], "off")) { ci_thread_rwlock_wrlock(&srv_xdata->lock); srv_xdata->disable_206 = 1; ci_thread_rwlock_unlock(&srv_xdata->lock); } return 1; } struct ci_conf_entry *create_service_conf_table(struct ci_service_xdata *srv_xdata,struct ci_conf_entry *user_table) { int i,k,size; struct ci_conf_entry *table; for(i=0; services_global_conf_table[i].name!=NULL; i++); size = i; if(user_table) { for(i=0; user_table[i].name!=NULL; i++); size += i; } table=malloc((size+1)*sizeof(struct ci_conf_entry)); if(!table) return NULL; for(i=0; services_global_conf_table[i].name!=NULL; i++){ table[i].name = services_global_conf_table[i].name; table[i].data = srv_xdata; table[i].action = services_global_conf_table[i].action; table[i].msg = services_global_conf_table[i].msg; } k=i; if(user_table) { for(i=0; user_table[i].name!=NULL; i++,k++){ table[k].name = user_table[i].name; table[k].data = user_table[i].data; table[k].action = user_table[i].action; table[k].msg = user_table[i].msg; } } table[k].name = NULL; table[k].data = NULL; table[k].action = NULL; table[k].msg = NULL; return table; } /**************************************************************** Base functions for services support .... *****************************************************************/ ci_service_module_t *find_service_by_alias(const char *service_name); ci_service_module_t *create_service(const char *service_file) { char *extension; service_handler_module_t *service_handler; extension = strrchr(service_file, '.'); service_handler = find_servicehandler_by_ext(extension); if (!service_handler) return NULL; return service_handler->create_service(service_file); } void init_extra_data(ci_service_xdata_t * srv_xdata, const char *service) { char buf[1024]; char stat_group[1024]; memset(srv_xdata, 0, sizeof(ci_service_xdata_t)); ci_thread_rwlock_init(&srv_xdata->lock); strcpy(srv_xdata->ISTag, "ISTag: "); strcat(srv_xdata->ISTag, ISTAG "-XXXXXXXXX"); memset(srv_xdata->xincludes, 0, XINCLUDES_SIZE + 1); memset(srv_xdata->TransferPreview, 0, MAX_HEADER_SIZE + 1); memset(srv_xdata->TransferIgnore, 0, MAX_HEADER_SIZE + 1); memset(srv_xdata->TransferComplete, 0, MAX_HEADER_SIZE + 1); srv_xdata->preview_size = 0; srv_xdata->allow_204 = 0; srv_xdata->allow_206 = 0; srv_xdata->disable_206 = 0; srv_xdata->max_connections = -1; srv_xdata->xopts = 0; srv_xdata->status = CI_SERVICE_NOT_INITIALIZED; srv_xdata->options_ttl = -1; snprintf(stat_group, 1023, "Service %s", service); stat_group[1023] = '\0'; buf[1023] = '\0'; snprintf(buf, 1023, "Service %s REQMODS", service); srv_xdata->stat_reqmods = ci_stat_entry_register(buf, STAT_INT64_T, stat_group); snprintf(buf, 1023, "Service %s RESPMODS", service); srv_xdata->stat_respmods = ci_stat_entry_register(buf, STAT_INT64_T, stat_group); snprintf(buf, 1023, "Service %s OPTIONS", service); srv_xdata->stat_options = ci_stat_entry_register(buf, STAT_INT64_T, stat_group); snprintf(buf, 1023, "Service %s ALLOW 204", service); srv_xdata->stat_allow204 = ci_stat_entry_register(buf, STAT_INT64_T, stat_group); snprintf(buf, 1023, "Service %s BYTES IN", service); srv_xdata->stat_bytes_in = ci_stat_entry_register(buf, STAT_KBS_T, stat_group); snprintf(buf, 1023, "Service %s BYTES OUT", service); srv_xdata->stat_bytes_out = ci_stat_entry_register(buf, STAT_KBS_T, stat_group); snprintf(buf, 1023, "Service %s HTTP BYTES IN", service); srv_xdata->stat_http_bytes_in = ci_stat_entry_register(buf, STAT_KBS_T, stat_group); snprintf(buf, 1023, "Service %s HTTP BYTES OUT", service); srv_xdata->stat_http_bytes_out = ci_stat_entry_register(buf, STAT_KBS_T, stat_group); snprintf(buf, 1023, "Service %s BODY BYTES IN", service); srv_xdata->stat_body_bytes_in = ci_stat_entry_register(buf, STAT_KBS_T, stat_group); snprintf(buf, 1023, "Service %s BODY BYTES OUT", service); srv_xdata->stat_body_bytes_out = ci_stat_entry_register(buf, STAT_KBS_T, stat_group); } /*Must called only in initialization procedure. It is not thread-safe! */ ci_service_module_t *add_service(ci_service_module_t *service) { struct ci_service_xdata *xdata=NULL; struct ci_conf_entry *cfg_table; int ret; if (service_list == NULL) { service_list_size = STEP; service_list = malloc(service_list_size * sizeof(ci_service_module_t *)); service_extra_data_list = malloc(service_list_size * sizeof(ci_service_xdata_t)); } else if (services_num == service_list_size) { service_list_size += STEP; service_list = realloc(service_list, service_list_size * sizeof(ci_service_module_t *)); service_extra_data_list = realloc(service_extra_data_list, service_list_size * sizeof(ci_service_xdata_t)); } if (service_list == NULL || service_extra_data_list == NULL) { ci_debug_printf(1, "Fatal error: Cannot allocate memory! Exiting immediately!\n"); exit(-1); } xdata = &service_extra_data_list[services_num]; init_extra_data(xdata, service->mod_name); if (service->mod_init_service) { ret = service->mod_init_service(xdata, &CI_CONF); if (ret != CI_OK) xdata->status = CI_SERVICE_ERROR; else xdata->status = CI_SERVICE_OK; } else xdata->status = CI_SERVICE_OK; service_list[services_num++] = service; cfg_table = create_service_conf_table(xdata, service->mod_conf_table); xdata->intl_srv_conf_table = cfg_table; if (cfg_table) register_conf_table(service->mod_name, cfg_table, MAIN_TABLE); return service; } ci_service_module_t *register_service(const char *service_file) { ci_service_module_t *service; service = create_service(service_file); if (!service) { ci_debug_printf(3, "Error while loading service %s\n", service_file); return NULL; } if (find_service(service->mod_name) != NULL) { ci_debug_printf(1, "Error, the service %s is already loaded\n", service->mod_name); return NULL; } return add_service(service); } ci_service_module_t *find_service(const char *service_name) { int i; for (i = 0; i < services_num; i++) { if (strcmp(service_list[i]->mod_name, service_name) == 0) return (service_list[i]); } return NULL; /* return find_service_by_alias(service_name);*/ } ci_service_xdata_t *service_data(ci_service_module_t * srv) { int i; for (i = 0; i < services_num; i++) { if (service_list[i] == srv) return &(service_extra_data_list[i]); } return NULL; } extern ci_service_module_t info_service; int init_services() { int ret =0; if (add_service(&info_service) != NULL) ret = 1; return ret; } int post_init_services() { int i, ret; ci_service_xdata_t *xdata; for (i = 0; i < services_num; i++) { if (service_list[i]->mod_post_init_service != NULL) { xdata = &service_extra_data_list[i]; if ( xdata->status == CI_SERVICE_OK) { ret = service_list[i]-> mod_post_init_service(xdata, &CI_CONF); if (ret != CI_OK) xdata->status = CI_SERVICE_ERROR; } } } return 1; } int release_services() { int i; struct ci_conf_entry *table; for (i = 0; i < service_aliases_num; i++) { unregister_conf_table(service_aliases[i].alias); } for (i = 0; i < services_num; i++) { if (service_list[i]->mod_close_service != NULL) { service_list[i]->mod_close_service(); ci_thread_rwlock_destroy(&service_extra_data_list[i].lock); table = unregister_conf_table(service_list[i]->mod_name); if(table!=service_extra_data_list[i].intl_srv_conf_table){ ci_debug_printf(1, "Error unregistering service %s configuration table\n", service_list[i]->mod_name); } if(table) free(table); service_extra_data_list[i].intl_srv_conf_table = NULL; } } free(service_list); service_list = NULL; service_list_size = 0; services_num = 0; free(service_aliases); service_aliases = NULL; service_aliases_size = 0; service_aliases_num = 0; return 1; } /********************** Service aliases *****************************/ service_alias_t *add_service_alias(const char *service_alias, const char *service_name, const char *args) { ci_service_module_t *service = NULL; service_alias_t *salias = NULL; ci_service_xdata_t *xdata = NULL; int len = 0; int alias_indx = 0; if (!strcmp(service_alias, service_name)) { ci_debug_printf(1, "Warning, alias is the same as service_name, not adding\n"); return NULL; } if (service_aliases == NULL) { service_aliases = malloc(STEP * sizeof(service_alias_t)); service_aliases_size = STEP; } else if (service_aliases_num == service_aliases_size) { service_aliases_size += STEP; service_aliases = realloc(service_aliases, service_aliases_size * sizeof(service_alias_t)); } if (service_aliases == NULL) { ci_debug_printf(1, "add_service_alias: Error allocating memory. Exiting...\n"); exit(-1); } service = find_service(service_name); if (!service) { salias = find_service_alias(service_name); if (!salias) return NULL; service = salias->service; } xdata = service_data(service); alias_indx = service_aliases_num; service_aliases_num++; service_aliases[alias_indx].service = service; strncpy(service_aliases[alias_indx].alias, service_alias, MAX_SERVICE_NAME); service_aliases[alias_indx].alias[MAX_SERVICE_NAME] = '\0'; service_aliases[alias_indx].args[0] = '\0'; if (salias) { len = strlen(salias->args); strcpy(service_aliases[alias_indx].args, salias->args); /*we had check for len */ } if (args && len) { service_aliases[alias_indx].args[len] = '&'; len++; } if (args && MAX_SERVICE_ARGS - len > 0) { strcpy(service_aliases[alias_indx].args + len, args); } service_aliases[alias_indx].args[MAX_SERVICE_ARGS] = '\0'; if (xdata->intl_srv_conf_table) register_conf_table(service_aliases[alias_indx].alias, xdata->intl_srv_conf_table, ALIAS_TABLE); return &(service_aliases[alias_indx]); } ci_service_module_t *find_service_by_alias(const char *service_name) { int i; for (i = 0; i < service_aliases_num; i++) { if (strcmp(service_aliases[i].alias, service_name) == 0) return (service_aliases[i].service); } return NULL; } service_alias_t *find_service_alias(const char *service_name) { int i; for (i = 0; i < service_aliases_num; i++) { if (strcmp(service_aliases[i].alias, service_name) == 0) return &(service_aliases[i]); } return NULL; } /********************************************************************** The code for the default handler (C_handler) that handles services written in C/C++ and loaded as dynamic libraries **********************************************************************/ ci_service_module_t *load_c_service(const char *service_file); void release_c_handler(); service_handler_module_t c_service_handler = { "C_handler", ".so,.sa,.a", NULL, /*init */ NULL, /*post_init */ release_c_handler, load_c_service, NULL /*config table .... */ }; ci_service_module_t *load_c_service(const char *service_file) { ci_service_module_t *service = NULL; CI_DLIB_HANDLE service_handle; service_handle = ci_module_load(service_file, CI_CONF.SERVICES_DIR); if (!service_handle) return NULL; service = ci_module_sym(service_handle, "service"); if (!service) { ci_debug_printf(1, "Not found symbol \"service\" in library, unload it\n"); ci_module_unload(service_handle, service_file); return NULL; } ci_dlib_entry((service->mod_name != NULL ? service->mod_name : ""), service_file, service_handle); return service; } void release_c_handler() { } c_icap-0.4.2/ChangeLog0000664000175000017500000000000012567550777011443 00000000000000c_icap-0.4.2/txt_format.c0000664000175000017500000004550512567550777012247 00000000000000/* * Copyright (C) 2004-2010 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include "request.h" #include "simple_api.h" #include "debug.h" #include "txt_format.h" #define MAX_VARIABLE_SIZE 256 int fmt_none(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_percent(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_remoteip(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_localip(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_icapstatus(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_icapmethod(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_service(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_username(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_request(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_localtime(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_gmttime(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_seconds(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_httpclientip(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_httpserverip(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_http_req_url_o(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_http_req_head_o(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_http_res_head_o(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_icap_req_head(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_icap_res_head(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_req_bytes_rcv(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_req_bytes_sent(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_req_http_bytes_rcv(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_req_http_bytes_sent(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_req_body_bytes_rcv(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_req_body_bytes_sent(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_req_preview_hex(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_req_preview_len(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_logstr(ci_request_t *req_data, char *buf,int len, const char *param); int fmt_req_attribute(ci_request_t *req_data, char *buf,int len, const char *param); /** \brief Internal formating directives table. \ingroup FORMATING * * This table define the following directives:\n * \em "%a": Remote IP-Address \n * \em "%la": Local IP Address \n * \em "%lp": Local port \n * \em "%>a": Http Client IP Address \n * \em "%ho": Modified Http request header \n * \em "%huo": Modified Http request url \n * \em "%ih": Icap request header \n * \em "%hi": Http request header \n * \em "%a", "Http Client IP Address", fmt_httpclientip}, {"%hi", "Http request header", fmt_none}, {"%>ho", "Modified Http request header", fmt_http_req_head_o}, {"%huo", "Modified Http request url", fmt_http_req_url_o}, {"%hu", "Http request url", fmt_none}, {"%ih", "Icap request header", fmt_icap_req_head}, {"% 0) { if (*s == '%') { fmte = check_tables(s, user_table, &directive_len, &width, &left_align, parameter); ci_debug_printf(7,"Width: %d, Parameter:%s\n", width, parameter); if (width != 0) space = width = (remainsformat(req_data, b, space, parameter); if (val_len <=0) val_len = fmt_none(req_data, b, space, parameter); if (val_len > space) val_len = space; b += val_len; for (i=0; i < width-val_len; i++) b[i]=' '; b += width-val_len; } else if ((lb = malloc((space+1)*sizeof(char))) != NULL) { val_len=fmte->format(req_data, lb, space, parameter); if (val_len <=0) val_len = fmt_none(req_data, lb, space, parameter); if (val_len > space) val_len = space; for (i=0; i < width-val_len; i++) b[i]=' '; b += width-val_len; for (i=0; i < val_len; i++) b[i]=lb[i]; b += val_len; free(lb); lb = NULL; } /*else allocation failed! Just ignore?????*/ remains -= width; } else { val_len=fmte->format(req_data, b, space, parameter); if (val_len <=0) val_len = fmt_none(req_data, b, space, parameter); if (val_len > space) val_len = space; b += val_len; remains -= val_len; } s += directive_len; } else *b++ = *s++, remains--; } else *b++ = *s++, remains--; } *b = '\0'; return len-remains; } /******************************************************************/ int fmt_remoteip(ci_request_t *req, char *buf,int len, const char *param) { if (lenconnection, buf)) strcpy(buf, "-" ); return strlen(buf); } int fmt_localip(ci_request_t *req, char *buf,int len, const char *param) { if (lenconnection, buf)) strcpy(buf, "-" ); return strlen(buf); } int fmt_icapmethod(ci_request_t *req, char *buf,int len, const char *param) { int i; const char *s = ci_method_string(req->type); for(i=0;iservice; for(i=0;iuser; for(i=0;iservice; for(i=0;iargs[0]!='\0' && iargs; i++; for(;ireturn_code)); } int fmt_seconds(ci_request_t *req, char *buf,int len, const char *param) { time_t tm; time(&tm); return snprintf(buf, len, "%ld", tm); } int fmt_httpclientip(ci_request_t *req, char *buf,int len, const char *param) { const char *s; int i; if (!len) return 0; if ((s = ci_headers_value(req->request_header, "X-Client-IP")) != NULL) { for(i=0;irequest_header, "X-Server-IP")) != NULL) { for(i=0;iused) s = http_resp_headers->headers[0]; } else { s = ci_http_response_get_header(req, param); } if (s) { for (i=0;irequest_header && req->request_header->used) s = req->request_header->headers[0]; } else { s = ci_headers_value(req->request_header, param); } if (s) { for(i=0;iresponse_header && req->response_header->used) s = req->response_header->headers[0]; } else { s = ci_headers_value(req->response_header, param); /*if not found try xheaders which will also sent to user*/ if (!s && req->xheaders) s = ci_headers_value(req->xheaders, param); } if (s) { for(i=0;ibytes_in); } int fmt_req_bytes_sent(ci_request_t *req, char *buf,int len, const char *param) { return snprintf(buf, len, "%" PRINTF_OFF_T , (CAST_OFF_T) req->bytes_out); } int fmt_req_http_bytes_rcv(ci_request_t *req, char *buf,int len, const char *param) { return snprintf(buf, len, "%" PRINTF_OFF_T , (CAST_OFF_T) req->http_bytes_in); } int fmt_req_http_bytes_sent(ci_request_t *req, char *buf,int len, const char *param) { return snprintf(buf, len, "%" PRINTF_OFF_T , (CAST_OFF_T) req->http_bytes_out); } int fmt_req_body_bytes_rcv(ci_request_t *req, char *buf,int len, const char *param) { return snprintf(buf, len, "%" PRINTF_OFF_T , (CAST_OFF_T) req->body_bytes_in); } int fmt_req_body_bytes_sent(ci_request_t *req, char *buf,int len, const char *param) { return snprintf(buf, len, "%" PRINTF_OFF_T , (CAST_OFF_T) req->body_bytes_out); } int fmt_req_preview_hex(ci_request_t *req, char *buf,int len, const char *param) { int i, num, n, bytes; if (!len) return 0; if (req->preview_data.used <= 0) { *buf = '-'; return 1; } if (param) { num = strtol(param, NULL, 10); } else num = 5; n = 0; for (i=0; ipreview_data.used && len > 0; i++) { if (req->preview_data.buf[i] >= ' ' && req->preview_data.buf[i] <= '~') { buf[n++] = req->preview_data.buf[i]; len --; } else { bytes = snprintf(buf+n, len, "\\x%X",0xFF & (buf[i])); if (bytes > len) bytes = len; n += bytes; len -= bytes; } } return n; } int fmt_req_preview_len(ci_request_t *req, char *buf, int len, const char *param) { if (!len) return 0; if (req->preview >=0 ) return snprintf(buf, len, "%d", req->preview_data.used); *buf = '-'; return 1; } int fmt_logstr(ci_request_t *req, char *buf,int len, const char *param) { int i; const char *s; if (!req->log_str) return 0; s = req->log_str; for(i=0;iattributes) return 0; if (! (s =ci_str_array_search(req->attributes, param))) return 0; for(i=0; i #include #include #include "debug.h" #include "header.h" const char *ci_common_headers[] = { "Cache-Control", "Connection", "Date", "Expires", "Pragma", "Trailer", "Upgrade", /*And ICAP speciffic headers ..... */ "Encapsulated" }; const char *ci_methods[] = { "", /*0x00 */ "OPTIONS", /*0x01 */ "REQMOD", /*0x02 */ "", /*0x03 */ "RESPMOD" /*0x04 */ }; const char *ci_request_headers[] = { "Authorization", "Allow", "From", "Host", /*REQUIRED ...... */ "Referer", "User-Agent", /*And ICAP specific headers ..... */ "Preview" }; const char *ci_responce_headers[] = { "Server", /*ICAP spacific headers */ "ISTag" }; const char *ci_options_headers[] = { "Methods", "Service", "ISTag", "Encapsulated", "Opt-body-type", "Max-Connections", "Options-TTL", "Date", "Service-ID", "Allow", "Preview", "Transfer-Preview", "Transfer-Ignore", "Transfer-Complete" }; const struct ci_error_code ci_error_codes[] = { {100, "Continue"}, /*Continue after ICAP Preview */ {200, "OK"}, {204, "Unmodified"}, /*No modifications needed */ {206, "Partial Content"}, /*Partial content modification*/ {400, "Bad request"}, /*Bad request */ {401, "Unauthorized"}, {403, "Forbidden"}, {404, "Service not found"}, /*ICAP Service not found */ {405, "Not allowed"}, /*Method not allowed for service (e.g., RESPMOD requested for service that supports only REQMOD). */ {407, "Authentication Required"}, {408, "Request timeout"}, /*Request timeout. ICAP server gave up waiting for a request from an ICAP client */ {500, "Server error"}, /*Server error. Error on the ICAP server, such as "out of disk space" */ {501, "Not implemented"}, /*Method not implemented. This response is illegal for an OPTIONS request since implementation of OPTIONS is mandatory. */ {502, "Bad Gateway"}, /*Bad Gateway. This is an ICAP proxy and proxying produced an error. */ {503, "Service overloaded"}, /*Service overloaded. The ICAP server has exceeded a maximum connection limit associated with this service; the ICAP client should not exceed this limit in the future. */ {505, "Unsupported version"} /*ICAP version not supported by server. */ }; /* #ifdef __CYGWIN__ int ci_error_code(int ec){ return (ec>=EC_100&&ec=EC_100&&ec= ICAP_OPTIONS ? CI_Methods[method] : unknownmethod); } const char *ci_encaps_entity_string(int e) { return (e <= ICAP_OPT_BODY && e >= ICAP_REQ_HDR ? CI_EncapsEntities[e] : unknownentity); } #endif ci_headers_list_t *ci_headers_create() { ci_headers_list_t *h; h = malloc(sizeof(ci_headers_list_t)); if (!h) { ci_debug_printf(1, "Error allocation memory for ci_headers_list_t (header.c: ci_headers_create)\n"); return NULL; } h->headers = NULL; h->buf = NULL; if (!(h->headers = malloc(HEADERSTARTSIZE * sizeof(char *))) || !(h->buf = malloc(HEADSBUFSIZE * sizeof(char)))) { ci_debug_printf(1, "Server Error: Error allocation memory \n"); if (h->headers) free(h->headers); if (h->buf) free(h->buf); free(h); return NULL; } h->size = HEADERSTARTSIZE; h->used = 0; h->bufsize = HEADSBUFSIZE; h->bufused = 0; h->packed = 0; return h; } void ci_headers_destroy(ci_headers_list_t * h) { free(h->headers); free(h->buf); free(h); } int ci_headers_setsize(ci_headers_list_t * h, int size) { char *newbuf; int new_size; if (size < h->bufsize) return 1; /*Allocate buffer of size multiple of HEADSBUFSIZE */ new_size = (size / HEADSBUFSIZE + 1) * HEADSBUFSIZE; newbuf = realloc(h->buf, new_size * sizeof(char)); if (!newbuf) { ci_debug_printf(1, "Server Error:Error allocation memory \n"); return 0; } h->buf = newbuf; h->bufsize = new_size; return 1; } void ci_headers_reset(ci_headers_list_t * h) { h->packed = 0; h->used = 0; h->bufused = 0; } const char *ci_headers_add(ci_headers_list_t * h, const char *line) { char *newhead, **newspace, *newbuf; int len, linelen; int i = 0; if (h->packed) { /*Not in edit mode*/ return NULL; } if (h->used == h->size) { len = h->size + HEADERSTARTSIZE; newspace = realloc(h->headers, len * sizeof(char *)); if (!newspace) { ci_debug_printf(1, "Server Error:Error allocation memory \n"); return NULL; } h->headers = newspace; h->size = len; } linelen = strlen(line); len = h->bufsize; while ( len - h->bufused < linelen + 4 ) len += HEADSBUFSIZE; if (len > h->bufsize) { newbuf = realloc(h->buf, len * sizeof(char)); if (!newbuf) { ci_debug_printf(1, "Server Error:Error allocation memory \n"); return NULL; } h->buf = newbuf; h->bufsize = len; h->headers[0] = h->buf; for (i = 1; i < h->used; i++) h->headers[i] = h->headers[i - 1] + strlen(h->headers[i - 1]) + 2; } newhead = h->buf + h->bufused; strcpy(newhead, line); h->bufused += linelen + 2; //2 char size for \r\n at the end of each header *(newhead + linelen + 1) = '\n'; *(newhead + linelen + 3) = '\n'; if (newhead) h->headers[h->used++] = newhead; return newhead; } int ci_headers_addheaders(ci_headers_list_t * h, const ci_headers_list_t * headers) { int len, i; char *newbuf, **newspace; if (h->packed) { /*Not in edit mode*/ return 0; } len = h->size; while ( len - h->used < headers->used ) len += HEADERSTARTSIZE; if ( len > h->size ) { newspace = realloc(h->headers, len * sizeof(char *)); if (!newspace) { ci_debug_printf(1, "Server Error: Error allocating memory \n"); return 0; } h->headers = newspace; h->size = len; } len = h->bufsize; while (len - h->bufused < headers->bufused + 2) len += HEADSBUFSIZE; if (len > h->bufsize) { newbuf = realloc(h->buf, len * sizeof(char)); if (!newbuf) { ci_debug_printf(1, "Server Error: Error allocating memory \n"); return 0; } h->buf = newbuf; h->bufsize = len; } memcpy(h->buf + h->bufused, headers->buf, headers->bufused + 2); h->bufused += headers->bufused; h->used += headers->used; h->headers[0] = h->buf; for (i = 1; i < h->used; i++) h->headers[i] = h->headers[i - 1] + strlen(h->headers[i - 1]) + 2; return 1; } const char *ci_headers_search(ci_headers_list_t * h, const char *header) { int i; for (i = 0; i < h->used; i++) { if (strncasecmp(h->headers[i], header, strlen(header)) == 0) return h->headers[i]; } return NULL; } const char *ci_headers_value(ci_headers_list_t * h, const char *header) { const char *phead; if (!(phead = ci_headers_search(h, header))) return NULL; while (*phead != '\0' && *phead != ':') phead++; if (*phead != ':') return NULL; phead++; while (isspace(*phead) && *phead != '\0') phead++; return phead; } const char *ci_headers_copy_value(ci_headers_list_t * h, const char *header, char *buf, size_t len) { const char *phead; int i; if (!(phead = ci_headers_search(h, header))) return NULL; if (h->packed) while (*phead != '\0' && *phead != ':' && *phead != '\r' && *phead !='\n') phead++; else while (*phead != '\0' && *phead != ':') phead++; if (*phead != ':') return NULL; phead++; /*skip spaces at the beginning*/ while (isspace(*phead) && *phead != '\0') phead++; /*phead now points to the biggining of the header value.*/ /*copy value to buf*/ for(i=0; i < len-1 && *phead != '\0' && *phead != '\r' && *phead != '\n'; i++, phead++) buf[i] = *phead; buf[i] = '\0'; return buf; } int ci_headers_remove(ci_headers_list_t * h, const char *header) { char *phead; int i, j, header_len, rest_len; if (h->packed) { /*Not in edit mode*/ return 0; } for (i = 0; i < h->used; i++) { if (strncasecmp(h->headers[i], header, strlen(header)) == 0) { /*remove it........ */ phead = h->headers[i]; if (i == h->used - 1) { phead = h->headers[i]; *phead = '\r'; *(phead + 1) = '\n'; h->bufused = (phead - h->buf); (h->used)--; return 1; } else { header_len = h->headers[i + 1] - h->headers[i]; rest_len = h->bufused - (h->headers[i] - h->buf) - header_len; ci_debug_printf(5, "remove_header : remain len %d\n", rest_len); memmove(phead, h->headers[i + 1], rest_len); /*reconstruct index..... */ h->bufused -= header_len; (h->used)--; for (j = i + 1; j < h->used; j++) { header_len = strlen(h->headers[j - 1]); h->headers[j] = h->headers[j - 1] + header_len + 1; if (h->headers[j][0] == '\n') (h->headers[j])++; } return 1; } } } return 0; } const char *ci_headers_replace(ci_headers_list_t * h, const char *header, const char *newval) { if (h->packed) /*Not in edit mode*/ return NULL; return NULL; } #define eoh(s) ((*s == '\r' && *(s+1) == '\n' && *(s+2) != '\t' && *(s+2) != ' ') || (*s == '\n' && *(s+1) != '\t' && *(s+1) != ' ')) int ci_headers_iterate(ci_headers_list_t * h, void *data, void (*fn)(void *, const char *head, const char *value)) { char header[256]; char value[8196]; char *s; int i, j; for (i = 0; i < h->used; i++) { s = h->headers[i]; for (j = 0; j < sizeof(header)-1 && *s != ':' && *s != ' ' && *s != '\0' && *s != '\r' && *s!='\n'; s++, j++) header[j] = *s; header[j] = '\0'; j = 0; if (*s == ':') { s++; } else { header[0] = '\0'; s = h->headers[i]; } while (*s == ' ') s++; for (j = 0; j < sizeof(value)-1 && *s != '\0' && !eoh(s); s++, j++) value[j] = *s; value[j] = '\0'; fn(data, header, value); } return 1; } void ci_headers_pack(ci_headers_list_t * h) { /*Put the \r\n sequence at the end of each header before sending...... */ int i = 0, len = 0; for (i = 0; i < h->used; i++) { len = strlen(h->headers[i]); if (h->headers[i][len + 1] == '\n') { h->headers[i][len] = '\r'; /* h->headers[i][len+1]='\n';*/ } else { /* handle the case that headers seperated with a '\n' only */ h->headers[i][len] = '\n'; } } if (h->buf[h->bufused + 1] == '\n') { h->buf[h->bufused] = '\r'; /* h->buf[h->bufused+1]='\n';*/ h->bufused += 2; } else { /* handle the case that headers seperated with a '\n' only */ h->buf[h->bufused] = '\n'; h->bufused++; } h->packed = 1; } int ci_headers_unpack(ci_headers_list_t * h) { int len, eoh; char **newspace; char *shead, *ebuf, *str; if (h->bufused < 2) /*???????????? */ return EC_400; ebuf = h->buf + h->bufused - 2; /* ebuf now must indicate the last \r\n so: */ if (*ebuf != '\r' && *ebuf != '\n') { /*Some sites return (this is bug ) a simple '\n' as end of header ..... */ ci_debug_printf(3, "Parse error. The end chars are %c %c (%d %d) not the \\r \n", *ebuf, *(ebuf + 1), (unsigned int) *ebuf, (unsigned int) *(ebuf + 1)); return EC_400; /*Bad request .... */ } *ebuf = '\0'; shead = h->buf; h->headers[0] = h->buf; h->used = 1; for (str = h->buf; str < ebuf; str++) { /*Construct index of headers */ eoh = 0; if ((*str == '\r' && *(str + 1) == '\n')) { if ((str + 2) >= ebuf || (*(str + 2) != '\t' && *(str + 2) != ' ')) eoh = 1; } else if (*str == '\n' && *(str + 1) != '\t' && *(str + 1) != ' ') { /*handle the case that headers seperated with a '\n' only */ eoh = 1; } else if (*str == '\0') /*Then we have a problem. This char is important for us. Yes can happen! */ *str = ' '; if (eoh) { *str = '\0'; if (h->size <= h->used) { /* Resize the headers index space ........ */ len = h->size + HEADERSTARTSIZE; newspace = realloc(h->headers, len * sizeof(char *)); if (!newspace) { ci_debug_printf(1, "Server Error: Error allocating memory \n"); return EC_500; } h->headers = newspace; h->size = len; } str++; if (*str == '\n') str++; /* handle the case that headers seperated with a '\n' only */ h->headers[h->used] = str; h->used++; } } h->packed = 0; /*OK headers index construction ...... */ return EC_100; } /********************************************************************************************/ /* Entities List */ ci_encaps_entity_t *mk_encaps_entity(int type, int val) { ci_encaps_entity_t *h; h = malloc(sizeof(ci_encaps_entity_t)); if (!h) return NULL; h->start = val; h->type = type; if (type == ICAP_REQ_HDR || type == ICAP_RES_HDR) h->entity = ci_headers_create(); else h->entity = NULL; return h; } void destroy_encaps_entity(ci_encaps_entity_t * e) { if (e->type == ICAP_REQ_HDR || e->type == ICAP_RES_HDR) { ci_headers_destroy((ci_headers_list_t *) e->entity); } else free(e->entity); free(e); } int get_encaps_type(const char *buf, int *val, char **endpoint) { if (0 == strncmp(buf, "req-hdr", 7)) { *val = strtol(buf + 8, endpoint, 10); return ICAP_REQ_HDR; } if (0 == strncmp(buf, "res-hdr", 7)) { *val = strtol(buf + 8, endpoint, 10); return ICAP_RES_HDR; } if (0 == strncmp(buf, "req-body", 8)) { *val = strtol(buf + 9, endpoint, 10); return ICAP_REQ_BODY; } if (0 == strncmp(buf, "res-body", 8)) { *val = strtol(buf + 9, endpoint, 10); return ICAP_RES_BODY; } if (0 == strncmp(buf, "null-body", 9)) { *val = strtol(buf + 10, endpoint, 10); return ICAP_NULL_BODY; } return -1; } int sizeofheader(ci_headers_list_t * h) { /* int size=0,i; for(i=0;iused;i++){ size+=strlen(h->headers[i])+2; } size+=2; return size; */ return h->bufused + 2; } int sizeofencaps(ci_encaps_entity_t * e) { if (e->type == ICAP_REQ_HDR || e->type == ICAP_RES_HDR) { return sizeofheader((ci_headers_list_t *) e->entity); } return 0; } c_icap-0.4.2/cfg_lib.c0000664000175000017500000001661012567550777011440 00000000000000/* * Copyright (C) 2004-2010 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include #include "cfg_param.h" #include "mem.h" #include "debug.h" /*************************************************************************/ /* Memory managment for config parameters definitions and implementation */ #define ALLOCATOR_SIZE 65536 ci_mem_allocator_t *cfg_params_allocator = NULL; void ci_cfg_lib_init() { cfg_params_allocator = ci_create_serial_allocator(ALLOCATOR_SIZE); } void ci_cfg_lib_reset() { cfg_params_allocator->reset(cfg_params_allocator); } void *ci_cfg_alloc_mem(int size) { return cfg_params_allocator->alloc(cfg_params_allocator, size); } /****************************************************************/ /* Command line options implementation, function and structures */ void ci_args_usage(const char *progname, struct ci_options_entry *options) { int i; printf("Usage : \n"); printf("%s", progname); for (i = 0; options[i].name != NULL; i++) { if (options[i].name[0] == '$') printf(" [file1] [file2] ..."); else printf(" [%s %s]", options[i].name, (options[i].parameter == NULL ? "" : options[i].parameter)); } printf("\n\n"); for (i = 0; options[i].name != NULL; i++) if (options[i].name[0] == '$') printf(" [file1] [file2] ...\t: %s\n", options[i].msg); else printf("%s %s\t\t: %s\n", options[i].name, (options[i].parameter == NULL ? "\t" : options[i].parameter), options[i].msg); } struct ci_options_entry *search_options_table(const char *directive, struct ci_options_entry *options) { int i; const char *option_search; if (directive[0] != '-') option_search = "$$"; else option_search = directive; for (i = 0; options[i].name != NULL; i++) { if (0 == strcmp(option_search, options[i].name)) return &options[i]; } return NULL; } int ci_args_apply(int argc, char *argv[], struct ci_options_entry *options) { int i; struct ci_options_entry *entry; const char *act_args[2]; act_args[1] = NULL; for (i = 1; i < argc; i++) { if ((entry = search_options_table(argv[i], options)) == NULL) return 0; if (entry->parameter) { if (++i >= argc) return 0; act_args[0] = argv[i]; (*(entry->action)) (entry->name, act_args, entry->data); } else { /*maybe is the "$$" directive ....*/ if (strcmp(entry->name, "$$") == 0) { act_args[0] = argv[i]; (*(entry->action)) (entry->name, act_args, entry->data); } else (*(entry->action)) (entry->name, NULL, entry->data); } } return 1; } /****************************************************************************/ /*Various functions for setting parameters from command line or config file */ int ci_cfg_set_int(const char *directive, const char **argv, void *setdata) { int val = 0; char *end; if (setdata == NULL) return 0; if (argv == NULL || argv[0] == NULL) { ci_debug_printf(1, "Missing arguments in directive:%s\n", directive); return 0; } errno = 0; val = strtoll(argv[0], &end, 10); if ((val == 0 && errno != 0)) return 0; *((int *) setdata) = val; ci_debug_printf(2, "Setting parameter :%s=%d\n", directive, val); return 1; } int ci_cfg_set_str(const char *directive, const char **argv, void *setdata) { if (setdata == NULL) return 0; if (argv == NULL || argv[0] == NULL) { return 0; } if (!(*((char **) setdata) = ci_cfg_alloc_mem(strlen(argv[0]) + 1))) { return 0; } strcpy(*((char **) setdata), argv[0]); /* *((char **) setdata) = (char *) strdup(argv[0]); */ ci_debug_printf(2, "Setting parameter :%s=%s\n", directive, argv[0]); return 1; } int ci_cfg_onoff(const char *directive, const char **argv, void *setdata) { if (setdata == NULL) return 0; if (argv == NULL || argv[0] == NULL) { ci_debug_printf(1, "Missing arguments in directive:%s\n", directive); return 0; } if (strcasecmp(argv[0], "on") == 0) *((int *) setdata) = 1; else if (strcasecmp(argv[0], "off") == 0) *((int *) setdata) = 0; else return 0; ci_debug_printf(2, "Setting parameter :%s=%d\n", directive, *((int *) setdata)); return 1; } int ci_cfg_disable(const char *directive, const char **argv, void *setdata) { if (setdata == NULL) return 0; *((int *) setdata) = 0; ci_debug_printf(2, "Disabling parameter %s\n", directive); return 1; } int ci_cfg_enable(const char *directive, const char **argv, void *setdata) { if (setdata == NULL) return 0; *((int *) setdata) = 1; ci_debug_printf(2, "Enabling parameter %s\n", directive); return 1; } int ci_cfg_size_off(const char *directive, const char **argv, void *setdata) { ci_off_t val = 0; char *end; if (setdata == NULL) return 0; if (argv == NULL || argv[0] == NULL) { ci_debug_printf(1, "Missing arguments in directive:%s\n", directive); return 0; } errno = 0; val = ci_strto_off_t(argv[0], &end, 10); if ((val == 0 && errno != 0) || val < 0) return 0; if (*end == 'k' || *end == 'K') val = val * 1024; else if (*end == 'm' || *end == 'M') val = val * 1024 * 1024; if (val > 0) *((ci_off_t *) setdata) = val; ci_debug_printf(2, "Setting parameter :%s=%" PRINTF_OFF_T "\n", directive, (CAST_OFF_T) val); return 1; } int ci_cfg_size_long(const char *directive, const char **argv, void *setdata) { long int val = 0; char *end; if (setdata == NULL) return 0; if (argv == NULL || argv[0] == NULL) { ci_debug_printf(1, "Missing arguments in directive: %s\n", directive); return 0; } errno = 0; val = strtol(argv[0], &end, 10); if ((val == 0 && errno != 0) || val < 0) return 0; if (*end == 'k' || *end == 'K') val = val * 1024; else if (*end == 'm' || *end == 'M') val = val * 1024 * 1024; if (val > 0) *((long int *) setdata) = val; ci_debug_printf(2, "Setting parameter :%s=%ld\n", directive, val); return 1; } c_icap-0.4.2/aclocal.m40000664000175000017500000126263712601747522011545 00000000000000# generated automatically by aclocal 1.14.1 -*- Autoconf -*- # Copyright (C) 1996-2013 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. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # 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. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool 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. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 57 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # `#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test $lt_write_fail = 0 && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -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 Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test "$lt_cv_ld_force_load" = "yes"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script which will find a shell with a builtin # printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case "$ECHO" in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [ --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case ${with_sysroot} in #( yes) if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD="${LD-ld}_sol2" fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' library_names_spec='${libname}.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsdelf*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='NetBSD ld.elf_so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) /* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) _LT_TAGVAR(link_all_deplibs, $1)=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi _LT_TAGVAR(link_all_deplibs, $1)=no else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS="$save_LDFLAGS"]) if test "$lt_cv_irix_exported_symbol" = yes; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile="$lt_outputfile.exe" lt_tool_outputfile="$lt_tool_outputfile.exe" ;; esac~ func_to_tool_file "$lt_outputfile"~ if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test "$pre_test_object_deps_done" = no; then case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) # ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: ]) # _LT_PROG_REPLACE_SHELLFNS # ------------------------- # Replace existing portable implementations of several shell functions with # equivalent extended shell implementations where those features are available.. m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine which file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS # Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, # Inc. # Written by Gary V. Vaughan, 2004 # # 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. # serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS="$lt_save_ifs" ;; esac], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # 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. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) # ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # 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. # @configure_input@ # serial 3337 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.2]) m4_define([LT_PACKAGE_REVISION], [1.3337]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.2' macro_revision='1.3337' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # 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. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) # Copyright (C) 2002-2013 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. # 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. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.14' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.14.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.14.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2013 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. # 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. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2013 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. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl 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])]) # Copyright (C) 1999-2013 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. # 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", "OBJC", "OBJCXX", "UPC", or "GJC". # 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 m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$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". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$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 am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # 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. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; 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 ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2013 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. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf 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. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. 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 " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/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"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2013 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 macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # 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_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])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]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # 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 AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2013 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. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2013 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. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996-2013 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. # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless 'enable' is passed literally. # For symmetry, 'disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], am_maintainer_other[ make rules and dependencies not useful (and sometimes confusing) to the casual installer])], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2013 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. # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit 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 # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2013 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. # 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 is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # -*- Autoconf -*- # Obsolete and "removed" macros, that must however still report explicit # error messages when used, to smooth transition. # # Copyright (C) 1996-2013 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. AC_DEFUN([AM_CONFIG_HEADER], [AC_DIAGNOSE([obsolete], ['$0': this macro is obsolete. You should use the 'AC][_CONFIG_HEADERS' macro instead.])dnl AC_CONFIG_HEADERS($@)]) AC_DEFUN([AM_PROG_CC_STDC], [AC_PROG_CC am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc AC_DIAGNOSE([obsolete], ['$0': this macro is obsolete. You should simply use the 'AC][_PROG_CC' macro instead. Also, your code should no longer depend upon 'am_cv_prog_cc_stdc', but upon 'ac_cv_prog_cc_stdc'.])]) AC_DEFUN([AM_C_PROTOTYPES], [AC_FATAL([automatic de-ANSI-fication support has been removed])]) AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2013 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. # _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], [m4_foreach_w([_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])]) # Copyright (C) 1999-2013 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. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2013 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. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2013 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. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # 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 ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file 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 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 if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done 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]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2013 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. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2013 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. # AM_PROG_INSTALL_STRIP # --------------------- # 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="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2013 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. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2013 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. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR c_icap-0.4.2/compile0000755000175000017500000001624512601747524011252 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2013 Free Software Foundation, Inc. # Written by Tom Tromey . # # 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, see . # 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. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: c_icap-0.4.2/simple_api.c0000664000175000017500000002241312567550777012173 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "simple_api.h" #include "debug.h" #include #include /* int ci_resp_check_body(ci_request_t *req){ int i; ci_encaps_entity_t **e=req->entities; for(i=0;e[i]!=NULL;i++) if(e[i]->type==ICAP_NULL_BODY) return 0; return 1; } */ ci_headers_list_t * ci_http_response_headers(ci_request_t * req) { int i; ci_encaps_entity_t **e_list; e_list = req->entities; for (i = 0; e_list[i] != NULL && i < 3; i++) { /*It is the first or second ellement */ if (e_list[i]->type == ICAP_RES_HDR) return (ci_headers_list_t *) e_list[i]->entity; } return NULL; } ci_headers_list_t *ci_http_request_headers(ci_request_t * req) { ci_encaps_entity_t **e_list; e_list = req->entities; if (e_list[0] != NULL && e_list[0]->type == ICAP_REQ_HDR) /*It is always the first ellement */ return (ci_headers_list_t *) e_list[0]->entity; /*We did not found the request headers but maybe there are in req->trash objects Trying to retrieve hoping that it were not desstroyed yet */ if(req->trash_entities[ICAP_REQ_HDR] && req->trash_entities[ICAP_REQ_HDR]->entity && ((ci_headers_list_t *) req->trash_entities[ICAP_REQ_HDR]->entity)->used) return (ci_headers_list_t *) req->trash_entities[ICAP_REQ_HDR]->entity; return NULL; } int ci_http_response_reset_headers(ci_request_t * req) { ci_headers_list_t *heads; if (!(heads = ci_http_response_headers(req))) return 0; ci_headers_reset(heads); return 1; } int ci_http_request_reset_headers(ci_request_t * req) { ci_headers_list_t *heads; if (!(heads = ci_http_request_headers(req))) return 0; ci_headers_reset(heads); return 1; } /* This function will be used when we want to responce with an error message to an reqmod request or respmod request. ICAP rfc says that we must responce as: REQMOD response encapsulated_list: {[reshdr] resbody} RESPMOD response encapsulated_list: [reshdr] resbody */ int ci_http_response_create(ci_request_t * req, int has_reshdr, int has_body) { int i = 0; ci_encaps_entity_t **e_list; e_list = req->entities; for (i = 0; i < 4; i++) { if (req->entities[i]) { ci_request_release_entity(req, i); } } i = 0; if (has_reshdr) req->entities[i++] = ci_request_alloc_entity(req, ICAP_RES_HDR, 0); if (has_body) req->entities[i] = ci_request_alloc_entity(req, ICAP_RES_BODY, 0); else req->entities[i] = ci_request_alloc_entity(req, ICAP_NULL_BODY, 0); return 1; } int ci_http_request_create(ci_request_t * req, int has_body) { int i = 0; ci_encaps_entity_t **e_list; e_list = req->entities; for (i = 0; i < 4; i++) { if (req->entities[i]) { ci_request_release_entity(req, i); } } i = 0; req->entities[i++] = ci_request_alloc_entity(req, ICAP_REQ_HDR, 0); if (has_body) req->entities[i] = ci_request_alloc_entity(req, ICAP_REQ_BODY, 0); else req->entities[i] = ci_request_alloc_entity(req, ICAP_NULL_BODY, 0); return 1; } const char *ci_http_response_add_header(ci_request_t * req, const char *header) { ci_headers_list_t *heads; if(req->packed) /*Not in edit mode*/ return NULL; if (!(heads = ci_http_response_headers(req))) return NULL; return ci_headers_add(heads, header); } const char *ci_http_request_add_header(ci_request_t * req, const char *header) { ci_headers_list_t *heads; if(req->packed) /*Not in edit mode*/ return NULL; if (!(heads = ci_http_request_headers(req))) return NULL; return ci_headers_add(heads, header); } int ci_http_response_remove_header(ci_request_t * req, const char *header) { ci_headers_list_t *heads; if(req->packed) /*Not in edit mode*/ return 0; if (!(heads = ci_http_response_headers(req))) return 0; return ci_headers_remove(heads, header); } int ci_http_request_remove_header(ci_request_t * req, const char *header) { ci_headers_list_t *heads; if(req->packed) /*Not in edit mode*/ return 0; if (!(heads = ci_http_request_headers(req))) return 0; return ci_headers_remove(heads, header); } const char *ci_http_response_get_header(ci_request_t * req, const char *head_name) { ci_headers_list_t *heads; const char *val; if (!(heads = ci_http_response_headers(req))) return NULL; if (!(val = ci_headers_value(heads, head_name))) return NULL; return val; } const char *ci_http_request_get_header(ci_request_t * req, const char *head_name) { ci_headers_list_t *heads; const char *val; if (!(heads = ci_http_request_headers(req))) return NULL; if (!(val = ci_headers_value(heads, head_name))) return NULL; return val; } ci_off_t ci_http_content_length(ci_request_t * req) { ci_headers_list_t *heads; const char *val; ci_off_t res = 0; char *e; if (!(heads = ci_http_response_headers(req))) { /*Then maybe is a reqmod reauest, try to get request headers */ if (!(heads = ci_http_request_headers(req))) return 0; } if (!(val = ci_headers_value(heads, "Content-Length"))) return -1; errno = 0; res = ci_strto_off_t(val, &e, 10); if (errno == ERANGE && (res == CI_STRTO_OFF_T_MAX || res == CI_STRTO_OFF_T_MIN)) { ci_debug_printf(4, "Content-Length: overflow\n"); return -2; } if (val == e) { ci_debug_printf(4, "Content-Length: not valid value: '%s' \n", val); return -2; } return res; } const char *ci_http_request(ci_request_t * req) { ci_headers_list_t *heads; if (!(heads = ci_http_request_headers(req))) return NULL; if (!heads->used) return NULL; return heads->headers[0]; } const char *ci_icap_add_xheader(ci_request_t * req, const char *header) { return ci_headers_add(req->xheaders, header); } int ci_icap_append_xheaders(ci_request_t *req,ci_headers_list_t *headers) { return ci_headers_addheaders(req->xheaders, headers); } #define header_end(e) (e == '\0' || e == '\n' || e == '\r') int ci_http_request_url(ci_request_t * req, char *buf, int buf_size) { ci_headers_list_t *heads; const char *str, *host; int i, bytes; /*The request must have the form: GET url HTTP/X.X */ if (!(heads = ci_http_request_headers(req))) return 0; if (!heads->used) return 0; str = heads->headers[0]; if ((str = strchr(str, ' ')) == NULL) { /*Ignore method i*/ return 0; } while (*str == ' ') /*ignore spaces*/ str++; bytes = 0; if (*str == '/' && (host = ci_headers_value(heads,"Host"))) { /*Looks like a transparent proxy, we do not know the protocol lets try to preserve the major part of the url.... */ for (i=0; (i < buf_size-1) && !header_end(host[i]) && !isspace(host[i]); i++) { buf[i] = host[i]; } buf += i; buf_size -= i; bytes = i; } /*copy the url...*/ for (i=0; (i < buf_size-1) && !header_end(str[i]) && !isspace(str[i]) && str[i] != '?'; i++) { buf[i] = str[i]; } buf[i] = '\0'; bytes += i; return bytes; } const ci_ip_t * ci_http_client_ip(ci_request_t * req) { const char *ip; if (!req) return NULL; if (req->xclient_ip.family == -1) /*Already check and failed to read it*/ return NULL; if (req->xclient_ip.family != 0) /*Already check, return cached*/ return &req->xclient_ip; if (!(ip = ci_headers_value(req->request_header, "X-Client-IP"))) return NULL; #ifdef HAVE_IPV6 if(strchr(ip, ':')) { if (ci_inet_aton(AF_INET6, ip, &(req->xclient_ip.address))) { req->xclient_ip.family = AF_INET6; ci_ipv6_inaddr_hostnetmask(req->xclient_ip.netmask); } else req->xclient_ip.family = -1; } else #endif { if (ci_inet_aton(AF_INET, ip, &(req->xclient_ip.address))) { req->xclient_ip.family = AF_INET; ci_ipv4_inaddr_hostnetmask(req->xclient_ip.netmask); } else req->xclient_ip.family = -1; } if (req->xclient_ip.family == -1) /*Failed to read correctly*/ return NULL; return &req->xclient_ip; } c_icap-0.4.2/hash.c0000664000175000017500000000775212567550776011004 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "hash.h" #include "debug.h" #include unsigned int ci_hash_compute(unsigned long hash_max_value, const void *key, int len) { unsigned long hash = 5381; const unsigned char *s = key; int i; if(len) { for (i=0; ialloc(allocator, sizeof(struct ci_hash_table)); if(!htable) { /*a debug message ....*/ return NULL; } new_hash_size = 63; if(hash_size > 63) { while(new_hash_sizehash_table=allocator->alloc(allocator, (new_hash_size+1)*sizeof(struct ci_hash_entry *)); if(!htable->hash_table) { allocator->free(allocator, htable); return NULL; } memset(htable->hash_table, 0, (new_hash_size + 1)*sizeof(struct ci_hash_entry *)); htable->hash_table_size = new_hash_size; htable->ops = ops; htable->allocator = allocator; return htable; } void ci_hash_destroy(struct ci_hash_table *htable) { int i; struct ci_hash_entry *e; ci_mem_allocator_t *allocator = htable->allocator; for (i=0; i<= htable->hash_table_size; i++) { while(htable->hash_table[i]) { e = htable->hash_table[i]; htable->hash_table[i] = htable->hash_table[i]->hnext; allocator->free(allocator, e); } } htable->allocator->free(allocator,htable->hash_table ); allocator->free(allocator, htable); } const void * ci_hash_search(struct ci_hash_table *htable,const void *key) { struct ci_hash_entry *e; unsigned int hash=ci_hash_compute(htable->hash_table_size, key, htable->ops->size(key)); assert(hash <= htable->hash_table_size); /*is it possible?*/ e = htable->hash_table[hash]; while(e != NULL) { if(htable->ops->compare(e->key, key) == 0) return e->val; e=e->hnext; } return NULL; } void * ci_hash_add(struct ci_hash_table *htable, const void *key, const void *val) { struct ci_hash_entry *e; unsigned int hash=ci_hash_compute(htable->hash_table_size, key, htable->ops->size(key)); assert(hash <= htable->hash_table_size); e = htable->allocator->alloc(htable->allocator, sizeof(struct ci_hash_entry)); if(!e) return NULL; e->hnext = NULL; e->key=key; e->val=val; e->hash=hash; // if(htable->hash_table[hash]) // ci_debug_printf(9, "ci_hash_update:::Found %s\n", htable->hash_table[hash]->val); /*Make it the first entry in the current hash entry*/ e->hnext=htable->hash_table[hash]; htable->hash_table[hash] = e; return e; } c_icap-0.4.2/service_lib.c0000664000175000017500000001122012567550776012330 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include "service.h" #include "debug.h" void ci_service_data_read_lock(ci_service_xdata_t * srv_xdata) { ci_thread_rwlock_rdlock(&srv_xdata->lock); } void ci_service_data_read_unlock(ci_service_xdata_t * srv_xdata) { ci_thread_rwlock_unlock(&srv_xdata->lock); } void ci_service_set_istag(ci_service_xdata_t * srv_xdata, const char *istag) { ci_thread_rwlock_wrlock(&srv_xdata->lock); strncpy(srv_xdata->ISTag + SRV_ISTAG_POS, istag, SRV_ISTAG_SIZE - SRV_ISTAG_POS); srv_xdata->ISTag[SRV_ISTAG_SIZE] = '\0'; ci_thread_rwlock_unlock(&srv_xdata->lock); } void ci_service_set_transfer_preview(ci_service_xdata_t * srv_xdata, const char *preview) { ci_thread_rwlock_wrlock(&srv_xdata->lock); strcpy(srv_xdata->TransferPreview, "Transfer-Preview: "); strncat(srv_xdata->TransferPreview, preview, MAX_HEADER_SIZE - sizeof("Transfer-Preview: ")); ci_thread_rwlock_unlock(&srv_xdata->lock); } void ci_service_set_transfer_ignore(ci_service_xdata_t * srv_xdata, const char *ignore) { ci_thread_rwlock_wrlock(&srv_xdata->lock); strcpy(srv_xdata->TransferIgnore, "Transfer-Ignore: "); strncat(srv_xdata->TransferIgnore, ignore, MAX_HEADER_SIZE - sizeof("Transfer-Ignore: ")); ci_thread_rwlock_unlock(&srv_xdata->lock); } void ci_service_set_transfer_complete(ci_service_xdata_t * srv_xdata, const char *complete) { ci_thread_rwlock_wrlock(&srv_xdata->lock); strcpy(srv_xdata->TransferComplete, "Transfer-Complete: "); strncat(srv_xdata->TransferComplete, complete, MAX_HEADER_SIZE - sizeof("Transfer-Complete: ")); ci_thread_rwlock_unlock(&srv_xdata->lock); } void ci_service_set_preview(ci_service_xdata_t * srv_xdata, int preview) { ci_thread_rwlock_wrlock(&srv_xdata->lock); srv_xdata->preview_size = preview; ci_thread_rwlock_unlock(&srv_xdata->lock); } void ci_service_enable_204(ci_service_xdata_t * srv_xdata) { ci_thread_rwlock_wrlock(&srv_xdata->lock); srv_xdata->allow_204 = 1; ci_thread_rwlock_unlock(&srv_xdata->lock); } void ci_service_enable_206(ci_service_xdata_t * srv_xdata) { ci_thread_rwlock_wrlock(&srv_xdata->lock); if (!srv_xdata->disable_206) srv_xdata->allow_206 = 1; ci_thread_rwlock_unlock(&srv_xdata->lock); } void ci_service_set_max_connections(ci_service_xdata_t *srv_xdata, int max_connections) { ci_thread_rwlock_wrlock(&srv_xdata->lock); srv_xdata->max_connections = max_connections; ci_thread_rwlock_unlock(&srv_xdata->lock); } void ci_service_set_options_ttl(ci_service_xdata_t *srv_xdata, int ttl) { ci_thread_rwlock_wrlock(&srv_xdata->lock); srv_xdata->options_ttl = ttl; ci_thread_rwlock_unlock(&srv_xdata->lock); } void ci_service_set_xopts(ci_service_xdata_t * srv_xdata, uint64_t xopts) { ci_thread_rwlock_wrlock(&srv_xdata->lock); srv_xdata->xopts = xopts; ci_thread_rwlock_unlock(&srv_xdata->lock); } void ci_service_add_xopts(ci_service_xdata_t * srv_xdata, uint64_t xopts) { ci_thread_rwlock_wrlock(&srv_xdata->lock); srv_xdata->xopts |= xopts; ci_thread_rwlock_unlock(&srv_xdata->lock); } void ci_service_add_xincludes(ci_service_xdata_t * srv_xdata, char **xincludes) { int len, i; len = 0; i = 0; if (!xincludes) return; ci_thread_rwlock_wrlock(&srv_xdata->lock); while (XINCLUDES_SIZE - len - 2 > 0 && xincludes[i]) { if (len) { strcat(srv_xdata->xincludes, ", "); len += 2; } strncat(srv_xdata->xincludes, xincludes[i], XINCLUDES_SIZE - len); len += strlen(xincludes[i]); i++; } ci_thread_rwlock_unlock(&srv_xdata->lock); } c_icap-0.4.2/request.c0000664000175000017500000016433412567550777011552 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include #include #include #include #ifdef _NOTUSED #include #endif #include "debug.h" #include "request.h" #include "service.h" #include "access.h" #include "util.h" #include "simple_api.h" #include "cfg_param.h" #include "stats.h" extern int TIMEOUT; extern int KEEPALIVE_TIMEOUT; extern const char *DEFAULT_SERVICE; extern int PIPELINING; extern int CHECK_FOR_BUGGY_CLIENT; extern int ALLOW204_AS_200OK_ZERO_ENCAPS; /*This variable defined in mpm_server.c and become 1 when the child must halt imediatelly:*/ extern int CHILD_HALT; #define FORBITTEN_STR "ICAP/1.0 403 Forbidden\r\n\r\n" /*#define ISTAG "\"5BDEEEA9-12E4-2\""*/ static int STAT_REQUESTS = -1; static int STAT_FAILED_REQUESTS = -1; static int STAT_BYTES_IN = -1; static int STAT_BYTES_OUT = -1; static int STAT_HTTP_BYTES_IN = -1; static int STAT_HTTP_BYTES_OUT = -1; static int STAT_BODY_BYTES_IN = -1; static int STAT_BODY_BYTES_OUT = -1; static int STAT_REQMODS = -1; static int STAT_RESPMODS = -1; static int STAT_OPTIONS = -1; static int STAT_ALLOW204 = -1; void request_stats_init() { STAT_REQUESTS = ci_stat_entry_register("REQUESTS", STAT_INT64_T, "General"); STAT_REQMODS = ci_stat_entry_register("REQMODS", STAT_INT64_T, "General"); STAT_RESPMODS = ci_stat_entry_register("RESPMODS", STAT_INT64_T, "General"); STAT_OPTIONS = ci_stat_entry_register("OPTIONS", STAT_INT64_T, "General"); STAT_FAILED_REQUESTS = ci_stat_entry_register("FAILED REQUESTS", STAT_INT64_T, "General"); STAT_ALLOW204 = ci_stat_entry_register("ALLOW 204", STAT_INT64_T, "General"); STAT_BYTES_IN = ci_stat_entry_register("BYTES IN", STAT_KBS_T, "General"); STAT_BYTES_OUT = ci_stat_entry_register("BYTES OUT", STAT_KBS_T, "General"); STAT_HTTP_BYTES_IN = ci_stat_entry_register("HTTP BYTES IN", STAT_KBS_T, "General"); STAT_HTTP_BYTES_OUT = ci_stat_entry_register("HTTP BYTES OUT", STAT_KBS_T, "General"); STAT_BODY_BYTES_IN = ci_stat_entry_register("BODY BYTES IN", STAT_KBS_T, "General"); STAT_BODY_BYTES_OUT = ci_stat_entry_register("BODY BYTES OUT", STAT_KBS_T, "General"); } static int wait_for_data(ci_socket fd, int secs, int what_wait) { int wait_status; /*if we are going down do not wait....*/ if (CHILD_HALT) return CI_ERROR; do { wait_status =ci_wait_for_data(fd, secs, what_wait); if (wait_status < 0) return CI_ERROR; if (wait_status == 0 && CHILD_HALT) /*abort*/ return CI_ERROR; } while (wait_status == 0); return wait_status; } ci_request_t *newrequest(ci_connection_t * connection) { ci_request_t *req; int access; int len; ci_connection_t *conn; conn = (ci_connection_t *) malloc(sizeof(ci_connection_t)); assert(conn); ci_copy_connection(conn, connection); req = ci_request_alloc(conn); if ((access = access_check_client(req)) == CI_ACCESS_DENY) { /*Check for client access */ len = strlen(FORBITTEN_STR); ci_write(connection->fd, FORBITTEN_STR, len, TIMEOUT); ci_request_destroy(req); return NULL; /*Or something that means authentication error */ } req->access_type = access; return req; } int recycle_request(ci_request_t * req, ci_connection_t * connection) { int access; int len; ci_request_reset(req); ci_copy_connection(req->connection, connection); if ((access = access_check_client(req)) == CI_ACCESS_DENY) { /*Check for client access */ len = strlen(FORBITTEN_STR); ci_write(connection->fd, FORBITTEN_STR, len, TIMEOUT); return 0; /*Or something that means authentication error */ } req->access_type = access; return 1; } int keepalive_request(ci_request_t *req) { /* Preserve extra read bytes*/ char *pstrblock = req->pstrblock_read; int pstrblock_len = req->pstrblock_read_len; // Just reset without change or free memory ci_request_reset(req); if (PIPELINING) { req->pstrblock_read = pstrblock; req->pstrblock_read_len = pstrblock_len; } if (req->pstrblock_read && req->pstrblock_read_len > 0) return 1; return ci_wait_for_data(req->connection->fd, KEEPALIVE_TIMEOUT, wait_for_read); } /*Here we want to read in small blocks icap header becouse in most cases it will not bigger than 512-1024 bytes. So we are going to do small reads and small increments in icap headers size, to save some space and keep small the number of over-read bytes */ #define ICAP_HEADER_READSIZE 512 /*this function check if there is enough space in buffer buf ....*/ static int icap_header_check_realloc(char **buf, int *size, int used, int mustadded) { char *newbuf; int len; if (*size - used < mustadded) { len = *size + ICAP_HEADER_READSIZE; newbuf = realloc(*buf, len); if (!newbuf) { return EC_500; } *buf = newbuf; *size = *size + ICAP_HEADER_READSIZE; } return EC_100; } static int ci_read_icap_header(ci_request_t * req, ci_headers_list_t * h, int timeout) { int bytes, request_status = EC_100, i, eoh = 0, startsearch = 0, readed = 0; int wait_status = 0; char *buf_end; int dataPrefetch = 0; buf_end = h->buf; readed = 0; bytes = 0; if (PIPELINING && req->pstrblock_read && req->pstrblock_read_len > 0) { if ((request_status = icap_header_check_realloc(&(h->buf), &(h->bufsize), req->pstrblock_read_len, ICAP_HEADER_READSIZE)) != EC_100) return request_status; memmove(h->buf, req->pstrblock_read, req->pstrblock_read_len); readed = req->pstrblock_read_len; buf_end = h->buf; bytes = readed; dataPrefetch = 1; req->pstrblock_read = NULL; req->pstrblock_read_len = 0; ci_debug_printf(5, "Get data from previous request read.\n"); } do { if (!dataPrefetch) { if ((wait_status = wait_for_data(req->connection->fd, timeout, wait_for_read)) == CI_ERROR) return EC_408; bytes = ci_read_nonblock(req->connection->fd, buf_end, ICAP_HEADER_READSIZE); if (bytes <= 0) return EC_408; readed += bytes; req->bytes_in += bytes; } else dataPrefetch = 0; for (i = startsearch; i < bytes - 3; i++) { /*search for end of header.... */ if (strncmp(buf_end + i, "\r\n\r\n", 4) == 0) { buf_end = buf_end + i + 2; eoh = 1; break; } } if (eoh) break; if ((request_status = icap_header_check_realloc(&(h->buf), &(h->bufsize), readed, ICAP_HEADER_READSIZE)) != EC_100) break; buf_end = h->buf + readed; if (startsearch > -3) startsearch = (readed > 3 ? -3 : -readed); /*Including the last 3 char ellements ....... */ } while(1); h->bufused = buf_end - h->buf; /* -1 ; */ req->pstrblock_read = buf_end + 2; /*after the \r\n\r\n. We keep the first \r\n and the other dropped.... */ req->pstrblock_read_len = readed - h->bufused - 2; /*the 2 of the 4 characters \r\n\r\n and the '\0' character */ req->request_bytes_in = h->bufused + 2; /*This is include the "\r\n\r\n" sequence*/ return request_status; } static int read_encaps_header(ci_request_t * req, ci_headers_list_t * h, int size) { int bytes = 0, remains, readed = 0; char *buf_end = NULL; if (!ci_headers_setsize(h, size + (CHECK_FOR_BUGGY_CLIENT != 0 ? 2 : 0))) return EC_500; buf_end = h->buf; if (req->pstrblock_read_len > 0) { readed = (size > req->pstrblock_read_len ? req->pstrblock_read_len : size); memcpy(h->buf, req->pstrblock_read, readed); buf_end = h->buf + readed; if (size <= req->pstrblock_read_len) { /*We have readed all this header....... */ req->pstrblock_read = (req->pstrblock_read) + readed; req->pstrblock_read_len = (req->pstrblock_read_len) - readed; } else { req->pstrblock_read = NULL; req->pstrblock_read_len = 0; } } remains = size - readed; while (remains > 0) { if (wait_for_data(req->connection->fd, TIMEOUT, wait_for_read) == CI_ERROR) return CI_ERROR; if ((bytes = ci_read_nonblock(req->connection->fd, buf_end, remains)) <= 0) return CI_ERROR; remains -= bytes; buf_end += bytes; req->bytes_in += bytes; } h->bufused = buf_end - h->buf; // -1 ; if (strncmp(buf_end - 4, "\r\n\r\n", 4) == 0) { h->bufused -= 2; /*eat the last 2 bytes of "\r\n\r\n" */ } else if(CHECK_FOR_BUGGY_CLIENT && strncmp(buf_end - 2, "\r\n", 2) != 0) { // Some icap clients missing the "\r\n\r\n" after end of headers // when null-body is present. *buf_end = '\r'; *(buf_end + 1) = '\n'; h->bufused += 2; } /*Currently we are counting only successfull http headers read.*/ req->http_bytes_in += size; req->request_bytes_in += size; return EC_100; } static int get_method(char *buf, char **end) { if (!strncmp(buf, "OPTIONS", 7)) { *end = buf + 7; return ICAP_OPTIONS; } else if (!strncmp(buf, "REQMOD", 6)) { *end = buf + 6; return ICAP_REQMOD; } else if (!strncmp(buf, "RESPMOD", 7)) { *end = buf + 7; return ICAP_RESPMOD; } else { *end = buf; return -1; } } static int parse_request(ci_request_t * req, char *buf) { char *start, *end; int servnamelen, len, args_len; int vmajor, vminor; ci_service_module_t *service = NULL; service_alias_t *salias = NULL; if ((req->type = get_method(buf, &end)) < 0) return EC_400; while (*end == ' ') end++; start = end; if (strncasecmp(start, "icap://", 7) == 0) start = start + 7; else if (strncasecmp(start, "icaps://", 8) == 0) start = start + 8; else return EC_400; len = strcspn(start, "/ "); end = start + len; servnamelen = (CI_MAXHOSTNAMELEN > len ? len : CI_MAXHOSTNAMELEN); memcpy(req->req_server, start, servnamelen); req->req_server[servnamelen] = '\0'; if (*end == '/') { /*we are expecting service name*/ start = ++end; while (*end && *end != ' ' && *end != '?') end++; len = end - start; len = (len < MAX_SERVICE_NAME ? len : MAX_SERVICE_NAME); if (len) { strncpy(req->service, start, len); req->service[len] = '\0'; } if (*end == '?') { /*args */ start = ++end; if ((end = strchr(start, ' ')) != NULL) { args_len = strlen(req->args); len = end - start; if (args_len && len) { req->args[args_len] = '&'; args_len++; } len = (len < (MAX_SERVICE_ARGS - args_len) ? len : (MAX_SERVICE_ARGS - args_len)); strncpy(req->args + args_len, start, len); req->args[args_len + len] = '\0'; } } /*end of parsing args */ } while (*end == ' ') end++; start = end; vminor = vmajor = -1; if (strncmp(start, "ICAP/", 5) == 0) { start += 5; vmajor = strtol(start, &end, 10); if (vmajor > 0 && *end == '.') { start = end + 1; vminor = strtol(start, &end, 10); if (end == start) /*no chars parsed*/ vminor = -1; } } if (vminor == -1 || vmajor < 1) return EC_400; if (req->service[0] == '\0' && DEFAULT_SERVICE) { /*No service name defined*/ strncpy(req->service, DEFAULT_SERVICE, MAX_SERVICE_NAME); } if (req->service[0] != '\0') { if (!(service = find_service(req->service))) { /*else search for an alias */ if ((salias = find_service_alias(req->service))) { service = salias->service; if (salias->args[0] != '\0') strcpy(req->args, salias->args); } } } req->current_service_mod = service; if (!req->current_service_mod) return EC_404; /*Service not found*/ if (!ci_method_support (req->current_service_mod->mod_type, req->type) && req->type != ICAP_OPTIONS) { return EC_405; /* Method not allowed for service. */ } return EC_100; } static int check_request(ci_request_t *req) { /*Check encapsulated header*/ if (req->entities[0] == NULL && !req->type == ICAP_OPTIONS) /*No encapsulated header*/ return EC_400; ci_debug_printf(6, "\n type:%d Entities: %d %d %d %d \n", req->type, req->entities[0] ? req->entities[0]->type : -1, req->entities[1] ? req->entities[1]->type : -1, req->entities[2] ? req->entities[2]->type : -1, req->entities[3] ? req->entities[3]->type : -1 ); if (req->type == ICAP_REQMOD) { if (req->entities[2] != NULL) return EC_400; else if (req->entities[1] != NULL) { if (req->entities[0]->type != ICAP_REQ_HDR) return EC_400; if (req->entities[1]->type != ICAP_REQ_BODY && req->entities[1]->type != ICAP_NULL_BODY) return EC_400; } else { /*If it has only one encapsulated object it must be body data*/ if (req->entities[0]->type != ICAP_REQ_BODY) return EC_400; } } else if (req->type == ICAP_RESPMOD) { if (req->entities[3] != NULL) return EC_400; else if (req->entities[2] != NULL) { if (req->entities[0]->type != ICAP_REQ_HDR) return EC_400; if (req->entities[1]->type != ICAP_RES_HDR) return EC_400; if (req->entities[2]->type != ICAP_RES_BODY && req->entities[2]->type != ICAP_NULL_BODY) return EC_400; } else if (req->entities[1] != NULL) { if (req->entities[0]->type != ICAP_RES_HDR && req->entities[0]->type != ICAP_REQ_HDR) return EC_400; if (req->entities[1]->type != ICAP_RES_BODY && req->entities[1]->type != ICAP_NULL_BODY) return EC_400; } else { /*If it has only one encapsulated object it must be body data*/ if (req->entities[0]->type != ICAP_RES_BODY) return EC_400; } } return EC_100; } static int parse_header(ci_request_t * req) { int i, request_status = EC_100, result; ci_headers_list_t *h; char *val; h = req->request_header; if ((request_status = ci_read_icap_header(req, h, TIMEOUT)) != EC_100) return request_status; if ((request_status = ci_headers_unpack(h)) != EC_100) return request_status; if ((request_status = parse_request(req, h->headers[0])) != EC_100) return request_status; for (i = 1; i < h->used && request_status == EC_100; i++) { if (strncasecmp("Preview:", h->headers[i], 8) == 0) { val = h->headers[i] + 8; for (;isspace(*val) && *val != '\0'; ++val); errno = 0; result = strtol(val, NULL, 10); if (errno != EINVAL && errno != ERANGE) { req->preview = result; if (result >= 0) ci_buf_reset_size(&(req->preview_data), result + 64); } } else if (strncasecmp("Encapsulated:", h->headers[i], 13) == 0) request_status = process_encapsulated(req, h->headers[i]); else if (strncasecmp("Connection:", h->headers[i], 11) == 0) { val = h->headers[i] + 11; for (;isspace(*val) && *val != '\0'; ++val); /* if(strncasecmp(val,"keep-alive",10)==0)*/ if (strncasecmp(val, "close", 5) == 0) req->keepalive = 0; /*else the default behaviour of keepalive ..... */ } else if (strncasecmp("Allow:", h->headers[i], 6) == 0) { if (strstr(h->headers[i]+6, "204")) req->allow204 = 1; if (strstr(h->headers[i]+6, "206")) req->allow206 = 1; } } if (request_status != EC_100) return request_status; return check_request(req); } static int parse_encaps_headers(ci_request_t * req) { int size, i, request_status = 0; ci_encaps_entity_t *e = NULL; for (i = 0; (e = req->entities[i]) != NULL; i++) { if (e->type > ICAP_RES_HDR) //res_body,req_body or opt_body so the end of the headers.....process_encapsulated return EC_100; if (req->entities[i + 1] == NULL) return EC_400; size = req->entities[i + 1]->start - e->start; if ((request_status = read_encaps_header(req, (ci_headers_list_t *) e->entity, size)) != EC_100) return request_status; if ((request_status = ci_headers_unpack((ci_headers_list_t *) e->entity)) != EC_100) return request_status; } return EC_100; } /* In read_preview_data I must check if readed data are more than those client said in preview header */ static int read_preview_data(ci_request_t * req) { int ret; char *wdata; req->current_chunk_len = 0; req->chunk_bytes_read = 0; req->write_to_module_pending = 0; if (req->pstrblock_read_len == 0) { if(wait_for_data(req->connection->fd, TIMEOUT, wait_for_read) < 0) return CI_ERROR; if (net_data_read(req) == CI_ERROR) return CI_ERROR; } do { do { if ((ret = parse_chunk_data(req, &wdata)) == CI_ERROR) { ci_debug_printf(1, "Error parsing chunks, current chunk len: %d readed:%d, str:%s\n", req->current_chunk_len, req->chunk_bytes_read, req->pstrblock_read); return CI_ERROR; } if (ci_buf_write (&(req->preview_data), wdata, req->write_to_module_pending) < 0) return CI_ERROR; req->write_to_module_pending = 0; if (ret == CI_EOF) { req->pstrblock_read = NULL; req->pstrblock_read_len = 0; if (req->eof_received) return CI_EOF; return CI_OK; } } while (ret != CI_NEEDS_MORE); if (wait_for_data(req->connection->fd, TIMEOUT, wait_for_read) < 0) return CI_ERROR; if (net_data_read(req) == CI_ERROR) return CI_ERROR; } while (1); return CI_ERROR; } static void ec_responce_simple(ci_request_t * req, int ec) { char buf[256]; int len; snprintf(buf, 256, "ICAP/1.0 %d %s\r\n\r\n", ci_error_code(ec), ci_error_code_string(ec)); buf[255] = '\0'; len = strlen(buf); ci_write(req->connection->fd, buf, len, TIMEOUT); req->bytes_out += len; req->return_code = ec; } static int ec_responce(ci_request_t * req, int ec) { char buf[256]; ci_service_xdata_t *srv_xdata = NULL; int len, allow204to200OK = 0; if (req->current_service_mod) srv_xdata = service_data(req->current_service_mod); ci_headers_reset(req->response_header); if (ec == EC_204 && ALLOW204_AS_200OK_ZERO_ENCAPS) { allow204to200OK = 1; ec = EC_200; } snprintf(buf, 256, "ICAP/1.0 %d %s", ci_error_code(ec), ci_error_code_string(ec)); ci_headers_add(req->response_header, buf); ci_headers_add(req->response_header, "Server: C-ICAP/" VERSION); if (req->keepalive) ci_headers_add(req->response_header, "Connection: keep-alive"); else ci_headers_add(req->response_header, "Connection: close"); if (srv_xdata) { ci_service_data_read_lock(srv_xdata); ci_headers_add(req->response_header, srv_xdata->ISTag); ci_service_data_read_unlock(srv_xdata); } if (!ci_headers_is_empty(req->xheaders)) { ci_headers_addheaders(req->response_header, req->xheaders); } if (allow204to200OK) { if (req->type == ICAP_REQMOD) ci_headers_add(req->response_header, "Encapsulated: req-hdr=0, null-body=0"); else ci_headers_add(req->response_header, "Encapsulated: res-hdr=0, null-body=0"); } /* TODO: Release req->entities (ci_request_release_entity()) */ ci_headers_pack(req->response_header); req->return_code = ec; len = ci_write(req->connection->fd, req->response_header->buf, req->response_header->bufused, TIMEOUT); /*We are finishing sending*/ req->status = SEND_EOF; if (len < 0) return -1; req->bytes_out += len; return len; } extern char MY_HOSTNAME[]; static int mk_responce_header(ci_request_t * req) { ci_headers_list_t *head; ci_encaps_entity_t **e_list; ci_service_xdata_t *srv_xdata; char buf[512]; srv_xdata = service_data(req->current_service_mod); ci_headers_reset(req->response_header); head = req->response_header; assert(req->return_code >= EC_100 && req->return_code < EC_MAX); snprintf(buf, 512, "ICAP/1.0 %d %s", ci_error_code(req->return_code), ci_error_code_string(req->return_code)); ci_headers_add(head, buf); ci_headers_add(head, "Server: C-ICAP/" VERSION); if (req->keepalive) ci_headers_add(head, "Connection: keep-alive"); else ci_headers_add(head, "Connection: close"); ci_service_data_read_lock(srv_xdata); ci_headers_add(head, srv_xdata->ISTag); ci_service_data_read_unlock(srv_xdata); if (!ci_headers_is_empty(req->xheaders)) { ci_headers_addheaders(head, req->xheaders); } e_list = req->entities; if (req->type == ICAP_RESPMOD) { if (e_list[0]->type == ICAP_REQ_HDR) { ci_request_release_entity(req, 0); e_list[0] = e_list[1]; e_list[1] = e_list[2]; e_list[2] = NULL; } } snprintf(buf, 512, "Via: ICAP/1.0 %s (C-ICAP/" VERSION " %s )", MY_HOSTNAME, (req->current_service_mod->mod_short_descr ? req-> current_service_mod->mod_short_descr : req->current_service_mod-> mod_name)); buf[511] = '\0'; /*Here we must append it to an existsing Via header not just add a new header */ if (req->type == ICAP_RESPMOD) { ci_http_response_add_header(req, buf); } else if (req->type == ICAP_REQMOD) { ci_http_request_add_header(req, buf); } ci_response_pack(req); return 1; } /****************************************************************/ /* New functions to send responce */ const char *eol_str = "\r\n"; const char *eof_str = "0\r\n\r\n"; static int send_current_block_data(ci_request_t * req) { int bytes; if (req->remain_send_block_bytes == 0) return 0; if ((bytes = ci_write_nonblock(req->connection->fd, req->pstrblock_responce, req->remain_send_block_bytes)) < 0) { ci_debug_printf(5, "Error writing to socket (errno:%d, bytes:%d. string:\"%s\")", errno, req->remain_send_block_bytes, req->pstrblock_responce); return CI_ERROR; } if (bytes == 0) { ci_debug_printf(5, "Can not write to the client. Is the connection closed?"); return CI_ERROR; } req->pstrblock_responce += bytes; req->remain_send_block_bytes -= bytes; req->bytes_out += bytes; if(req->status >= SEND_HEAD1 && req->status <= SEND_HEAD3) req->http_bytes_out +=bytes; return req->remain_send_block_bytes; } static int format_body_chunk(ci_request_t * req) { int def_bytes; char *wbuf = NULL; char tmpbuf[EXTRA_CHUNK_SIZE]; if (!req->responce_hasbody) return CI_EOF; if (req->remain_send_block_bytes > 0) { assert(req->remain_send_block_bytes <= MAX_CHUNK_SIZE); /*The data are not written yet but I hope there is not any problem. It is difficult to compute data sent */ req->http_bytes_out += req->remain_send_block_bytes; req->body_bytes_out += req->remain_send_block_bytes; wbuf = req->wbuf + EXTRA_CHUNK_SIZE + req->remain_send_block_bytes; /*Put the "\r\n" sequence at the end of chunk */ *(wbuf++) = '\r'; *wbuf = '\n'; def_bytes = snprintf(tmpbuf, EXTRA_CHUNK_SIZE, "%x\r\n", req->remain_send_block_bytes); wbuf = req->wbuf + EXTRA_CHUNK_SIZE - def_bytes; /*Copy the chunk define in the beggining of chunk ..... */ memcpy(wbuf, tmpbuf, def_bytes); req->pstrblock_responce = wbuf; req->remain_send_block_bytes += def_bytes + 2; } else if (req->remain_send_block_bytes == CI_EOF) { if (req->return_code == EC_206 && req->i206_use_original_body >= 0) { def_bytes = sprintf(req->wbuf, "0; use-original-body=%ld\r\n\r\n", req->i206_use_original_body ); req->pstrblock_responce = req->wbuf; req->remain_send_block_bytes = def_bytes; } else { strcpy(req->wbuf, "0\r\n\r\n"); req->pstrblock_responce = req->wbuf; req->remain_send_block_bytes = 5; } return CI_EOF; } return CI_OK; } static int resp_check_body(ci_request_t * req) { int i; ci_encaps_entity_t **e = req->entities; for (i = 0; e[i] != NULL; i++) if (e[i]->type == ICAP_NULL_BODY) return 0; return 1; } /* The if((ret=send_current_block_data(req))!=0) return ret; must called after this function.... */ static int update_send_status(ci_request_t * req) { int i, status; ci_encaps_entity_t *e; if (req->status == SEND_NOTHING) { //If nothing has send start sending.... if (!mk_responce_header(req)) { ci_debug_printf(1, "Error constructing the responce headers!\n"); return CI_ERROR; } req->responce_hasbody = resp_check_body(req); req->pstrblock_responce = req->response_header->buf; req->remain_send_block_bytes = req->response_header->bufused; req->status = SEND_RESPHEAD; ci_debug_printf(9, "Going to send response headers\n"); return CI_OK; } if (req->status == SEND_EOF) { ci_debug_printf(9, "The req->status is EOF (remain to send bytes:%d)\n", req->remain_send_block_bytes); if (req->remain_send_block_bytes == 0) return CI_EOF; else return CI_OK; } if (req->status == SEND_BODY) { ci_debug_printf(9, "Send status is SEND_BODY return\n"); return CI_OK; } if ((status = req->status) < SEND_HEAD3) { status++; } if (status > SEND_RESPHEAD && status < SEND_BODY) { /*status is SEND_HEAD1 SEND_HEAD2 or SEND_HEAD3 */ i = status - SEND_HEAD1; /*We have to send next headers block .... */ if ((e = req->entities[i]) != NULL && (e->type == ICAP_REQ_HDR || e->type == ICAP_RES_HDR)) { req->pstrblock_responce = ((ci_headers_list_t *) e->entity)->buf; req->remain_send_block_bytes = ((ci_headers_list_t *) e->entity)->bufused; req->status = status; ci_debug_printf(9, "Going to send http headers on entity :%d\n", i); return CI_OK; } else if (req->responce_hasbody) { /*end of headers, going to send body now.A body always follows the res_hdr or req_hdr..... */ req->status = SEND_BODY; return CI_OK; } else { req->status = SEND_EOF; req->pstrblock_responce = (char *) NULL; req->remain_send_block_bytes = 0; return CI_EOF; } } return CI_ERROR; /*Can not be reached (I thing)...... */ } static int mod_null_io(char *rbuf, int *rlen, char *wbuf, int *wlen, int iseof, ci_request_t *req) { if (iseof) *rlen = CI_EOF; else *rlen = 0; return CI_OK; } static int get_send_body(ci_request_t * req, int parse_only) { char *wchunkdata = NULL, *rchunkdata = NULL; int ret, parse_chunk_ret, has_formated_data = 0; int (*service_io) (char *rbuf, int *rlen, char *wbuf, int *wlen, int iseof, ci_request_t *); int action = 0, rchunkisfull = 0, service_eof = 0, wbytes, rbytes; int lock_status; int no_io; if (parse_only) service_io = mod_null_io; else service_io = req->current_service_mod->mod_service_io; if (!service_io) return CI_ERROR; req->status = SEND_NOTHING; /*in the case we did not have preview data and body is small maybe the c-icap already read the body with the headers so do not read if there are unparsed bytes in pstrblock buffer */ if (req->pstrblock_read_len == 0) action = wait_for_read; do { ret = 0; if (action) { ci_debug_printf(9, "Going to %s/%s data\n", (action & wait_for_read ? "Read" : "-"), (action & wait_for_write ? "Write" : "-") ); if ((ret = wait_for_data(req->connection->fd, TIMEOUT, action)) < 0) break; if (ret & wait_for_read) { if (net_data_read(req) == CI_ERROR) return CI_ERROR; } if (ret & wait_for_write) { if (!req->data_locked && req->status == SEND_NOTHING) { update_send_status(req); } if (send_current_block_data(req) == CI_ERROR) return CI_ERROR; } ci_debug_printf(9, "OK done reading/writing going to process\n"); } if (!req->data_locked && req->remain_send_block_bytes == 0) { if (update_send_status(req) == CI_ERROR) return CI_ERROR; // if(update_send_status==CI_EOF)/*earlier responce from icap server???...*/ } /*Store lock status. If it is changed during module io, we need to update send status.*/ lock_status = req->data_locked; /*In the following loop, parses the chunks from readed data and try to write data to the service. At the same time reads the data from module and try to fill the req->wbuf */ if (req->remain_send_block_bytes) has_formated_data = 1; else has_formated_data = 0; parse_chunk_ret = 0; do { if (req->pstrblock_read_len != 0 && req->write_to_module_pending == 0) { if ((parse_chunk_ret = parse_chunk_data(req, &wchunkdata)) == CI_ERROR) { ci_debug_printf(1, "Error parsing chunks!\n"); return CI_ERROR; } if (parse_chunk_ret == CI_EOF) req->eof_received = 1; } if (wchunkdata && req->write_to_module_pending) wbytes = req->write_to_module_pending; else wbytes = 0; if (req->status == SEND_BODY && !service_eof) { if (req->remain_send_block_bytes == 0) { /*Leave space for chunk spec.. */ rchunkdata = req->wbuf + EXTRA_CHUNK_SIZE; req->pstrblock_responce = rchunkdata; /*does not needed! */ rchunkisfull = 0; } if ((MAX_CHUNK_SIZE - req->remain_send_block_bytes) > 0 && has_formated_data == 0) { rbytes = MAX_CHUNK_SIZE - req->remain_send_block_bytes; } else { rchunkisfull = 1; rbytes = 0; } } else rbytes = 0; no_io = 0; ci_debug_printf(9, "get send body: going to write/read: %d/%d bytes\n", wbytes, rbytes); if ((*service_io) (rchunkdata, &rbytes, wchunkdata, &wbytes, req->eof_received, req) == CI_ERROR) return CI_ERROR; ci_debug_printf(9, "get send body: written/read: %d/%d bytes (eof: %d)\n", wbytes, rbytes, req->eof_received); no_io = (rbytes==0 && wbytes==0); if (wbytes) { wchunkdata += wbytes; req->write_to_module_pending -= wbytes; } if (rbytes > 0) { rchunkdata += rbytes; req->remain_send_block_bytes += rbytes; } else if (rbytes == CI_EOF) service_eof = 1; } while (no_io == 0 && req->pstrblock_read_len != 0 && parse_chunk_ret != CI_NEEDS_MORE && !rchunkisfull); action = 0; if (!req->write_to_module_pending) { action = wait_for_read; wchunkdata = NULL; } if (req->status == SEND_BODY) { if (req->remain_send_block_bytes == 0 && service_eof == 1) req->remain_send_block_bytes = CI_EOF; if (has_formated_data == 0) { if (format_body_chunk(req) == CI_EOF) req->status = SEND_EOF; } } if (req->remain_send_block_bytes) { action = action | wait_for_write; } } while ((!req->eof_received || (req->eof_received && req->write_to_module_pending)) && (action || lock_status != req->data_locked)); if (req->eof_received) return CI_OK; if (!action) { ci_debug_printf(1, "Bug in the service. Please report to the service author!!!!\n"); } else { ci_debug_printf(5, "Error reading from network......\n"); } return CI_ERROR; } /*Return CI_ERROR on error or CI_OK on success*/ static int send_remaining_response(ci_request_t * req) { int ret = 0; int (*service_io) (char *rbuf, int *rlen, char *wbuf, int *wlen, int iseof, ci_request_t *); service_io = req->current_service_mod->mod_service_io; if (!service_io) return CI_ERROR; if (req->status == SEND_EOF && req->remain_send_block_bytes == 0) { ci_debug_printf(5, "OK sending all data\n"); return CI_OK; } do { while (req->remain_send_block_bytes > 0) { if ((ret = wait_for_data(req->connection->fd, TIMEOUT, wait_for_write)) < 0) { ci_debug_printf(3, "Timeout sending data. Ending .......\n"); return CI_ERROR; } if (send_current_block_data(req) == CI_ERROR) return CI_ERROR; } if (req->status == SEND_BODY && req->remain_send_block_bytes == 0) { req->pstrblock_responce = req->wbuf + EXTRA_CHUNK_SIZE; /*Leave space for chunk spec.. */ req->remain_send_block_bytes = MAX_CHUNK_SIZE; ci_debug_printf(9, "rest response: going to read: %d bytes\n", req->remain_send_block_bytes); service_io(req->pstrblock_responce, &(req->remain_send_block_bytes), NULL, NULL, 1, req); ci_debug_printf(9, "rest response: read: %d bytes\n", req->remain_send_block_bytes); if (req->remain_send_block_bytes == CI_ERROR) /*CI_EOF of CI_ERROR, stop sending.... */ return CI_ERROR; if (req->remain_send_block_bytes == 0) break; if ((ret = format_body_chunk(req)) == CI_EOF) { req->status = SEND_EOF; } } } while ((ret = update_send_status(req)) >= 0); /*CI_EOF is < 0 */ if (ret == CI_ERROR) return ret; return CI_OK; } static void options_responce(ci_request_t * req) { char buf[MAX_HEADER_SIZE + 1]; const char *str; ci_headers_list_t *head; ci_service_xdata_t *srv_xdata; unsigned int xopts; int preview, allow204, allow206, max_conns, xlen; int hastransfer = 0; int ttl; req->return_code = EC_200; head = req->response_header; srv_xdata = service_data(req->current_service_mod); ci_headers_reset(head); ci_headers_add(head, "ICAP/1.0 200 OK"); strcpy(buf, "Methods: "); if (ci_method_support(req->current_service_mod->mod_type, ICAP_RESPMOD)) { strcat(buf, "RESPMOD"); if (ci_method_support (req->current_service_mod->mod_type, ICAP_REQMOD)) { strcat(buf, ", REQMOD"); } } else { /*At least one method must supported. A check for error must exists here..... */ strcat(buf, "REQMOD"); } ci_headers_add(head, buf); snprintf(buf, MAX_HEADER_SIZE, "Service: C-ICAP/" VERSION " server - %s", ((str = req->current_service_mod->mod_short_descr) ? str : req-> current_service_mod->mod_name)); buf[MAX_HEADER_SIZE] = '\0'; ci_headers_add(head, buf); ci_service_data_read_lock(srv_xdata); ci_headers_add(head, srv_xdata->ISTag); if (srv_xdata->TransferPreview[0] != '\0' && srv_xdata->preview_size >= 0) { ci_headers_add(head, srv_xdata->TransferPreview); hastransfer++; } if (srv_xdata->TransferIgnore[0] != '\0') { ci_headers_add(head, srv_xdata->TransferIgnore); hastransfer++; } if (srv_xdata->TransferComplete[0] != '\0') { ci_headers_add(head, srv_xdata->TransferComplete); hastransfer++; } /*If none of the Transfer-* headers configured but preview configured send all requests*/ if (!hastransfer && srv_xdata->preview_size >= 0) ci_headers_add(head, "Transfer-Preview: *"); /*Get service options before close the lock.... */ xopts = srv_xdata->xopts; preview = srv_xdata->preview_size; allow204 = srv_xdata->allow_204; allow206 = srv_xdata->allow_206; max_conns = srv_xdata->max_connections; ttl = srv_xdata->options_ttl; ci_service_data_read_unlock(srv_xdata); ci_debug_printf(5, "Options responce:\n" " Preview :%d\n" " Allow 204:%s\n" " Allow 206:%s\n" " TransferPreview:\"%s\"\n" " TransferIgnore:%s\n" " TransferComplete:%s\n" " Max-Connections:%d\n", preview,(allow204?"yes":"no"), (allow206?"yes":"no"), srv_xdata->TransferPreview, srv_xdata->TransferIgnore, srv_xdata->TransferComplete, max_conns ); /* ci_headers_add(head, "Max-Connections: 20"); */ if (ttl > 0) { sprintf(buf, "Options-TTL: %d", ttl); ci_headers_add(head, buf); } else ci_headers_add(head, "Options-TTL: 3600"); strcpy(buf, "Date: "); ci_strtime_rfc822(buf + strlen(buf)); ci_headers_add(head, buf); if (preview >= 0) { sprintf(buf, "Preview: %d", srv_xdata->preview_size); ci_headers_add(head, buf); } if(max_conns >= 0) { sprintf(buf, "Max-Connections: %d", max_conns); ci_headers_add(head, buf); } if (allow204 && allow206) { ci_headers_add(head, "Allow: 204, 206"); } else if (allow204) { ci_headers_add(head, "Allow: 204"); } if (xopts) { strcpy(buf, "X-Include: "); xlen = 11; /*sizeof("X-Include: ") */ if ((xopts & CI_XCLIENTIP)) { strcat(buf, "X-Client-IP"); xlen += sizeof("X-Client-IP"); } if ((xopts & CI_XSERVERIP)) { if (xlen > 11) { strcat(buf, ", "); xlen += 2; } strcat(buf, "X-Server-IP"); xlen += sizeof("X-Server-IP"); } if ((xopts & CI_XSUBSCRIBERID)) { if (xlen > 11) { strcat(buf, ", "); xlen += 2; } strcat(buf, "X-Subscriber-ID"); xlen += sizeof("X-Subscriber-ID"); } if ((xopts & CI_XAUTHENTICATEDUSER)) { if (xlen > 11) { strcat(buf, ", "); xlen += 2; } strcat(buf, "X-Authenticated-User"); xlen += sizeof("X-Authenticated-User"); } if ((xopts & CI_XAUTHENTICATEDGROUPS)) { if (xlen > 11) { strcat(buf, ", "); xlen += 2; } strcat(buf, "X-Authenticated-Groups"); xlen += sizeof("X-Authenticated-Groups"); } if (xlen > 11) ci_headers_add(head, buf); } ci_response_pack(req); req->pstrblock_responce = head->buf; req->remain_send_block_bytes = head->bufused; do { if ((wait_for_data(req->connection->fd, TIMEOUT, wait_for_write)) < 0) { ci_debug_printf(3, "Timeout sending data. Ending .......\n"); return; } if (send_current_block_data(req) == CI_ERROR) { ci_debug_printf(3, "Error sending data. Ending .....\n"); return; } } while (req->remain_send_block_bytes > 0); // if(responce_body) // send_body_responce(req,responce_body); } /*Read preview data, call preview handler and respond with error, "204" or "100 Continue" if required. Returns: - CI_OK on success and 100 Continue, - CI_EOF on ieof chunk response (means all body data received, inside preview, no need to read more data from the client) - CI_ERROR on error */ static int do_request_preview(ci_request_t *req){ int preview_read_status; int res; ci_debug_printf(8,"Read preview data if there are and process request\n"); /*read_preview_data returns CI_OK, CI_EOF or CI_ERROR */ if (!req->hasbody) preview_read_status = CI_EOF; else if ((preview_read_status = read_preview_data(req)) == CI_ERROR) { ci_debug_printf(5, "An error occured while reading preview data (propably timeout)\n"); req->keepalive = 0; ec_responce(req, EC_408); return CI_ERROR; } if (!req->current_service_mod->mod_check_preview_handler) { /*We have not a preview data handler. We are responding with "100 Continue" assuming that the service needs to process all data. The preview data are stored in req->preview_data.buf, if the service needs them. */ ci_debug_printf(3, "Preview request but no preview data handler. Respond with \"100 Continue\"\n"); res = CI_MOD_CONTINUE; } else { /*We have a preview handler and we are going to call it*/ res = req->current_service_mod->mod_check_preview_handler( req->preview_data.buf, req->preview_data.used, req); } if (res == CI_MOD_ALLOW204) { if (ec_responce(req, EC_204) < 0) { req->keepalive = 0; /*close the connection*/ return CI_ERROR; } ci_debug_printf(5,"Preview handler return allow 204 response\n"); /*we are finishing here*/ return CI_OK; } if (res == CI_MOD_ALLOW206 && req->allow206) { req->return_code = EC_206; ci_debug_printf(5,"Preview handler return 206 response\n"); return CI_OK; } /*The CI_MOD_CONTINUE is the only remaining valid answer */ if (res != CI_MOD_CONTINUE) { ci_debug_printf(5, "An error occured in preview handler!" " return code: %d , req->allow204=%d, req->allow206=%d\n", res, req->allow204, req->allow206); req->keepalive = 0; ec_responce(req, EC_500); return CI_ERROR; } if (preview_read_status != CI_EOF) { ec_responce_simple(req, EC_100); /*if 100 Continue and not "0;ieof"*/ } /* else 100 Continue and "0;ieof" received. Do not send "100 Continue"*/ ci_debug_printf(5,"Preview handler %s\n", (preview_read_status == CI_EOF ? "receives all body data" : "continue reading more body data")); return preview_read_status; } /* Call the preview handler in the case there is not preview request. */ static int do_fake_preview(ci_request_t * req) { int res; /*We are outside preview. The preview handler will be called but it needs special handle. Currently the preview data handler called with no preview data.In the future we should add code to read data from client and pass them to the service. Also in the future the service should not need to know if preview supported by the client or not */ if (!req->current_service_mod->mod_check_preview_handler) return CI_OK; /*do nothing*/ ci_debug_printf(8,"Preview does not supported. Call the preview handler with no preview data.\n"); res = req->current_service_mod->mod_check_preview_handler(NULL, 0, req); /*We are outside preview. The client should support allow204 outside preview to support it. */ if (res == CI_MOD_ALLOW204 && req->allow204) { ci_debug_printf(5,"Preview handler return allow 204 response, and allow204 outside preview supported\n"); if (ec_responce(req, EC_204) < 0) { req->keepalive = 0; /*close the connection*/ return CI_ERROR; } /*And now parse body data we have read and data the client going to send us, but do not pass them to the service (second argument of the get_send_body)*/ if (req->hasbody) res = get_send_body(req, 1); /*we do not care about return code...*/ return CI_OK; } if (res == CI_MOD_ALLOW204 && !req->hasbody) { ci_debug_printf(5,"Preview handler return allow 204 response, and allow204 outside preview does NOT supported\n"); /*Just copy http headers to icap response. No need at this time*/ /* TODO: remove the "!req->hasbody" from if and attach a (ring?) buffer to echo data back to user */ return CI_OK; } if (res == CI_MOD_ALLOW206 && req->allow204 && req->allow206) { ci_debug_printf(5,"Preview handler return allow 204 response, allow204 outside preview and allow206 supported by t"); req->return_code = EC_206; return CI_OK; } if (res == CI_MOD_CONTINUE) return CI_OK; ci_debug_printf(1, "An error occured in preview handler (outside preview)!" " return code: %d, req->allow204=%d, req->allow206=%d\n", res, req->allow204, req->allow206); req->keepalive = 0; ec_responce(req, EC_500); return CI_ERROR; } /* Return CI_ERROR or CI_OK */ static int do_end_of_data(ci_request_t * req) { int res; if (!req->current_service_mod->mod_end_of_data_handler) return CI_OK; /*Nothing to do*/ res = req->current_service_mod->mod_end_of_data_handler(req); /* while( req->current_service_mod->mod_end_of_data_handler(req)== CI_MOD_NOT_READY){ //can send some data here ......... } */ if (res == CI_MOD_ALLOW204 && req->allow204 && !ci_req_sent_data(req)) { if (ec_responce(req, EC_204) < 0) { ci_debug_printf(5, "An error occured while sending allow 204 response\n"); return CI_ERROR; } return CI_OK; } if (res == CI_MOD_ALLOW206 && req->allow204 && req->allow206 && !ci_req_sent_data(req)) { req->return_code = EC_206; return CI_OK; } if (res != CI_MOD_DONE) { ci_debug_printf(1, "An error occured in end-of-data handler !" "return code : %d, req->allow204=%d, req->allow206=%d\n", res, req->allow204, req->allow206); if (!ci_req_sent_data(req)) { req->keepalive = 0; ec_responce(req, EC_500); } return CI_ERROR; } return CI_OK; } static int do_request(ci_request_t * req) { ci_service_xdata_t *srv_xdata = NULL; int res, preview_status = 0, auth_status = CI_ACCESS_ALLOW; int ret_status = CI_OK; /*By default ret_status is CI_OK, on error must set to CI_ERROR*/ res = parse_header(req); if (res != EC_100) { /*if read some data, bad request or Service not found or Server error or what else, else connection timeout, or client closes the connection*/ req->return_code = res; req->keepalive = 0; // Error occured, close the connection ...... if (res > EC_100 && req->request_header->bufused > 0) ec_responce(req, res); ci_debug_printf(5, "Error %d while parsing headers :(%d)\n", res ,req->request_header->bufused); return CI_ERROR; } assert(req->current_service_mod); srv_xdata = service_data(req->current_service_mod); if (!srv_xdata || srv_xdata->status != CI_SERVICE_OK) { ci_debug_printf(2, "Service %s not initialized\n", req->current_service_mod->mod_name); req->keepalive = 0; ec_responce(req, EC_500); return CI_ERROR; } auth_status = req->access_type; if ((auth_status = access_check_request(req)) == CI_ACCESS_DENY) { req->keepalive = 0; if (req->auth_required) { ec_responce(req, EC_407); /*Responce with authentication required */ } else { ec_responce(req, EC_403); /*Forbitten*/ } return CI_ERROR; /*Or something that means authentication error */ } if (res == EC_100) { res = parse_encaps_headers(req); if (res != EC_100) { req->keepalive = 0; ec_responce(req, EC_400); return CI_ERROR; } } if (req->current_service_mod->mod_init_request_data) req->service_data = req->current_service_mod->mod_init_request_data(req); else req->service_data = NULL; ci_debug_printf(8, "Requested service: %s\n", req->current_service_mod->mod_name); switch (req->type) { case ICAP_OPTIONS: options_responce(req); ret_status = CI_OK; break; case ICAP_REQMOD: case ICAP_RESPMOD: preview_status = CI_NO_STATUS; if (req->preview >= 0) /*we are inside preview*/ preview_status = do_request_preview(req); else { preview_status = do_fake_preview(req); /* do_fake_preview return CI_OK or CI_ERROR. */ if (preview_status == CI_OK) { /* We did not send any "100 Continue" response, but we need to simulate that we sent in the case we are expecting body data */ if (req->hasbody) req->return_code = EC_100; else req->return_code = EC_200; } } if (preview_status == CI_ERROR) { ret_status = CI_ERROR; break; } else if (preview_status == CI_EOF) req->return_code = EC_200; /*Equivalent to "100 Continue"*/ if (req->return_code == EC_204) /*Allow 204, Stop processing here*/ break; /*else 100 continue or 206 response or Internal error*/ else if (req->return_code != EC_100 && req->return_code != EC_200 && req->return_code != EC_206) { ec_responce(req, EC_500); ret_status = CI_ERROR; break; } if (req->return_code == EC_100 && req->hasbody && preview_status != CI_EOF) { req->return_code = EC_200; /*We have to repsond with "200 OK"*/ ci_debug_printf(9, "Going to get/send body data.....\n"); ret_status = get_send_body(req, 0); if (ret_status == CI_ERROR) { req->keepalive = 0; /*close the connection*/ ci_debug_printf(5, "An error occured. Parse error or the client closed the connection (res:%d, preview status:%d)\n", ret_status, preview_status); break; } } /*We have received all data from the client. Call the end-of-data service handler and process*/ ret_status = do_end_of_data(req); if (ret_status == CI_ERROR) { req->keepalive = 0; /*close the connection*/ break; } if (req->return_code == EC_204) break; /* Nothing to be done, stop here*/ /*else we have to send response to the client*/ unlock_data(req); /*unlock data if locked so that it can be send to the client*/ ret_status = send_remaining_response(req); if (ret_status == CI_ERROR) { req->keepalive = 0; /*close the connection*/ ci_debug_printf(5, "Error while sending rest responce or client closed the connection\n"); } /*We are finished here*/ break; default: req->keepalive = 0; /*close the connection*/ ret_status = CI_ERROR; break; } if (req->current_service_mod->mod_release_request_data && req->service_data) req->current_service_mod->mod_release_request_data(req->service_data); // debug_print_request(req); return ret_status; } int process_request(ci_request_t * req) { int res; ci_service_xdata_t *srv_xdata; res = do_request(req); if (req->pstrblock_read_len) { ci_debug_printf(5, "There are unparsed data od size %d: \"%s\"\n. Move to connection buffer\n", req->pstrblock_read_len, req->pstrblock_read); } if (res<0 && req->request_header->bufused == 0) /*Did not read anything*/ return CI_NO_STATUS; if (STATS) { if (req->return_code != EC_404 && req->current_service_mod) srv_xdata = service_data(req->current_service_mod); else srv_xdata = NULL; STATS_LOCK(); if (STAT_REQUESTS >= 0) STATS_INT64_INC(STAT_REQUESTS,1); if (req->type == ICAP_REQMOD) { STATS_INT64_INC(STAT_REQMODS, 1); if (srv_xdata) STATS_INT64_INC(srv_xdata->stat_reqmods, 1); } else if (req->type == ICAP_RESPMOD) { STATS_INT64_INC(STAT_RESPMODS, 1); if (srv_xdata) STATS_INT64_INC(srv_xdata->stat_respmods, 1); } else if (req->type == ICAP_OPTIONS) { STATS_INT64_INC(STAT_OPTIONS, 1); if (srv_xdata) STATS_INT64_INC(srv_xdata->stat_options, 1); } if (res <0 && STAT_FAILED_REQUESTS >= 0) STATS_INT64_INC(STAT_FAILED_REQUESTS,1); else if (req->return_code == EC_204) { STATS_INT64_INC(STAT_ALLOW204, 1); if (srv_xdata) STATS_INT64_INC(srv_xdata->stat_allow204, 1); } if (STAT_BYTES_IN >= 0) STATS_KBS_INC(STAT_BYTES_IN, req->bytes_in); if (STAT_BYTES_OUT >= 0) STATS_KBS_INC(STAT_BYTES_OUT, req->bytes_out); if (STAT_HTTP_BYTES_IN >= 0) STATS_KBS_INC(STAT_HTTP_BYTES_IN, req->http_bytes_in); if (STAT_HTTP_BYTES_OUT >= 0) STATS_KBS_INC(STAT_HTTP_BYTES_OUT, req->http_bytes_out); if (STAT_BODY_BYTES_IN >= 0) STATS_KBS_INC(STAT_BODY_BYTES_IN, req->body_bytes_in); if (STAT_BODY_BYTES_OUT >= 0) STATS_KBS_INC(STAT_BODY_BYTES_OUT, req->body_bytes_out); if (srv_xdata) { if (srv_xdata->stat_bytes_in >= 0) STATS_KBS_INC(srv_xdata->stat_bytes_in, req->bytes_in); if (srv_xdata->stat_bytes_out >= 0) STATS_KBS_INC(srv_xdata->stat_bytes_out, req->bytes_out); if (srv_xdata->stat_http_bytes_in >= 0) STATS_KBS_INC(srv_xdata->stat_http_bytes_in, req->http_bytes_in); if (srv_xdata->stat_http_bytes_out >= 0) STATS_KBS_INC(srv_xdata->stat_http_bytes_out, req->http_bytes_out); if (srv_xdata->stat_body_bytes_in >= 0) STATS_KBS_INC(srv_xdata->stat_body_bytes_in, req->body_bytes_in); if (srv_xdata->stat_body_bytes_out >= 0) STATS_KBS_INC(srv_xdata->stat_body_bytes_out, req->body_bytes_out); } STATS_UNLOCK(); } return res; /*Allow to log even the failed requests*/ } c_icap-0.4.2/info.c0000664000175000017500000003422712567550776011011 00000000000000/* * Copyright (C) 2004-2009 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include "service.h" #include "header.h" #include "body.h" #include "simple_api.h" #include "stats.h" #include "proc_threads_queues.h" #include "debug.h" int info_init_service(ci_service_xdata_t * srv_xdata, struct ci_server_conf *server_conf); int info_check_preview_handler(char *preview_data, int preview_data_len, ci_request_t *); int info_end_of_data_handler(ci_request_t * req); void *info_init_request_data(ci_request_t * req); void info_close_service(); void info_release_request_data(void *data); int info_io(char *wbuf, int *wlen, char *rbuf, int *rlen, int iseof, ci_request_t * req); CI_DECLARE_MOD_DATA ci_service_module_t info_service = { "info", /* mod_name, The module name */ "C-icap run-time information", /* mod_short_descr, Module short description */ ICAP_REQMOD, /* mod_type, The service type is request modification */ info_init_service, /* mod_init_service. Service initialization */ NULL, /* post_init_service. Service initialization after c-icap configured. Not used here */ info_close_service, /* mod_close_service. Called when service shutdowns. */ info_init_request_data, /* mod_init_request_data */ info_release_request_data, /* mod_release_request_data */ info_check_preview_handler, /* mod_check_preview_handler */ info_end_of_data_handler, /* mod_end_of_data_handler */ info_io, /* mod_service_io */ NULL, NULL }; struct info_req_data { ci_membuf_t *body; int txt_mode; int childs; int *child_pids; int free_servers; int used_servers; unsigned int closing_childs; int *closing_child_pids; unsigned int started_childs; unsigned int closed_childs; unsigned int crashed_childs; struct stat_memblock *collect_stats; }; extern struct childs_queue *childs_queue; extern ci_proc_mutex_t accept_mutex; int build_statistics(struct info_req_data *info_data); int info_init_service(ci_service_xdata_t * srv_xdata, struct ci_server_conf *server_conf) { ci_service_set_xopts(srv_xdata, CI_XAUTHENTICATEDUSER|CI_XAUTHENTICATEDGROUPS); return CI_OK; } void info_close_service() { ci_debug_printf(5,"Service %s shutdown!\n", info_service.mod_name); } void *info_init_request_data(ci_request_t * req) { struct info_req_data *info_data; info_data = malloc(sizeof(struct info_req_data)); info_data->body = ci_membuf_new(); info_data->childs = 0; info_data->child_pids = malloc(childs_queue->size * sizeof(int)); info_data->free_servers = 0; info_data->used_servers = 0; info_data->closing_childs = 0; info_data->closing_child_pids = malloc(childs_queue->size * sizeof(int)); info_data->started_childs = 0; info_data->closed_childs = 0; info_data->crashed_childs = 0; info_data->txt_mode = 0; if (req->args[0] != '\0') { if (strstr(req->args, "view=text")) info_data->txt_mode = 1; } info_data->collect_stats = malloc(ci_stat_memblock_size()); info_data->collect_stats->sig = 0xFAFA; stat_memblock_fix(info_data->collect_stats); ci_stat_memblock_reset(info_data->collect_stats); return info_data; } void info_release_request_data(void *data) { struct info_req_data *info_data = (struct info_req_data *)data; if (info_data->body) ci_membuf_free(info_data->body); if (info_data->collect_stats) free(info_data->collect_stats); free(info_data); } int info_check_preview_handler(char *preview_data, int preview_data_len, ci_request_t * req) { struct info_req_data *info_data = ci_service_data(req); if (ci_req_hasbody(req)) return CI_MOD_ALLOW204; ci_req_unlock_data(req); ci_http_response_create(req, 1, 1); /*Build the responce headers */ ci_http_response_add_header(req, "HTTP/1.0 200 OK"); ci_http_response_add_header(req, "Server: C-ICAP"); ci_http_response_add_header(req, "Content-Type: text/html"); ci_http_response_add_header(req, "Content-Language: en"); ci_http_response_add_header(req, "Connection: close"); if (info_data->body) { build_statistics (info_data); } return CI_MOD_CONTINUE; } int info_end_of_data_handler(ci_request_t * req) { return CI_MOD_DONE; } int info_io(char *wbuf, int *wlen, char *rbuf, int *rlen, int iseof, ci_request_t * req) { int ret; struct info_req_data *info_data = ci_service_data(req); ret = CI_OK; if (wbuf && wlen) { if (info_data->body) *wlen = ci_membuf_read(info_data->body, wbuf, *wlen); else *wlen = CI_EOF; } return ret; } /*Statistisc implementation .....*/ void fill_queue_statistics(struct childs_queue *q, struct info_req_data *info_data) { int i; int requests = 0; struct stat_memblock *stats, copy_stats; struct server_statistics *srv_stats; if (!q->childs) return; /*Merge childs data*/ for (i = 0; i < q->size; i++) { if (q->childs[i].pid != 0 && q->childs[i].to_be_killed == 0) { if (info_data->child_pids) info_data->child_pids[info_data->childs] = q->childs[i].pid; info_data->childs++; info_data->free_servers += q->childs[i].freeservers; info_data->used_servers += q->childs[i].usedservers; requests += q->childs[i].requests; stats = q->stats_area + i * (q->stats_block_size); copy_stats.counters64_size = stats->counters64_size; copy_stats.counterskbs_size = stats->counterskbs_size; copy_stats.counters64 = (void *)stats + _CI_ALIGN(sizeof(struct stat_memblock)); copy_stats.counterskbs = (void *)stats + _CI_ALIGN(sizeof(struct stat_memblock)) + stats->counters64_size*sizeof(uint64_t); ci_stat_memblock_merge(info_data->collect_stats, ©_stats); } else if (q->childs[i].pid != 0 && q->childs[i].to_be_killed) { if (info_data->closing_child_pids) info_data->closing_child_pids[info_data->closing_childs] = q->childs[i].pid; info_data->closing_childs++; } } /*Merge history data*/ stats = q->stats_area + q->size * q->stats_block_size; copy_stats.counters64_size = stats->counters64_size; copy_stats.counterskbs_size = stats->counterskbs_size; copy_stats.counters64 = (void *)stats + _CI_ALIGN(sizeof(struct stat_memblock)); copy_stats.counterskbs = (void *)stats + _CI_ALIGN(sizeof(struct stat_memblock)) + stats->counters64_size*sizeof(uint64_t); ci_stat_memblock_merge(info_data->collect_stats, ©_stats); srv_stats = (struct server_statistics *)(q->stats_area + q->size * q->stats_block_size + q->stats_block_size); /*Compute server statistics*/ info_data->started_childs = srv_stats->started_childs; info_data->closed_childs = srv_stats->closed_childs; info_data->crashed_childs = srv_stats->crashed_childs; } struct stats_tmpl { char *gen_template; char *statsHeader; char *statsEnd; char *childsHeader; char *childs_tmpl; char *childsEnd; char *closingChildsHeader; char *d1TableHeader_tmpl; char *d1TableEntry_tmpl; char *d1TableEnd_tmpl; char *statline_tmpl_int; char *statline_tmpl_kbs; }; struct stats_tmpl txt_tmpl = { "Running Servers Statistics\n===========================\n"\ "Children number: %d\nFree Servers: %d\nUsed Servers: %d\n"\ "Started Processes: %u\nClosed Processes: %u\nCrashed Processes: %u\n"\ "Closing Processes: %u"\ "\n\n", "\n%s Statistics\n==================\n", "", "Child pids:", " %d", "\n", "Closing children pids:", "%s\n", "\t %s\n", "\n\n", "%s : %lld\n", "%s : %lld Kbs %d bytes\n" }; struct stats_tmpl html_tmpl = { "

Running Servers Statistics

\n"\ "" \ "
Children number: %d" \ "
Free Servers: %d" \ "
Used Servers: %d" \ "
Started Processes : %u" \ "
Closed Processes: %u" \ "
Crashed Processes: %u" \ "
Closing Processes: %u" \ "
\n", "

%s Statistics

\n", "
", "", "", "
Child pids: %d
\n", "", "
Closing children pids:
\n", "\n", "
%s
%s
\n", "%s: %lld\n", "%s: %lld Kbs %d bytes\n" }; #define LOCAL_BUF_SIZE 1024 int build_statistics(struct info_req_data *info_data) { char buf[LOCAL_BUF_SIZE]; char buf2[LOCAL_BUF_SIZE]; int sz, gid, k; char *stat_group; struct stats_tmpl *tmpl; if (info_data->txt_mode) tmpl = &txt_tmpl; else tmpl = &html_tmpl; if (!info_data->body) return 0; fill_queue_statistics(childs_queue, info_data); sz = snprintf(buf, LOCAL_BUF_SIZE,tmpl->gen_template, info_data->childs, info_data->free_servers, info_data->used_servers, info_data->started_childs, info_data->closed_childs, info_data->crashed_childs, info_data->closing_childs ); if (sz > LOCAL_BUF_SIZE) sz = LOCAL_BUF_SIZE; ci_membuf_write(info_data->body,buf, sz, 0); /*print childs pids ...*/ ci_membuf_write(info_data->body, tmpl->childsHeader, strlen(tmpl->childsHeader), 0); for (k =0; k < info_data->childs; k++) { sz = snprintf(buf, LOCAL_BUF_SIZE, tmpl->childs_tmpl, info_data->child_pids[k]); if (sz > LOCAL_BUF_SIZE) sz = LOCAL_BUF_SIZE; ci_membuf_write(info_data->body,buf, sz, 0); } ci_membuf_write(info_data->body, tmpl->childsEnd, strlen(tmpl->childsEnd), 0); /*print closing childs pids ...*/ ci_membuf_write(info_data->body, tmpl->closingChildsHeader, strlen(tmpl->closingChildsHeader), 0); for (k =0; k < info_data->closing_childs; k++) { sz = snprintf(buf, LOCAL_BUF_SIZE, tmpl->childs_tmpl, info_data->closing_child_pids[k]); if (sz > LOCAL_BUF_SIZE) sz = LOCAL_BUF_SIZE; ci_membuf_write(info_data->body,buf, sz, 0); } ci_membuf_write(info_data->body, tmpl->childsEnd, strlen(tmpl->childsEnd), 0); /*Print semaphores*/ sz = snprintf(buf, LOCAL_BUF_SIZE, tmpl->d1TableHeader_tmpl, "Semaphores in use"); if (sz > LOCAL_BUF_SIZE) sz = LOCAL_BUF_SIZE; ci_membuf_write(info_data->body,buf, sz, 0); accept_mutex.scheme->proc_mutex_print_info(&accept_mutex, buf2, LOCAL_BUF_SIZE); sz = snprintf(buf, LOCAL_BUF_SIZE, tmpl->d1TableEntry_tmpl, buf2); ci_membuf_write(info_data->body,buf, sz, 0); childs_queue->queue_mtx.scheme->proc_mutex_print_info(&childs_queue->queue_mtx, buf2, LOCAL_BUF_SIZE); sz = snprintf(buf, LOCAL_BUF_SIZE, tmpl->d1TableEntry_tmpl, buf2); ci_membuf_write(info_data->body,buf, sz, 0); ci_membuf_write(info_data->body, tmpl->d1TableEnd_tmpl, strlen(tmpl->d1TableEnd_tmpl), 0); /*Print shared mem*/ sz = snprintf(buf, LOCAL_BUF_SIZE, tmpl->d1TableHeader_tmpl, "Shared mem blocks in use"); if (sz > LOCAL_BUF_SIZE) sz = LOCAL_BUF_SIZE; ci_membuf_write(info_data->body,buf, sz, 0); if (childs_queue->shmid.scheme) { childs_queue->shmid.scheme->shared_mem_print_info(&childs_queue->shmid, buf2, LOCAL_BUF_SIZE); sz = snprintf(buf, LOCAL_BUF_SIZE, tmpl->d1TableEntry_tmpl, buf2); ci_membuf_write(info_data->body,buf, sz, 0); } ci_membuf_write(info_data->body, tmpl->d1TableEnd_tmpl, strlen(tmpl->d1TableEnd_tmpl), 0); for (gid = 0; gid < STAT_GROUPS.entries_num; gid++) { stat_group = STAT_GROUPS.groups[gid]; sz = snprintf(buf, LOCAL_BUF_SIZE, tmpl->statsHeader, stat_group); if (sz > LOCAL_BUF_SIZE) sz = LOCAL_BUF_SIZE; ci_membuf_write(info_data->body, buf, sz, 0); for (k=0; k < info_data->collect_stats->counters64_size && k < STAT_INT64.entries_num; k++) { if (gid == STAT_INT64.entries[k].gid) { sz = snprintf(buf, LOCAL_BUF_SIZE, tmpl->statline_tmpl_int, STAT_INT64.entries[k].label, info_data->collect_stats->counters64[k]); if (sz > LOCAL_BUF_SIZE) sz = LOCAL_BUF_SIZE; ci_membuf_write(info_data->body,buf, sz, 0); } } for (k=0; k < info_data->collect_stats->counterskbs_size && k < STAT_KBS.entries_num; k++) { if (gid == STAT_KBS.entries[k].gid) { sz = snprintf(buf, LOCAL_BUF_SIZE, tmpl->statline_tmpl_kbs, STAT_KBS.entries[k].label, info_data->collect_stats->counterskbs[k]); if (sz > LOCAL_BUF_SIZE) sz = LOCAL_BUF_SIZE; ci_membuf_write(info_data->body,buf, sz, 0); } } ci_membuf_write(info_data->body,tmpl->statsEnd, strlen(tmpl->statsEnd), 1); } return 1; } c_icap-0.4.2/COPYING0000664000175000017500000006350412567550776010745 00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! c_icap-0.4.2/cfg_param.c0000664000175000017500000010736112567550777011776 00000000000000/* * Copyright (C) 2004-2008 Christos Tsantilas * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA. */ #include "common.h" #include "c-icap.h" #include #include #include #include #include "service.h" #include "debug.h" #include "module.h" #include "filetype.h" #include "cfg_param.h" #include "commands.h" #include "acl.h" #include "txtTemplate.h" #include "proc_mutex.h" #include "registry.h" #include "shared_mem.h" #define MAX_INCLUDE_LEVEL 5 #define LINESIZE 8192 #define MAX_DIRECTIVE_SIZE 80 #define MAX_ARGS 50 int ARGC; char **ARGV; struct ci_server_conf CI_CONF = { NULL, /* LISTEN ADDRESS */ 1344, /*PORT*/ AF_INET, /*SOCK_FAMILY */ #ifdef _WIN32 "c:\\TEMP", /*TMPDIR*/ "c:\\TEMP\\c-icap.pid", /*PIDFILE*/ "\\\\.\\pipe\\c-icap", /*COMMANDS_SOCKET; */ #else "/var/tmp/", /*TMPDIR*/ "/var/run/c-icap/c-icap.pid", /*PIDFILE*/ "/var/run/c-icap/c-icap.ctl", /*COMMANDS_SOCKET; */ #endif NULL, /* RUN_USER */ NULL, /* RUN_GROUP */ #ifdef _WIN32 CONFDIR "\\c-icap.conf", /*cfg_file */ CONFDIR "\\c-icap.magic", /*magics_file */ #else CONFDIR "/c-icap.conf", /*cfg_file */ CONFDIR "/c-icap.magic", /*magics_file */ #endif NULL, /*MAGIC_DB */ SERVDIR, /*SERVICES_DIR */ MODSDIR, /*MODULES_DIR */ NULL, /*SERVER_ADMIN*/ NULL, /*SERVER_NAME*/ 5, /*START_SERVERS*/ 10, /*MAX_SERVERS*/ 30, /*THREADS_PER_CHILD*/ 30, /*MIN_SPARE_THREADS*/ 60 /*MAX_SPARE_THREADS*/ }; int TIMEOUT = 300; int KEEPALIVE_TIMEOUT = 15; int MAX_KEEPALIVE_REQUESTS = 100; int MAX_SECS_TO_LINGER = 5; int MAX_REQUESTS_BEFORE_REALLOCATE_MEM = 100; int MAX_REQUESTS_PER_CHILD = 0; int DAEMON_MODE = 1; int DebugLevelSetFromCmd = 0; const char *DEFAULT_SERVICE = NULL; /*Default service if not defined in ICAP URI*/ int PIPELINING = 1; int CHECK_FOR_BUGGY_CLIENT = 0; int ALLOW204_AS_200OK_ZERO_ENCAPS = 0; /* txtTemplate stuff */ extern const char *TEMPLATE_DIR; extern const char *TEMPLATE_DEF_LANG; extern int TEMPLATE_RELOAD_TIME; // Default time is one hour, this variable is in seconds extern int TEMPLATE_CACHE_SIZE; // How many templates can be cached extern int TEMPLATE_MEMBUF_SIZE; // Max memory for txtTemplate to expand template into txt extern char *SERVER_LOG_FILE; extern char *ACCESS_LOG_FILE; extern char *ACCESS_LOG_FORMAT; /*extern char *LOGS_DIR;*/ extern logger_module_t *default_logger; extern access_control_module_t **used_access_controllers; extern char *REMOTE_PROXY_USER_HEADER; extern int ALLOW_REMOTE_PROXY_USERS; extern int REMOTE_PROXY_USER_HEADER_ENCODED; /*Functions declaration */ int parse_file(const char *conf_file); /*config table functions*/ int cfg_load_magicfile(const char *directive, const char **argv, void *setdata); int cfg_load_service(const char *directive, const char **argv, void *setdata); int cfg_service_alias(const char *directive, const char **argv, void *setdata); int cfg_load_module(const char *directive, const char **argv, void *setdata); int cfg_set_logformat(const char *directive, const char **argv, void *setdata); int cfg_set_logger(const char *directive, const char **argv, void *setdata); int cfg_set_accesslog(const char *directive, const char **argv, void *setdata); int cfg_set_debug_level(const char *directive, const char **argv, void *setdata); int cfg_set_debug_stdout(const char *directive, const char **argv, void *setdata); int cfg_set_body_maxmem(const char *directive, const char **argv, void *setdata); int cfg_set_tmp_dir(const char *directive, const char **argv, void *setdata); int cfg_set_acl_controllers(const char *directive, const char **argv, void *setdata); int cfg_set_auth_method(const char *directive, const char **argv, void *setdata); int cfg_include_config_file(const char *directive, const char **argv, void *setdata); int cfg_group_source_by_group(const char *directive, const char **argv, void *setdata); int cfg_group_source_by_user(const char *directive, const char **argv, void *setdata); int cfg_shared_mem_scheme(const char *directive, const char **argv, void *setdata); int cfg_proc_lock_scheme(const char *directive, const char **argv, void *setdata); /*The following 2 functions defined in access.c file*/ int cfg_acl_add(const char *directive, const char **argv, void *setdata); int cfg_default_acl_access(const char *directive, const char **argv, void *setdata); /****/ struct sub_table { const char *name; int type; struct ci_conf_entry *conf_table; }; static struct ci_conf_entry conf_variables[] = { {"ListenAddress", &CI_CONF.ADDRESS, intl_cfg_set_str, NULL}, {"PidFile", &CI_CONF.PIDFILE, intl_cfg_set_str, NULL}, {"CommandsSocket", &CI_CONF.COMMANDS_SOCKET, intl_cfg_set_str, NULL}, {"Timeout", (void *) (&TIMEOUT), intl_cfg_set_int, NULL}, {"KeepAlive", NULL, NULL, NULL}, {"MaxKeepAliveRequests", &MAX_KEEPALIVE_REQUESTS, intl_cfg_set_int, NULL}, {"KeepAliveTimeout", &KEEPALIVE_TIMEOUT, intl_cfg_set_int, NULL}, {"StartServers", &CI_CONF.START_SERVERS, intl_cfg_set_int, NULL}, {"MaxServers", &CI_CONF.MAX_SERVERS, intl_cfg_set_int, NULL}, {"MinSpareThreads", &CI_CONF.MIN_SPARE_THREADS, intl_cfg_set_int, NULL}, {"MaxSpareThreads", &CI_CONF.MAX_SPARE_THREADS, intl_cfg_set_int, NULL}, {"ThreadsPerChild", &CI_CONF.THREADS_PER_CHILD, intl_cfg_set_int, NULL}, {"MaxRequestsPerChild", &MAX_REQUESTS_PER_CHILD, intl_cfg_set_int, NULL}, {"MaxRequestsReallocateMem", &MAX_REQUESTS_BEFORE_REALLOCATE_MEM, intl_cfg_set_int, NULL}, {"Port", &CI_CONF.PORT, intl_cfg_set_int, NULL}, {"User", &CI_CONF.RUN_USER, intl_cfg_set_str, NULL}, {"Group", &CI_CONF.RUN_GROUP, intl_cfg_set_str, NULL}, {"ServerAdmin", &CI_CONF.SERVER_ADMIN, intl_cfg_set_str, NULL}, {"ServerName", &CI_CONF.SERVER_NAME, intl_cfg_set_str, NULL}, {"LoadMagicFile", NULL, cfg_load_magicfile, NULL}, {"Logger", &default_logger, cfg_set_logger, NULL}, {"ServerLog", &SERVER_LOG_FILE, intl_cfg_set_str, NULL}, {"AccessLog", NULL, cfg_set_accesslog, NULL}, {"LogFormat", NULL, cfg_set_logformat, NULL}, {"DebugLevel", NULL, cfg_set_debug_level, NULL}, /*Set library's debug level */ {"ServicesDir", &CI_CONF.SERVICES_DIR, intl_cfg_set_str, NULL}, {"ModulesDir", &CI_CONF.MODULES_DIR, intl_cfg_set_str, NULL}, {"Service", NULL, cfg_load_service, NULL}, {"ServiceAlias", NULL, cfg_service_alias, NULL}, {"Module", NULL, cfg_load_module, NULL}, {"TmpDir", NULL, cfg_set_tmp_dir, NULL}, {"MaxMemObject", NULL, cfg_set_body_maxmem, NULL}, /*Set library's body max mem */ {"AclControllers", NULL, cfg_set_acl_controllers, NULL}, {"acl", NULL, cfg_acl_add, NULL}, {"icap_access", NULL, cfg_default_acl_access, NULL}, {"client_access", NULL, cfg_default_acl_access, NULL}, {"AuthMethod", NULL, cfg_set_auth_method, NULL}, {"Include", NULL, cfg_include_config_file, NULL}, {"RemoteProxyUserHeader", &REMOTE_PROXY_USER_HEADER, intl_cfg_set_str, NULL}, {"RemoteProxyUserHeaderEncoded", &REMOTE_PROXY_USER_HEADER_ENCODED, intl_cfg_onoff, NULL}, {"RemoteProxyUsers", &ALLOW_REMOTE_PROXY_USERS, intl_cfg_onoff, NULL}, {"TemplateDir", &TEMPLATE_DIR, intl_cfg_set_str, NULL}, {"TemplateDefaultLanguage", &TEMPLATE_DEF_LANG, intl_cfg_set_str, NULL}, {"TemplateReloadTime", &TEMPLATE_RELOAD_TIME, intl_cfg_set_int, NULL}, {"TemplateCacheSize", &TEMPLATE_CACHE_SIZE, intl_cfg_set_int, NULL}, {"TemplateMemBufSize", &TEMPLATE_MEMBUF_SIZE, intl_cfg_set_int, NULL}, {"GroupSourceByGroup", NULL, cfg_group_source_by_group, NULL}, {"GroupSourceByUser", NULL, cfg_group_source_by_user, NULL}, {"InterProcessSharedMemScheme", NULL, cfg_shared_mem_scheme, NULL}, {"InterProcessLockingScheme", NULL, cfg_proc_lock_scheme, NULL}, {"DefaultService", &DEFAULT_SERVICE, intl_cfg_set_str, NULL}, {"Pipelining", &PIPELINING, intl_cfg_onoff, NULL}, {"SupportBuggyClients", &CHECK_FOR_BUGGY_CLIENT, intl_cfg_onoff, NULL}, {"Allow204As200okZeroEncaps", &ALLOW204_AS_200OK_ZERO_ENCAPS, intl_cfg_enable, NULL}, {NULL, NULL, NULL, NULL} }; #define STEPSIZE 10 static struct sub_table *extra_conf_tables = NULL; int conf_tables_list_size = 0; int conf_tables_num = 0; struct ci_conf_entry *search_conf_table(struct ci_conf_entry *table, char *varname) { int i; for (i = 0; table[i].name != NULL; i++) { if (0 == strcmp(varname, table[i].name)) return &table[i]; } return NULL; } void init_conf_tables() { if ((extra_conf_tables = malloc(STEPSIZE * sizeof(struct sub_table))) == NULL) { ci_debug_printf(1, "Error allocating memory...\n"); return; } conf_tables_list_size = STEPSIZE; } void reset_conf_tables() { conf_tables_num = 0; } int register_conf_table(const char *name, struct ci_conf_entry *table, int type) { struct sub_table *new; int i, insert_pos; if (!extra_conf_tables) return 0; insert_pos = -1; for (i = 0; insert_pos < 0 && i < conf_tables_num; i++) { if (extra_conf_tables[i].name && strcmp(name, extra_conf_tables[i].name) == 0) { ci_debug_printf(1,"Config table :%s already exists!\n", name); return 0; } else if(extra_conf_tables[i].name == NULL) { /*empty pos use this one*/ insert_pos = i; } } if(insert_pos < 0) { /*if not empry pos found add it to the end*/ insert_pos = conf_tables_num; if (conf_tables_num == conf_tables_list_size) { /*tables list is full, reallocating space ...... */ if (NULL == (new = realloc(extra_conf_tables, sizeof(struct sub_table)*(conf_tables_list_size + STEPSIZE)))) return 0; extra_conf_tables = new; conf_tables_list_size += STEPSIZE; } conf_tables_num++; } ci_debug_printf(10, "Registering conf table:%s\n", name); extra_conf_tables[insert_pos].name = name; /*It works. Points to the modules.name. (????) */ extra_conf_tables[insert_pos].type = type; extra_conf_tables[insert_pos].conf_table = table; return 1; } struct ci_conf_entry *unregister_conf_table(const char *name) { int i; struct ci_conf_entry *table; if (extra_conf_tables) { /*Not really needed........ */ for (i = 0; i < conf_tables_num; i++) { if (extra_conf_tables[i].name && strcmp(name, extra_conf_tables[i].name) == 0) { table = extra_conf_tables[i].conf_table; extra_conf_tables[i].name = NULL; extra_conf_tables[i].type = 0; extra_conf_tables[i].conf_table = NULL; return table; } } } ci_debug_printf(1, "Table %s not found!\n", name); return NULL; } struct ci_conf_entry *search_variables(char *table, char *varname) { int i; if (table == NULL) return search_conf_table(conf_variables, varname); ci_debug_printf(3, "Going to search variable %s in table %s\n", varname, table); if (!extra_conf_tables) /*Not really needed........ */ return NULL; for (i = 0; i < conf_tables_num; i++) { if (extra_conf_tables[i].name && strcmp(table, extra_conf_tables[i].name) == 0) { return search_conf_table(extra_conf_tables[i].conf_table, varname); } } ci_debug_printf(1, "Variable %s or table %s not found!\n", varname, table); return NULL; } void print_conf_variables(struct ci_conf_entry *table) { int i; for (i = 0; table[i].name != NULL; i++) { ci_debug_printf(9, "%s=", table[i].name); if (!table[i].data) { ci_debug_printf(9, "\n"); } else if (table[i].action == intl_cfg_set_str) { if (*(char *) table[i].data) { ci_debug_printf(9, "%s\n", *(char **) table[i].data) } else { ci_debug_printf(9, "\n"); } } else if (table[i].action == intl_cfg_set_int) { ci_debug_printf(9, "%d\n", *(int *) table[i].data); } else if (table[i].action == intl_cfg_size_off) { ci_debug_printf(9, "%" PRINTF_OFF_T "\n", (CAST_OFF_T) *(ci_off_t *) table[i].data); } else if (table[i].action == intl_cfg_size_long) { ci_debug_printf(9, "%ld\n", *(long *) table[i].data); } else if (table[i].action == intl_cfg_onoff) { ci_debug_printf(9, "%d\n", *(int *) table[i].data); } else if (table[i].action == intl_cfg_enable) { ci_debug_printf(9, "%d\n", *(int *) table[i].data); } else if (table[i].action == intl_cfg_disable) { ci_debug_printf(9, "%d\n", *(int *) table[i].data); } else if (table[i].data) { ci_debug_printf(9, "%p\n", table[i].data); } } } int print_variables() { int i; ci_debug_printf(9, "\n\nPrinting variables\n"); print_conf_variables(conf_variables); if (!extra_conf_tables) /*Not really needed........ */ return 1; for (i = 0; i < conf_tables_num; i++) { if( extra_conf_tables[i].name) { ci_debug_printf(9, "Printing variables in table %s\n", extra_conf_tables[i].name); print_conf_variables(extra_conf_tables[i].conf_table); } } return 1; } /************************************************************************/ /* Set variables functions */ /* The following tree functions refered to non constant variables so the compilers in Win32 have problem to appeared in static arrays */ int cfg_set_debug_level(const char *directive, const char **argv, void *setdata) { if (!DebugLevelSetFromCmd) return intl_cfg_set_int(directive, argv, &CI_DEBUG_LEVEL); /*else ignore ....*/ return 1; } int cfg_set_debug_level_cmd(const char *directive, const char **argv, void *setdata) { DebugLevelSetFromCmd = 1; return intl_cfg_set_int(directive, argv, &CI_DEBUG_LEVEL); } int cfg_set_debug_stdout(const char *directive, const char **argv, void *setdata) { return intl_cfg_enable(directive, argv, &CI_DEBUG_STDOUT); } int cfg_set_body_maxmem(const char *directive, const char **argv, void *setdata) { return intl_cfg_size_long(directive, argv, &CI_BODY_MAX_MEM); } int cfg_load_service(const char *directive, const char **argv, void *setdata) { ci_service_module_t *service = NULL; if (argv == NULL || argv[0] == NULL || argv[1] == NULL) { ci_debug_printf(1, "Missing arguments in LoadService directive\n"); return 0; } ci_debug_printf(2, "Loading service :%s path %s\n", argv[0], argv[1]); if (!(service = register_service(argv[1]))) { ci_debug_printf(1, "Error loading service %s\n", argv[1]); return 0; } add_service_alias(argv[0], service->mod_name, NULL); return 1; } int cfg_service_alias(const char *directive, const char **argv, void *setdata) { char *service_args = NULL; if (argv == NULL || argv[0] == NULL || argv[1] == NULL) { ci_debug_printf(1, "Missing arguments in ServiceAlias directive\n"); return 0; } if ((service_args = strchr(argv[1], '?'))) { *service_args = '\0'; service_args++; } ci_debug_printf(2, "Alias:%s of service %s\n", argv[0], argv[1]); add_service_alias(argv[0], argv[1], service_args); return 1; } int cfg_load_module(const char *directive, const char **argv, void *setdata) { if (argv == NULL || argv[0] == NULL || argv[1] == NULL) { ci_debug_printf(1, "Missing arguments in LoadModule directive\n"); return 0; } ci_debug_printf(2, "Loading service :%s path %s\n", argv[0], argv[1]); if (!register_module(argv[1], argv[0])) { ci_debug_printf(1, "Error loading module %s, module path %s\n", argv[1], argv[0]); return 0; } return 1; } int cfg_load_magicfile(const char *directive, const char **argv, void *setdata) { const char *db_file; struct ci_magics_db *ndb; if (argv == NULL || argv[0] == NULL) { return 0; } db_file = argv[0]; if (strcmp(CI_CONF.magics_file, db_file) == 0) { ci_debug_printf(2, "The db file %s is the same as default. Ignoring...\n", db_file); return 1; } ci_debug_printf(2, "Going to load magic file %s\n", db_file); ndb = ci_magic_db_load(db_file); if (!ndb) { ci_debug_printf(1, "Can not load magic file %s!!!\n", db_file); return 0; } if (!CI_CONF.MAGIC_DB) CI_CONF.MAGIC_DB = ndb; return 1; } int logformat_add(const char *name, const char *format); int cfg_set_logformat(const char *directive, const char **argv, void *setdata) { if (argv == NULL || argv[0] == NULL || argv[1] == NULL) { ci_debug_printf(1, "Missing arguments in directive %s\n", directive); return 0; } ci_debug_printf(2, "Adding the logformat %s: %s\n",argv[0],argv[1]); return logformat_add(argv[0], argv[1]); } int file_log_addlogfile(const char *file, const char *format, const char **acls); int cfg_set_accesslog(const char *directive, const char **argv, void *setdata) { const char **acls = NULL; if (argv == NULL || argv[0] == NULL ) { ci_debug_printf(1, "Missing arguments in directive %s\n", directive); return 0; } if (argv[1] != NULL && argv[2] !=NULL) { acls = argv+2; } ci_debug_printf(2, "Adding the access logfile %s\n",argv[0]); return file_log_addlogfile(argv[0], argv[1], acls); } extern logger_module_t file_logger; int cfg_set_logger(const char *directive, const char **argv, void *setdata) { logger_module_t *logger; if (argv == NULL || argv[0] == NULL) { ci_debug_printf(1, "Missing arguments in directive\n"); return 0; } if (!(logger = find_logger(argv[0]))) return 0; default_logger = logger; ci_debug_printf(2, "Setting parameter :%s=%s\n", directive, argv[0]); return 1; } int cfg_set_tmp_dir(const char *directive, const char **argv, void *setdata) { int len; if (argv == NULL || argv[0] == NULL) { return 0; } cfg_default_value_store(&CI_CONF.TMPDIR, &CI_CONF.TMPDIR, sizeof(char *)); len = strlen(argv[0]); CI_CONF.TMPDIR = ci_cfg_alloc_mem((len + 2) * sizeof(char)); strcpy(CI_CONF.TMPDIR, argv[0]); #ifdef _WIN32 if (CI_CONF.TMPDIR[len] != '\\') { CI_CONF.TMPDIR[len] = '\\'; CI_CONF.TMPDIR[len + 1] = '\0'; } #else if (CI_CONF.TMPDIR[len] != '/') { CI_CONF.TMPDIR[len] = '/'; CI_CONF.TMPDIR[len + 1] = '\0'; } #endif /*Check if tmpdir exists. If no try to build it , report an error and uses the default... */ CI_TMPDIR = CI_CONF.TMPDIR; /*Sets the library's temporary dir to .... */ ci_debug_printf(2, "Setting parameter :%s=%s\n", directive, argv[0]); return 1; } int cfg_set_acl_controllers(const char *directive, const char **argv, void *setdata) { int i, k, argc, ret; access_control_module_t *acl_mod; if (argv == NULL || argv[0] == NULL) { return 0; } if (strncasecmp(argv[0], "none", 4) == 0) { used_access_controllers = NULL; return 1; } for (argc = 0; argv[argc] != NULL; argc++); /*Find the number of acl controllers */ used_access_controllers = ci_cfg_alloc_mem((argc+1) * sizeof(access_control_module_t *)); k = 0; ret = 1; for (i = 0; i < argc; i++) { if ((acl_mod = find_access_controller(argv[i])) != NULL) { used_access_controllers[k++] = acl_mod; } else { ci_debug_printf(1, "No access controller with name :%s\n", argv[i]); ret = 0; } } used_access_controllers[k] = NULL; return ret; } int cfg_set_auth_method(const char *directive, const char **argv, void *setdata) { const char *method = NULL; if (argv == NULL || argv[0] == NULL || argv[1] == NULL) { return 0; } method = argv[0]; if (strncasecmp(argv[1], "none", 4) == 0) { return set_method_authenticators(method, NULL); } return set_method_authenticators(method, (const char **)argv + 1); } int cfg_acl_add(const char *directive, const char **argv, void *setdata) { const char *acl_name, *acl_type; int argc, ok; if (!argv[0] || !argv[1] || !argv[2]) /* at least an argument */ return 0; acl_name = argv[0]; acl_type = argv[1]; for (argc = 2, ok =1; argv[argc] != NULL && ok; argc++){ ci_debug_printf(2, "Adding to acl %s the data %s\n", acl_name, argv[argc]); ok = ci_acl_add_data(acl_name, acl_type, argv[argc]); } ci_debug_printf(2, "New ACL with name:%s and ACL Type: %s\n", argv[0], argv[1]); return ok; } int cfg_include_config_file(const char *directive, const char **argv, void *setdata) { char path[CI_MAX_PATH]; const char *cfg_file; if (argv == NULL || argv[0] == NULL) { return 0; } cfg_file = argv[0]; if (cfg_file[0] != '/') { /*Win32 code? */ snprintf(path, CI_MAX_PATH, CONFDIR "/%s", cfg_file); path[CI_MAX_PATH - 1] = '\0'; cfg_file = path; } ci_debug_printf(2, "\n*** Going to open config file %s ***\n", cfg_file); return parse_file(cfg_file); } int group_source_add_by_group(const char *table_name); int group_source_add_by_user(const char *table_name); int cfg_group_source_by_group(const char *directive, const char **argv, void *setdata) { const char *group_table = NULL; if (argv == NULL || argv[0] == NULL) { return 0; } group_table = argv[0]; return group_source_add_by_group(group_table); } int cfg_group_source_by_user(const char *directive, const char **argv, void *setdata) { const char *group_table = NULL; if (argv == NULL || argv[0] == NULL) { return 0; } group_table = argv[0]; return group_source_add_by_user(group_table); } int cfg_shared_mem_scheme(const char *directive, const char **argv, void *setdata) { if (argv == NULL || argv[0] == NULL) { return 0; } return ci_shared_mem_set_scheme(argv[0]); } int cfg_proc_lock_scheme(const char *directive, const char **argv, void *setdata) { if (argv == NULL || argv[0] == NULL) { return 0; } return ci_proc_mutex_set_scheme(argv[0]); } /**************************************************************************/ /* Parse file functions */ int fread_line(FILE * f_conf, char *line) { if (!fgets(line, LINESIZE, f_conf)) { if (feof(f_conf)) { line[0] = '\0'; return -1; } else return 0; } if (strlen(line) >= LINESIZE - 2 && line[LINESIZE - 2] != '\n') { //Size of line > LINESIZE while (!feof(f_conf)) { if (fgetc(f_conf) == '\n') return 1; } return 0; } return 1; } struct ci_conf_entry *find_action(char *str, char **arg) { char *end, *table, *s; int size; end = str; while (*end != '\0' && !isspace(*end)) end++; size = end - str; *end = '\0'; /*Mark the end of Variable...... */ end++; /*... and continue.... */ while (*end != '\0' && isspace(*end)) /*Find the start of arguments ...... */ end++; *arg = end; if ((s = strchr(str, '.')) != NULL) { table = str; str = s + 1; *s = '\0'; } else table = NULL; // return search_conf_table(conf_variables,str); return search_variables(table, str); } char **split_args(char *args) { int len, i = 0, brkt; char **argv = NULL, *str, *end, *p; argv = malloc((MAX_ARGS + 1) * sizeof(char *)); end = args; do { str = end; if (*end == '"') { end++; str = end; while (*end != '\0' && *end != '"') { /*support escaped \" */ if (*end == '\\' && *(end+1) == '"') { for (p = end; *p != '\0'; p++) *p = *(p+1); } end++; } } else { /*Support arguments in the form arg{a, b...}*/ brkt = 0; while (*end != '\0' && (!isspace(*end) || brkt)) { if (*end == '{') brkt = 1; else if (brkt && *end == '}') brkt = 0; end++; } } len = end - str; argv[i] = malloc((len + 1) * sizeof(char)); memcpy(argv[i], str, len); /*copy until len or end of string */ argv[i][len] = '\0'; ++i; if (i >= MAX_ARGS) break; if (*end == '"') end++; while (*end != '\0' && isspace(*end)) end++; } while (*end != '\0'); argv[i] = NULL; return argv; } void free_args(char **argv) { int i; if (argv == NULL) return; for (i = 0; argv[i] != NULL; i++) { free(argv[i]); argv[i] = NULL; } free(argv); } int process_line(char *orig_line) { char *str, *args, **argv = NULL; int ret = 1; struct ci_conf_entry *entry; char line[LINESIZE]; strncpy(line, orig_line, LINESIZE); line[LINESIZE-1] = '\0'; str = line; while (*str != '\0' && isspace(*str)) /*Eat the spaces in the begging */ str++; if (*str == '\0' || *str == '#') /*Empty line or comment */ return 1; entry = find_action(str, &args); // ci_debug_printf(10,"Line %s (Args:%s)\n",entry->name,args); if (entry && entry->action) { argv = split_args(args); if ((*(entry->action)) (entry->name, (const char **)argv, entry->data) == 0) ret = 0; free_args(argv); return ret; } /*OK*/ /*Else parse error....... Log an error..... */ return 0; } static int PARSE_LEVEL = 0; int parse_file(const char *conf_file) { FILE *f_conf; char line[LINESIZE]; int line_count, ret_value; if (PARSE_LEVEL >= MAX_INCLUDE_LEVEL) { ci_debug_printf(1, "Include level > %d. I will not parse file:%s\n", MAX_INCLUDE_LEVEL, conf_file); return 0; } if ((f_conf = fopen(conf_file, "r")) == NULL) { //or log_server better........ ci_debug_printf(1, "Can not open configuration file %s\n", conf_file); return 0; } line_count = 0; ret_value = 1; PARSE_LEVEL++; while (!feof(f_conf)) { line_count++; if (!fread_line(f_conf, line) || !process_line(line)) { ci_debug_printf(1, "Fatal error while parsing config file: \"%s\" line: %d\n", conf_file, line_count); ci_debug_printf(1, "The line is: %s\n", line); ret_value = 0; } } fclose(f_conf); PARSE_LEVEL--; return ret_value; } /****************************************************************/ /* Command line options implementation, function and structures */ /* #ifdef _WIN32 */ /* #define opt_pre "/" */ /* #else */ #define opt_pre "-" /* #endif */ static struct ci_options_entry options[] = { {opt_pre "f", "filename", &CI_CONF.cfg_file, ci_cfg_set_str, "Specify the configuration file"}, {opt_pre "N", NULL, &DAEMON_MODE, ci_cfg_disable, "Do not run as daemon"}, {opt_pre "d", "level", NULL, cfg_set_debug_level_cmd, "Specify the debug level"}, {opt_pre "D", NULL, NULL, cfg_set_debug_stdout, "Print debug info to stdout"}, {NULL, NULL, NULL, NULL} }; int config(int argc, char **argv) { ARGC = argc; ARGV = argv; ci_cfg_lib_init(); if (!ci_args_apply(argc, argv, options)) { ci_debug_printf(1, "Error in command line options\n"); ci_args_usage(argv[0], options); exit(-1); } if (!parse_file(CI_CONF.cfg_file)) { ci_debug_printf(1, "Error opening/parsing config file\n"); exit(0); } return 1; } void cfg_default_value_restore_all(); int reconfig() { /*reseting all parameters to default values ... */ cfg_default_value_restore_all(); /*reseting cfg_lib */ ci_cfg_lib_reset(); if (!ci_args_apply(ARGC, ARGV, options)) { ci_debug_printf(1, "Error in command line options, while reconfiguring!\n"); return 0; } if (!parse_file(CI_CONF.cfg_file)) { ci_debug_printf(1, "Error opening/parsing config file, while reconfiguring!\n"); return 0; } return 1; } int init_server(char *address, int port, int *family); void release_modules(); void ci_dlib_closeall(); int log_open(); void ci_magic_db_free(); void reset_http_auth(); void system_shutdown() { /* - reset commands table */ commands_reset(); /* - clean registry */ ci_registry_clean(); /* - close/release services and modules */ release_services(); release_modules(); ci_dlib_closeall(); /* Release other subsystems */ ci_magic_db_free(); CI_CONF.MAGIC_DB = NULL; ci_txt_template_close(); } int system_reconfigure() { int old_port; ci_debug_printf(1, "Going to reconfigure system!\n"); system_shutdown(); reset_conf_tables(); ci_acl_reset(); reset_http_auth(); ci_debug_printf(1, "All resources released. Going to reload!\n"); ci_txt_template_init(); if (!(CI_CONF.MAGIC_DB = ci_magic_db_load(CI_CONF.magics_file))) { ci_debug_printf(1, "Can not load magic file %s!!!\n", CI_CONF.magics_file); } init_modules(); init_services(); /* - Freeing all memory and resources used by configuration parameters (is it possible???) - reopen and read config file. Now the monitor process has now the new config parameters. */ old_port = CI_CONF.PORT; if (!reconfig()) return 0; /* - reinit listen socket if needed */ if (old_port != CI_CONF.PORT) { init_server(CI_CONF.ADDRESS, CI_CONF.PORT, &(CI_CONF.PROTOCOL_FAMILY)); } log_open(); /* - post_init services and modules */ post_init_modules(); post_init_services(); return 1; } /**************************************************************************/ /* Library functions */ /*********************************************************************/ /* Implementation of a mechanism to keep default values of parameters*/ struct cfg_default_value *default_values = NULL; /*We does not care about memory managment here. Default values list created only once at the beggining of c-icap and does not needed to free or reallocate memory... I think ... */ struct cfg_default_value *cfg_default_value_store(void *param, void *value, int size) { struct cfg_default_value *dval, *dval_search; if ((dval = cfg_default_value_search(param))) return dval; if (!(dval = malloc(sizeof(struct cfg_default_value)))) return 0; dval->param = param; /*Iam sure we can just set it to param_name, but..... */ dval->size = size; if (!(dval->value = malloc(size))) { free(dval); return NULL; } memcpy(dval->value, value, size); dval->next = NULL; if (default_values == NULL) { default_values = dval; return dval; } dval_search = default_values; while (dval_search->next != NULL) dval_search = dval_search->next; dval_search->next = dval; return dval; } struct cfg_default_value *cfg_default_value_replace(void *param, void *value) { struct cfg_default_value *dval; dval = default_values; while (dval != NULL && dval->param != param) dval = dval->next; if (!dval) return NULL; memcpy(dval->value, value, dval->size); return dval; } struct cfg_default_value *cfg_default_value_search(void *param) { struct cfg_default_value *dval; dval = default_values; ci_debug_printf(8, "Searching %p for default value\n", param); while (dval != NULL && dval->param != param) dval = dval->next; return dval; } void *cfg_default_value_restore(void *param) { struct cfg_default_value *dval; dval = default_values; ci_debug_printf(8, "Geting default value for %p\n", param); while (dval != NULL && dval->param != param) dval = dval->next; if (!dval) return NULL; ci_debug_printf(8, "Found: %p\n", dval->value); memcpy(param, dval->value, dval->size); return param; } void cfg_default_value_restore_all() { struct cfg_default_value *dval; dval = default_values; while (dval != NULL) { memcpy(dval->param, dval->value, dval->size); dval = dval->next; } } /********************************************************************/ /* functions for setting parameters and saving the default values */ int intl_cfg_set_str(const char *directive, const char **argv, void *setdata) { if (!setdata) return 0; cfg_default_value_store(setdata, setdata, sizeof(char *)); /*or better keep all string not just the pointer to default value? */ return ci_cfg_set_str(directive, argv, setdata); } int intl_cfg_set_int(const char *directive, const char **argv, void *setdata) { if (!setdata) return 0; cfg_default_value_store(setdata, setdata, sizeof(int)); return ci_cfg_set_int(directive, argv, setdata); } int intl_cfg_onoff(const char *directive, const char **argv, void *setdata) { if (!setdata) return 0; cfg_default_value_store(setdata, setdata, sizeof(int)); return ci_cfg_onoff(directive, argv, setdata); } int intl_cfg_disable(const char *directive, const char **argv, void *setdata) { if (!setdata) return 0; cfg_default_value_store(setdata, setdata, sizeof(int)); return ci_cfg_disable(directive, argv, setdata); } int intl_cfg_enable(const char *directive, const char **argv, void *setdata) { if (!setdata) return 0; cfg_default_value_store(setdata, setdata, sizeof(int)); return ci_cfg_enable(directive, argv, setdata); } int intl_cfg_size_off(const char *directive, const char **argv, void *setdata) { if (!setdata) return 0; cfg_default_value_store(setdata, setdata, sizeof(ci_off_t)); return ci_cfg_size_off(directive, argv, setdata); } int intl_cfg_size_long(const char *directive, const char **argv, void *setdata) { if (!setdata) return 0; cfg_default_value_store(setdata, setdata, sizeof(long int)); return ci_cfg_size_long(directive, argv, setdata); }