hitch-1.1.1/0000755000175000017500000000000012651710537007621 500000000000000hitch-1.1.1/configure.ac0000644000175000017500000000334512651707236012036 00000000000000# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ([2.59]) AC_INIT([hitch], [1.1.1], [support@varnish-software.com]) AC_CONFIG_SRCDIR([src/configuration.c]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE # Checks for programs. AC_PROG_CC AC_PROG_INSTALL AC_PROG_MAKE_SET AC_ARG_WITH([rst2man], AS_HELP_STRING([--with-rst2man=PATH], [Location of rst2man (auto)]), [RST2MAN="$withval"], AC_CHECK_PROGS(RST2MAN, [rst2man rst2man.py], [no])) if test "x$RST2MAN" = "xno"; then AC_MSG_ERROR( [rst2man is needed to build Hitch, please install python-docutils. To proceed without building man pages, specify --with-rst2man=/bin/true.]) fi AM_MAINTAINER_MODE([disable]) # Checks for libraries. AC_CHECK_LIB([ev], [ev_default_loop], [], AC_MSG_ERROR([Cannot find libev headers.])) AC_CHECK_LIB([ssl], [SSL_CTX_free], [], AC_MSG_ERROR([Cannot find libssl headers.])) AC_ARG_ENABLE(sessioncache, AC_HELP_STRING([--enable-sessioncache], [Enable TLS session cache. (default is off)]), [use_shctx="$withval"], [use_shctx=no]) if test xno != x"$use_shctx"; then CFLAGS += " -DUSE_SHARED_CACHE -DUSE_SYSCALL_FUTEX" fi AM_CONDITIONAL(USE_SHCTX, test xno != x"$use_shctx") # Checks for header files. AC_CHECK_HEADERS([stdlib.h unistd.h]) # Checks for typedefs, structures, and compiler characteristics. AC_TYPE_UID_T AC_C_INLINE AC_TYPE_INT32_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_SSIZE_T AC_TYPE_UINT32_T # Checks for library functions. AC_FUNC_FORK AC_FUNC_MALLOC AC_FUNC_MMAP AC_CHECK_FUNCS([inet_ntoa]) AC_CHECK_FUNCS([accept4]) AC_SUBST([AM_CPPFLAGS]) AC_SUBST([AM_LDFLAGS]) AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([src/Makefile]) AC_OUTPUT hitch-1.1.1/hitch.80000644000175000017500000001072312651666717010746 00000000000000.\" Man page generated from reStructuredText. . .TH HITCH 8 "" "" "" .SH NAME Hitch \- high performance TLS proxy . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .sp hitch [OPTIONS] [PEM] .SH DESCRIPTION .sp Hitch is a network proxy that terminates TLS/SSL connections and forwards the unencrypted traffic to some backend. It\(aqs designed to handle 10s of thousands of connections efficiently on multicore machines. .sp Hitch has very few features \-\- it\(aqs designed to be paired with an intelligent backend like Varnish Cache. It maintains a strict 1:1 connection pattern with this backend handler so that the backend can dictate throttling behavior, maximum connection behavior, availability of service, etc. .sp The only required argument is a path to a PEM file that contains the certificate (or a chain of certificates) and private key. It should also contain DH parameter if you wish to use Diffie\-Hellman cipher suites. .SH COMMAND LINE ARGUMENTS .INDENT 0.0 .INDENT 3.5 .INDENT 0.0 .TP .BI \-\-config\fB= FILE Load configuration from specified file. .TP .B \-\-tls TLSv1 (default. No SSLv3) .TP .B \-\-ssl SSLv3 (enables SSLv3) .TP .B \-c .INDENT 7.0 .TP .BI \-\-ciphers\fB= SUITE Sets allowed ciphers (Default: "") .UNINDENT .TP .B \-e .INDENT 7.0 .TP .BI \-\-ssl\-engine\fB= NAME Sets OpenSSL engine (Default: "") .UNINDENT .TP .B \-O .INDENT 7.0 .TP .B \-\-prefer\-server\-ciphers Prefer server list order .UNINDENT .TP .B \-\-client Enable client proxy mode .TP .B \-b \-\-backend=[HOST]:PORT Backend [connect] (default is "[127.0.0.1]:8000") .TP .B \-f \-\-frontend=[HOST]:PORT[+CERT] Frontend [bind] (default is "[*]:8443") (Note: brackets are mandatory in endpoint specifiers.) .TP .B \-n .INDENT 7.0 .TP .BI \-\-workers\fB= NUM Number of worker processes (Default: 1) .UNINDENT .TP .B \-B .INDENT 7.0 .TP .BI \-\-backlog\fB= NUM Set listen backlog size (Default: 100) .UNINDENT .TP .B \-k .INDENT 7.0 .TP .BI \-\-keepalive\fB= SECS TCP keepalive on client socket (Default: 3600) .UNINDENT .TP .B \-r .INDENT 7.0 .TP .BI \-\-chroot\fB= DIR Sets chroot directory (Default: "") .UNINDENT .TP .B \-u .INDENT 7.0 .TP .BI \-\-user\fB= USER Set uid/gid after binding the socket (Default: "") .UNINDENT .TP .B \-g .INDENT 7.0 .TP .BI \-\-group\fB= GROUP Set gid after binding the socket (Default: "") .UNINDENT .TP .B \-q .INDENT 7.0 .TP .B \-\-quiet Be quiet; emit only error messages .UNINDENT .TP .B \-s .INDENT 7.0 .TP .B \-\-syslog Send log message to syslog in addition to stderr/stdout .UNINDENT .TP .BI \-\-syslog\-facility\fB= FACILITY Syslog facility to use (Default: "daemon") .TP .B \-\-daemon Fork into background and become a daemon; this also sets the \-\-quiet option (Default: off) .TP .B \-\-write\-ip Write 1 octet with the IP family followed by the IP address in 4 (IPv4) or 16 (IPv6) octets little\-endian to backend before the actual data (Default: off) .TP .B \-\-write\-proxy\-v1 Write HaProxy\(aqs PROXY v1 (IPv4 or IPv6) protocol line before actual data (Default: off) .TP .B \-\-write\-proxy\-v2 Write HaProxy\(aqs PROXY v2 binary (IPv4 or IPv6) protocol line before actual data (Default: off) .TP .B \-\-write\-proxy Equivalent to \-\-write\-proxy\-v2. For PROXY version 1 use \-\-write\-proxy\-v1 explicitly .TP .B \-\-proxy\-proxy Proxy HaProxy\(aqs PROXY (IPv4 or IPv6) protocol line before actual data (PROXY v1 only) (Default: off) .TP .B \-\-sni\-nomatch\-abort Abort handshake when client submits an unrecognized SNI server name (Default: off) .TP .B \-t .INDENT 7.0 .TP .B \-\-test Test configuration and exit .UNINDENT .TP .B \-p .INDENT 7.0 .TP .BI \-\-pidfile\fB= FILE PID file .UNINDENT .TP .B \-V .INDENT 7.0 .TP .B \-\-version Print program version and exit .UNINDENT .TP .B \-h .INDENT 7.0 .TP .B \-\-help This help message .UNINDENT .UNINDENT .UNINDENT .UNINDENT .SH HISTORY .sp Hitch was originally called stud and was written by Jamie Turner at Bump.com. .\" Generated by docutils manpage writer. . hitch-1.1.1/LICENSE0000644000175000017500000000303412546560025010544 00000000000000Copyright 2015 Varnish Software AB. Copyright 2012 Bump Technologies, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY BUMP TECHNOLOGIES, INC. ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BUMP TECHNOLOGIES, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of Bump Technologies, Inc. hitch-1.1.1/depcomp0000755000175000017500000005601612563613157011130 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2014 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: hitch-1.1.1/compile0000755000175000017500000001624512563613157011131 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-10-14.11; # UTC # Copyright (C) 1999-2014 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: hitch-1.1.1/Makefile.in0000644000175000017500000006775612651707277011642 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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 = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } 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 = : subdir = . 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) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.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 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)" "$(DESTDIR)$(docdir)" NROFF = nroff MANS = $(dist_man_MANS) DATA = $(doc_DATA) 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)config.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) am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in \ $(srcdir)/config.h.in COPYING compile depcomp install-sh \ missing 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_CPPFLAGS = @AM_CPPFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ 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@ RST2MAN = @RST2MAN@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ 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_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ 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@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = src doc_DATA = hitch.conf.ex CHANGES.rst README.md dist_man_MANS = hitch.8 EXTRA_DIST = LICENSE README.md hitch.man.rst hitch.conf.ex CHANGES.rst docs all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: 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) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign 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): config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 install-man8: $(dist_man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(dist_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='$(dist_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) install-docDATA: $(doc_DATA) @$(NORMAL_INSTALL) @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(docdir)" || 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_DATA) $$files '$(DESTDIR)$(docdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \ done uninstall-docDATA: @$(NORMAL_UNINSTALL) @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(docdir)'; $(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 distribution archives compressed with" \ "legacy program 'compress' 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 shar distribution archives 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)/_build/sub $(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/sub \ && ../../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 $(MANS) $(DATA) config.h installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(docdir)"; 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: 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 mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-docDATA install-man 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-man8 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 -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-docDATA uninstall-man uninstall-man: uninstall-man8 .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-cscope clean-generic \ 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-generic distclean-hdr \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-docDATA 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-docDATA uninstall-man uninstall-man8 .PRECIOUS: Makefile hitch.8: hitch.man.rst ${RST2MAN} --halt=2 $(srcdir)/hitch.man.rst $@ # 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: hitch-1.1.1/configure0000755000175000017500000060046212651707277011467 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for hitch 1.1.1. # # Report bugs to . # # # 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" 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 and $0: support@varnish-software.com 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'" 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='hitch' PACKAGE_TARNAME='hitch' PACKAGE_VERSION='1.1.1' PACKAGE_STRING='hitch 1.1.1' PACKAGE_BUGREPORT='support@varnish-software.com' PACKAGE_URL='' ac_unique_file="src/configuration.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_header_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS AM_LDFLAGS AM_CPPFLAGS LIBOBJS EGREP GREP CPP USE_SHCTX_FALSE USE_SHCTX_TRUE MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE RST2MAN 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 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 runstatedir 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_silent_rules enable_dependency_tracking with_rst2man enable_maintainer_mode enable_sessioncache ' 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' runstatedir='${localstatedir}/run' 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 ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -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 runstatedir 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 hitch 1.1.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] 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] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --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/hitch] --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 _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of hitch 1.1.1:";; 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-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-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-sessioncache Enable TLS session cache. (default is off) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-rst2man=PATH Location of rst2man (auto) 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 . _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 hitch configure 1.1.1 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_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_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_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;} ( $as_echo "## ------------------------------------------- ## ## Report this to support@varnish-software.com ## ## ------------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&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_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_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_find_intX_t LINENO BITS VAR # ----------------------------------- # Finds a signed integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_intX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 $as_echo_n "checking for int$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in int$2_t 'int' 'long int' \ 'long long int' 'short int' 'signed char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else case $ac_type in #( int$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done 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_find_intX_t # 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_find_uintX_t LINENO BITS VAR # ------------------------------------ # Finds an unsigned integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : case $ac_type in #( uint$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done 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_find_uintX_t # 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 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 hitch $as_me 1.1.1, 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 as_fn_append ac_header_list " stdlib.h" as_fn_append ac_header_list " unistd.h" as_fn_append ac_header_list " sys/param.h" # 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 ac_config_headers="$ac_config_headers config.h" am__api_version='1.15' 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+set}" != 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='hitch' VERSION='1.1.1' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # 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 (and possibly the TAP driver). 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 # Checks for programs. 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 { $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 # Check whether --with-rst2man was given. if test "${with_rst2man+set}" = set; then : withval=$with_rst2man; RST2MAN="$withval" else for ac_prog in rst2man rst2man.py 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_RST2MAN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RST2MAN"; then ac_cv_prog_RST2MAN="$RST2MAN" # 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_RST2MAN="$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 RST2MAN=$ac_cv_prog_RST2MAN if test -n "$RST2MAN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RST2MAN" >&5 $as_echo "$RST2MAN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$RST2MAN" && break done test -n "$RST2MAN" || RST2MAN="no" fi if test "x$RST2MAN" = "xno"; then as_fn_error $? "rst2man is needed to build Hitch, please install python-docutils. To proceed without building man pages, specify --with-rst2man=/bin/true." "$LINENO" 5 fi { $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 # Checks for libraries. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ev_default_loop in -lev" >&5 $as_echo_n "checking for ev_default_loop in -lev... " >&6; } if ${ac_cv_lib_ev_ev_default_loop+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lev $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 ev_default_loop (); int main () { return ev_default_loop (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ev_ev_default_loop=yes else ac_cv_lib_ev_ev_default_loop=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_ev_ev_default_loop" >&5 $as_echo "$ac_cv_lib_ev_ev_default_loop" >&6; } if test "x$ac_cv_lib_ev_ev_default_loop" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBEV 1 _ACEOF LIBS="-lev $LIBS" else as_fn_error $? "Cannot find libev headers." "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_CTX_free in -lssl" >&5 $as_echo_n "checking for SSL_CTX_free in -lssl... " >&6; } if ${ac_cv_lib_ssl_SSL_CTX_free+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lssl $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 SSL_CTX_free (); int main () { return SSL_CTX_free (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ssl_SSL_CTX_free=yes else ac_cv_lib_ssl_SSL_CTX_free=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_ssl_SSL_CTX_free" >&5 $as_echo "$ac_cv_lib_ssl_SSL_CTX_free" >&6; } if test "x$ac_cv_lib_ssl_SSL_CTX_free" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBSSL 1 _ACEOF LIBS="-lssl $LIBS" else as_fn_error $? "Cannot find libssl headers." "$LINENO" 5 fi # Check whether --enable-sessioncache was given. if test "${enable_sessioncache+set}" = set; then : enableval=$enable_sessioncache; use_shctx="$withval" else use_shctx=no fi if test xno != x"$use_shctx"; then CFLAGS += " -DUSE_SHARED_CACHE -DUSE_SYSCALL_FUTEX" fi if test xno != x"$use_shctx"; then USE_SHCTX_TRUE= USE_SHCTX_FALSE='#' else USE_SHCTX_TRUE='#' USE_SHCTX_FALSE= fi # Checks for header files. 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 for ac_header in stdlib.h unistd.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 # Checks for typedefs, structures, and compiler characteristics. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 $as_echo_n "checking for uid_t in sys/types.h... " >&6; } if ${ac_cv_type_uid_t+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "uid_t" >/dev/null 2>&1; then : ac_cv_type_uid_t=yes else ac_cv_type_uid_t=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 $as_echo "$ac_cv_type_uid_t" >&6; } if test $ac_cv_type_uid_t = no; then $as_echo "#define uid_t int" >>confdefs.h $as_echo "#define gid_t int" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" case $ac_cv_c_int32_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int32_t $ac_cv_c_int32_t _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi 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 cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" if test "x$ac_cv_type_ssize_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define ssize_t int _ACEOF fi ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) $as_echo "#define _UINT32_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint32_t $ac_cv_c_uint32_t _ACEOF ;; esac # Checks for library functions. for ac_header in vfork.h do : ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" if test "x$ac_cv_header_vfork_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VFORK_H 1 _ACEOF fi done for ac_func in fork vfork 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 fi done if test "x$ac_cv_func_fork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 $as_echo_n "checking for working fork... " >&6; } if ${ac_cv_func_fork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_fork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* By Ruediger Kuhlmann. */ return fork () < 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_fork_works=yes else ac_cv_func_fork_works=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_func_fork_works" >&5 $as_echo "$ac_cv_func_fork_works" >&6; } else ac_cv_func_fork_works=$ac_cv_func_fork fi if test "x$ac_cv_func_fork_works" = xcross; then case $host in *-*-amigaos* | *-*-msdosdjgpp*) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 $as_echo_n "checking for working vfork... " >&6; } if ${ac_cv_func_vfork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_vfork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ $ac_includes_default #include #ifdef HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers (e.g. gcc -O) don't grok . Test for this by using a static variable whose address is put into a register that is clobbered by the vfork. */ static void #ifdef __cplusplus sparc_address_test (int arg) # else sparc_address_test (arg) int arg; #endif { static pid_t child; if (!child) { child = vfork (); if (child < 0) { perror ("vfork"); _exit(2); } if (!child) { arg = getpid(); write(-1, "", 0); _exit (arg); } } } int main () { pid_t parent = getpid (); pid_t child; sparc_address_test (0); child = vfork (); if (child == 0) { /* Here is another test for sparc vfork register problems. This test uses lots of local variables, at least as many local variables as main has allocated so far including compiler temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should reuse the register of parent for one of the local variables, since it will think that parent can't possibly be used any more in this routine. Assigning to the local variable will thus munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); /* Convince the compiler that p..p7 are live; otherwise, it might use the same hardware register for all 8 local variables. */ if (p != p1 || p != p2 || p != p3 || p != p4 || p != p5 || p != p6 || p != p7) _exit(1); /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; struct stat st; while (wait(&status) != child) ; return ( /* Was there some problem with vforking? */ child < 0 /* Did the child fail? (This shouldn't happen.) */ || status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 0 ); } } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_vfork_works=yes else ac_cv_func_vfork_works=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_func_vfork_works" >&5 $as_echo "$ac_cv_func_vfork_works" >&6; } fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then $as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h else $as_echo "#define vfork fork" >>confdefs.h fi if test "x$ac_cv_func_fork_works" = xyes; then $as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h fi for ac_header in stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } if ${ac_cv_func_malloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else ac_cv_func_malloc_0_nonnull=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_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then : $as_echo "#define HAVE_MALLOC 1" >>confdefs.h else $as_echo "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac $as_echo "#define malloc rpl_malloc" >>confdefs.h fi for ac_header in $ac_header_list 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 for ac_func in getpagesize do : ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize" if test "x$ac_cv_func_getpagesize" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_GETPAGESIZE 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5 $as_echo_n "checking for working mmap... " >&6; } if ${ac_cv_func_mmap_fixed_mapped+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_mmap_fixed_mapped=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default /* malloc might have been renamed as rpl_malloc. */ #undef malloc /* Thanks to Mike Haertel and Jim Avera for this test. Here is a matrix of mmap possibilities: mmap private not fixed mmap private fixed at somewhere currently unmapped mmap private fixed at somewhere already mapped mmap shared not fixed mmap shared fixed at somewhere currently unmapped mmap shared fixed at somewhere already mapped For private mappings, we should verify that changes cannot be read() back from the file, nor mmap's back from the file at a different address. (There have been systems where private was not correctly implemented like the infamous i386 svr4.0, and systems where the VM page cache was not coherent with the file system buffer cache like early versions of FreeBSD and possibly contemporary NetBSD.) For shared mappings, we should conversely verify that changes get propagated back to all the places they're supposed to be. Grep wants private fixed already mapped. The main things grep needs to know about mmap are: * does it exist and is it safe to write into the mmap'd area * how to use it (BSD variants) */ #include #include #if !defined STDC_HEADERS && !defined HAVE_STDLIB_H char *malloc (); #endif /* This mess was copied from the GNU getpagesize.h. */ #ifndef HAVE_GETPAGESIZE # ifdef _SC_PAGESIZE # define getpagesize() sysconf(_SC_PAGESIZE) # else /* no _SC_PAGESIZE */ # ifdef HAVE_SYS_PARAM_H # include # ifdef EXEC_PAGESIZE # define getpagesize() EXEC_PAGESIZE # else /* no EXEC_PAGESIZE */ # ifdef NBPG # define getpagesize() NBPG * CLSIZE # ifndef CLSIZE # define CLSIZE 1 # endif /* no CLSIZE */ # else /* no NBPG */ # ifdef NBPC # define getpagesize() NBPC # else /* no NBPC */ # ifdef PAGESIZE # define getpagesize() PAGESIZE # endif /* PAGESIZE */ # endif /* no NBPC */ # endif /* no NBPG */ # endif /* no EXEC_PAGESIZE */ # else /* no HAVE_SYS_PARAM_H */ # define getpagesize() 8192 /* punt totally */ # endif /* no HAVE_SYS_PARAM_H */ # endif /* no _SC_PAGESIZE */ #endif /* no HAVE_GETPAGESIZE */ int main () { char *data, *data2, *data3; const char *cdata2; int i, pagesize; int fd, fd2; pagesize = getpagesize (); /* First, make a file with some known garbage in it. */ data = (char *) malloc (pagesize); if (!data) return 1; for (i = 0; i < pagesize; ++i) *(data + i) = rand (); umask (0); fd = creat ("conftest.mmap", 0600); if (fd < 0) return 2; if (write (fd, data, pagesize) != pagesize) return 3; close (fd); /* Next, check that the tail of a page is zero-filled. File must have non-zero length, otherwise we risk SIGBUS for entire page. */ fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600); if (fd2 < 0) return 4; cdata2 = ""; if (write (fd2, cdata2, 1) != 1) return 5; data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L); if (data2 == MAP_FAILED) return 6; for (i = 0; i < pagesize; ++i) if (*(data2 + i)) return 7; close (fd2); if (munmap (data2, pagesize)) return 8; /* Next, try to mmap the file at a fixed address which already has something else allocated at it. If we can, also make sure that we see the same garbage. */ fd = open ("conftest.mmap", O_RDWR); if (fd < 0) return 9; if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, fd, 0L)) return 10; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data2 + i)) return 11; /* Finally, make sure that changes to the mapped area do not percolate back to the file as seen by read(). (This is a bug on some variants of i386 svr4.0.) */ for (i = 0; i < pagesize; ++i) *(data2 + i) = *(data2 + i) + 1; data3 = (char *) malloc (pagesize); if (!data3) return 12; if (read (fd, data3, pagesize) != pagesize) return 13; for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data3 + i)) return 14; close (fd); return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_mmap_fixed_mapped=yes else ac_cv_func_mmap_fixed_mapped=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_func_mmap_fixed_mapped" >&5 $as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; } if test $ac_cv_func_mmap_fixed_mapped = yes; then $as_echo "#define HAVE_MMAP 1" >>confdefs.h fi rm -f conftest.mmap conftest.txt for ac_func in inet_ntoa do : ac_fn_c_check_func "$LINENO" "inet_ntoa" "ac_cv_func_inet_ntoa" if test "x$ac_cv_func_inet_ntoa" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_INET_NTOA 1 _ACEOF fi done for ac_func in accept4 do : ac_fn_c_check_func "$LINENO" "accept4" "ac_cv_func_accept4" if test "x$ac_cv_func_accept4" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ACCEPT4 1 _ACEOF fi done ac_config_files="$ac_config_files Makefile" ac_config_files="$ac_config_files src/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= U= 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 { $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 "${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 if test -z "${USE_SHCTX_TRUE}" && test -z "${USE_SHCTX_FALSE}"; then as_fn_error $? "conditional \"USE_SHCTX\" 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 hitch $as_me 1.1.1, 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 ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ hitch config.status 1.1.1 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" _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 "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/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 } ;; 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 hitch-1.1.1/hitch.conf.ex0000644000175000017500000000512312633547533012127 00000000000000# # Example configuration file for hitch(8). # # NOTE: all config file parameters can be overriden # from command line! # Listening address. REQUIRED. # Can be specified multiple times for multiple listen endpoints. # type: string # syntax: [HOST]:PORT[+CERT] frontend = "[*]:8443" # Upstream server address. REQUIRED. # # type: string # syntax: [HOST]:PORT. backend = "[127.0.0.1]:6081" # SSL x509 certificate file. REQUIRED. # List multiple certs to use SNI. Certs are used in the order they # are listed; the last cert listed will be used if none of the others match # # type: string pem-file = "" # SSL protocol. # # tls = on # ssl = off # List of allowed SSL ciphers. # # Run openssl ciphers for list of available ciphers. # type: string ciphers = "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH" # Enforce server cipher list order # # type: boolean prefer-server-ciphers = off # Use specified SSL engine # # type: string ssl-engine = "" # Number of worker processes # # type: integer workers = 1 # Listen backlog size # # type: integer backlog = 100 # TCP socket keepalive interval in seconds # # type: integer keepalive = 3600 # Chroot directory # # type: string chroot = "" # Set uid after binding a socket # # type: string user = "" # Set gid after binding a socket # # type: string group = "" # Quiet execution, report only error messages # # type: boolean quiet = off # Use syslog for logging # # type: boolean syslog = off # Syslog facility to use # # type: string syslog-facility = "daemon" # Run as daemon # # type: boolean daemon = off # Report client address by writing IP before sending data # # NOTE: This option is mutually exclusive with option write-proxy-v2, write-proxy and proxy-proxy. # # type: boolean write-ip = off # Report client address using SENDPROXY protocol, see # http://haproxy.1wt.eu/download/1.5/doc/proxy-protocol.txt # for details. # # NOTE: This option is mutually exclusive with option write-proxy-v2, write-ip and proxy-proxy. # # type: boolean write-proxy-v1 = off # Report client address using SENDPROXY v2 binary protocol, see # http://haproxy.1wt.eu/download/1.5/doc/proxy-protocol.txt # for details. # # NOTE: This option is mutually exclusive with option write-ip, write-proxy-v1 and proxy-proxy. # # type: boolean write-proxy-v2 = off # Proxy an existing SENDPROXY protocol header through this request. # # NOTE: This option is mutually exclusive with option write-proxy-v2, write-ip and write-proxy-v1. # # type: boolean proxy-proxy = off # Abort handshake when the client submits an unrecognized SNI server name. # # type: boolean sni-nomatch-abort = off # EOF hitch-1.1.1/install-sh0000755000175000017500000003546312563613157011562 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2014-09-12.12; # 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. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # 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_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 is_target_a_directory=possibly 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 *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi 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 if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi 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 "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else dstdir=`dirname "$dst"` 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. ;; *) # $RANDOM is not portable (e.g. dash); use it when possible to # lower collision chance tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 # As "mkdir -p" follows symlinks and we work in /tmp possibly; so # create the $tmpdir first (and fail if unsuccessful) to make sure # that nobody tries to guess the $tmpdir name. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/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. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 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 oIFS=$IFS IFS=/ set -f set fnord $dstdir shift 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` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && 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: hitch-1.1.1/Makefile.am0000644000175000017500000000035512650426240011572 00000000000000 SUBDIRS = src hitch.8: hitch.man.rst ${RST2MAN} --halt=2 $(srcdir)/hitch.man.rst $@ doc_DATA = hitch.conf.ex CHANGES.rst README.md dist_man_MANS = hitch.8 EXTRA_DIST = LICENSE README.md hitch.man.rst hitch.conf.ex CHANGES.rst docs hitch-1.1.1/config.h.in0000644000175000017500000000715212651666712011576 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the `accept4' function. */ #undef HAVE_ACCEPT4 /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK /* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE /* Define to 1 if you have the `inet_ntoa' function. */ #undef HAVE_INET_NTOA /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `ev' library (-lev). */ #undef HAVE_LIBEV /* Define to 1 if you have the `ssl' library (-lssl). */ #undef HAVE_LIBSSL /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #undef HAVE_MALLOC /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have a working `mmap' system call. */ #undef HAVE_MMAP /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK /* Define to 1 if you have the header file. */ #undef HAVE_VFORK_H /* Define to 1 if `fork' works. */ #undef HAVE_WORKING_FORK /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK /* 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 /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Version number of package */ #undef VERSION /* Define for Solaris 2.5.1 so the uint32_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ #undef _UINT32_T /* Define to `int' if doesn't define. */ #undef gid_t /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to the type of a signed integer type of width exactly 32 bits if such a type exists and the standard includes do not define it. */ #undef int32_t /* Define to rpl_malloc if the replacement function should be used. */ #undef malloc /* Define to `int' if does not define. */ #undef pid_t /* Define to `unsigned int' if does not define. */ #undef size_t /* Define to `int' if does not define. */ #undef ssize_t /* Define to `int' if doesn't define. */ #undef uid_t /* Define to the type of an unsigned integer type of width exactly 32 bits if such a type exists and the standard includes do not define it. */ #undef uint32_t /* Define as `fork' if `vfork' does not work. */ #undef vfork hitch-1.1.1/src/0000755000175000017500000000000012651710537010410 500000000000000hitch-1.1.1/src/uthash.h0000644000175000017500000017116312564576031012010 00000000000000/* Copyright (c) 2003-2014, Troy D. Hanson http://troydhanson.github.com/uthash/ All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef UTHASH_H #define UTHASH_H #include /* memcmp,strlen */ #include /* ptrdiff_t */ #include /* exit() */ /* These macros use decltype or the earlier __typeof GNU extension. As decltype is only available in newer compilers (VS2010 or gcc 4.3+ when compiling c++ source) this code uses whatever method is needed or, for VS2008 where neither is available, uses casting workarounds. */ #if defined(_MSC_VER) /* MS compiler */ #if _MSC_VER >= 1600 && defined(__cplusplus) /* VS2010 or newer in C++ mode */ #define DECLTYPE(x) (decltype(x)) #else /* VS2008 or older (or VS2010 in C mode) */ #define NO_DECLTYPE #define DECLTYPE(x) #endif #elif defined(__BORLANDC__) || defined(__LCC__) || defined(__WATCOMC__) #define NO_DECLTYPE #define DECLTYPE(x) #else /* GNU, Sun and other compilers */ #define DECLTYPE(x) (__typeof(x)) #endif #ifdef NO_DECLTYPE #define DECLTYPE_ASSIGN(dst,src) \ do { \ char **_da_dst = (char**)(&(dst)); \ *_da_dst = (char*)(src); \ } while(0) #else #define DECLTYPE_ASSIGN(dst,src) \ do { \ (dst) = DECLTYPE(dst)(src); \ } while(0) #endif /* a number of the hash function use uint32_t which isn't defined on Pre VS2010 */ #if defined (_WIN32) #if defined(_MSC_VER) && _MSC_VER >= 1600 #include #elif defined(__WATCOMC__) #include #else typedef unsigned int uint32_t; typedef unsigned char uint8_t; #endif #else #include #endif #define UTHASH_VERSION 1.9.9 #ifndef uthash_fatal #define uthash_fatal(msg) exit(-1) /* fatal error (out of memory,etc) */ #endif #ifndef uthash_malloc #define uthash_malloc(sz) malloc(sz) /* malloc fcn */ #endif #ifndef uthash_free #define uthash_free(ptr,sz) free(ptr) /* free fcn */ #endif #ifndef uthash_noexpand_fyi #define uthash_noexpand_fyi(tbl) /* can be defined to log noexpand */ #endif #ifndef uthash_expand_fyi #define uthash_expand_fyi(tbl) /* can be defined to log expands */ #endif /* initial number of buckets */ #define HASH_INITIAL_NUM_BUCKETS 32U /* initial number of buckets */ #define HASH_INITIAL_NUM_BUCKETS_LOG2 5U /* lg2 of initial number of buckets */ #define HASH_BKT_CAPACITY_THRESH 10U /* expand when bucket count reaches */ /* calculate the element whose hash handle address is hhe */ #define ELMT_FROM_HH(tbl,hhp) ((void*)(((char*)(hhp)) - ((tbl)->hho))) #define HASH_FIND(hh,head,keyptr,keylen,out) \ do { \ out=NULL; \ if (head != NULL) { \ unsigned _hf_bkt,_hf_hashv; \ HASH_FCN(keyptr,keylen, (head)->hh.tbl->num_buckets, _hf_hashv, _hf_bkt); \ if (HASH_BLOOM_TEST((head)->hh.tbl, _hf_hashv) != 0) { \ HASH_FIND_IN_BKT((head)->hh.tbl, hh, (head)->hh.tbl->buckets[ _hf_bkt ], \ keyptr,keylen,out); \ } \ } \ } while (0) #ifdef HASH_BLOOM #define HASH_BLOOM_BITLEN (1UL << HASH_BLOOM) #define HASH_BLOOM_BYTELEN (HASH_BLOOM_BITLEN/8UL) + (((HASH_BLOOM_BITLEN%8UL)!=0UL) ? 1UL : 0UL) #define HASH_BLOOM_MAKE(tbl) \ do { \ (tbl)->bloom_nbits = HASH_BLOOM; \ (tbl)->bloom_bv = (uint8_t*)uthash_malloc(HASH_BLOOM_BYTELEN); \ if (!((tbl)->bloom_bv)) { uthash_fatal( "out of memory"); } \ memset((tbl)->bloom_bv, 0, HASH_BLOOM_BYTELEN); \ (tbl)->bloom_sig = HASH_BLOOM_SIGNATURE; \ } while (0) #define HASH_BLOOM_FREE(tbl) \ do { \ uthash_free((tbl)->bloom_bv, HASH_BLOOM_BYTELEN); \ } while (0) #define HASH_BLOOM_BITSET(bv,idx) (bv[(idx)/8U] |= (1U << ((idx)%8U))) #define HASH_BLOOM_BITTEST(bv,idx) (bv[(idx)/8U] & (1U << ((idx)%8U))) #define HASH_BLOOM_ADD(tbl,hashv) \ HASH_BLOOM_BITSET((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) - 1U))) #define HASH_BLOOM_TEST(tbl,hashv) \ HASH_BLOOM_BITTEST((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) - 1U))) #else #define HASH_BLOOM_MAKE(tbl) #define HASH_BLOOM_FREE(tbl) #define HASH_BLOOM_ADD(tbl,hashv) #define HASH_BLOOM_TEST(tbl,hashv) (1) #define HASH_BLOOM_BYTELEN 0U #endif #define HASH_MAKE_TABLE(hh,head) \ do { \ (head)->hh.tbl = (UT_hash_table*)uthash_malloc( \ sizeof(UT_hash_table)); \ if (!((head)->hh.tbl)) { uthash_fatal( "out of memory"); } \ memset((head)->hh.tbl, 0, sizeof(UT_hash_table)); \ (head)->hh.tbl->tail = &((head)->hh); \ (head)->hh.tbl->num_buckets = HASH_INITIAL_NUM_BUCKETS; \ (head)->hh.tbl->log2_num_buckets = HASH_INITIAL_NUM_BUCKETS_LOG2; \ (head)->hh.tbl->hho = (char*)(&(head)->hh) - (char*)(head); \ (head)->hh.tbl->buckets = (UT_hash_bucket*)uthash_malloc( \ HASH_INITIAL_NUM_BUCKETS*sizeof(struct UT_hash_bucket)); \ if (! (head)->hh.tbl->buckets) { uthash_fatal( "out of memory"); } \ memset((head)->hh.tbl->buckets, 0, \ HASH_INITIAL_NUM_BUCKETS*sizeof(struct UT_hash_bucket)); \ HASH_BLOOM_MAKE((head)->hh.tbl); \ (head)->hh.tbl->signature = HASH_SIGNATURE; \ } while(0) #define HASH_ADD(hh,head,fieldname,keylen_in,add) \ HASH_ADD_KEYPTR(hh,head,&((add)->fieldname),keylen_in,add) #define HASH_REPLACE(hh,head,fieldname,keylen_in,add,replaced) \ do { \ replaced=NULL; \ HASH_FIND(hh,head,&((add)->fieldname),keylen_in,replaced); \ if (replaced!=NULL) { \ HASH_DELETE(hh,head,replaced); \ } \ HASH_ADD(hh,head,fieldname,keylen_in,add); \ } while(0) #define HASH_ADD_KEYPTR(hh,head,keyptr,keylen_in,add) \ do { \ unsigned _ha_bkt; \ (add)->hh.next = NULL; \ (add)->hh.key = (char*)(keyptr); \ (add)->hh.keylen = (unsigned)(keylen_in); \ if (!(head)) { \ head = (add); \ (head)->hh.prev = NULL; \ HASH_MAKE_TABLE(hh,head); \ } else { \ (head)->hh.tbl->tail->next = (add); \ (add)->hh.prev = ELMT_FROM_HH((head)->hh.tbl, (head)->hh.tbl->tail); \ (head)->hh.tbl->tail = &((add)->hh); \ } \ (head)->hh.tbl->num_items++; \ (add)->hh.tbl = (head)->hh.tbl; \ HASH_FCN(keyptr,keylen_in, (head)->hh.tbl->num_buckets, \ (add)->hh.hashv, _ha_bkt); \ HASH_ADD_TO_BKT((head)->hh.tbl->buckets[_ha_bkt],&(add)->hh); \ HASH_BLOOM_ADD((head)->hh.tbl,(add)->hh.hashv); \ HASH_EMIT_KEY(hh,head,keyptr,keylen_in); \ HASH_FSCK(hh,head); \ } while(0) #define HASH_TO_BKT( hashv, num_bkts, bkt ) \ do { \ bkt = ((hashv) & ((num_bkts) - 1U)); \ } while(0) /* delete "delptr" from the hash table. * "the usual" patch-up process for the app-order doubly-linked-list. * The use of _hd_hh_del below deserves special explanation. * These used to be expressed using (delptr) but that led to a bug * if someone used the same symbol for the head and deletee, like * HASH_DELETE(hh,users,users); * We want that to work, but by changing the head (users) below * we were forfeiting our ability to further refer to the deletee (users) * in the patch-up process. Solution: use scratch space to * copy the deletee pointer, then the latter references are via that * scratch pointer rather than through the repointed (users) symbol. */ #define HASH_DELETE(hh,head,delptr) \ do { \ struct UT_hash_handle *_hd_hh_del; \ if ( ((delptr)->hh.prev == NULL) && ((delptr)->hh.next == NULL) ) { \ uthash_free((head)->hh.tbl->buckets, \ (head)->hh.tbl->num_buckets*sizeof(struct UT_hash_bucket) ); \ HASH_BLOOM_FREE((head)->hh.tbl); \ uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ head = NULL; \ } else { \ unsigned _hd_bkt; \ _hd_hh_del = &((delptr)->hh); \ if ((delptr) == ELMT_FROM_HH((head)->hh.tbl,(head)->hh.tbl->tail)) { \ (head)->hh.tbl->tail = \ (UT_hash_handle*)((ptrdiff_t)((delptr)->hh.prev) + \ (head)->hh.tbl->hho); \ } \ if ((delptr)->hh.prev != NULL) { \ ((UT_hash_handle*)((ptrdiff_t)((delptr)->hh.prev) + \ (head)->hh.tbl->hho))->next = (delptr)->hh.next; \ } else { \ DECLTYPE_ASSIGN(head,(delptr)->hh.next); \ } \ if (_hd_hh_del->next != NULL) { \ ((UT_hash_handle*)((ptrdiff_t)_hd_hh_del->next + \ (head)->hh.tbl->hho))->prev = \ _hd_hh_del->prev; \ } \ HASH_TO_BKT( _hd_hh_del->hashv, (head)->hh.tbl->num_buckets, _hd_bkt); \ HASH_DEL_IN_BKT(hh,(head)->hh.tbl->buckets[_hd_bkt], _hd_hh_del); \ (head)->hh.tbl->num_items--; \ } \ HASH_FSCK(hh,head); \ } while (0) /* convenience forms of HASH_FIND/HASH_ADD/HASH_DEL */ #define HASH_FIND_STR(head,findstr,out) \ HASH_FIND(hh,head,findstr,(unsigned)strlen(findstr),out) #define HASH_ADD_STR(head,strfield,add) \ HASH_ADD(hh,head,strfield[0],(unsigned int)strlen(add->strfield),add) #define HASH_REPLACE_STR(head,strfield,add,replaced) \ HASH_REPLACE(hh,head,strfield[0],(unsigned)strlen(add->strfield),add,replaced) #define HASH_FIND_INT(head,findint,out) \ HASH_FIND(hh,head,findint,sizeof(int),out) #define HASH_ADD_INT(head,intfield,add) \ HASH_ADD(hh,head,intfield,sizeof(int),add) #define HASH_REPLACE_INT(head,intfield,add,replaced) \ HASH_REPLACE(hh,head,intfield,sizeof(int),add,replaced) #define HASH_FIND_PTR(head,findptr,out) \ HASH_FIND(hh,head,findptr,sizeof(void *),out) #define HASH_ADD_PTR(head,ptrfield,add) \ HASH_ADD(hh,head,ptrfield,sizeof(void *),add) #define HASH_REPLACE_PTR(head,ptrfield,add,replaced) \ HASH_REPLACE(hh,head,ptrfield,sizeof(void *),add,replaced) #define HASH_DEL(head,delptr) \ HASH_DELETE(hh,head,delptr) /* HASH_FSCK checks hash integrity on every add/delete when HASH_DEBUG is defined. * This is for uthash developer only; it compiles away if HASH_DEBUG isn't defined. */ #ifdef HASH_DEBUG #define HASH_OOPS(...) do { fprintf(stderr,__VA_ARGS__); exit(-1); } while (0) #define HASH_FSCK(hh,head) \ do { \ struct UT_hash_handle *_thh; \ if (head) { \ unsigned _bkt_i; \ unsigned _count; \ char *_prev; \ _count = 0; \ for( _bkt_i = 0; _bkt_i < (head)->hh.tbl->num_buckets; _bkt_i++) { \ unsigned _bkt_count = 0; \ _thh = (head)->hh.tbl->buckets[_bkt_i].hh_head; \ _prev = NULL; \ while (_thh) { \ if (_prev != (char*)(_thh->hh_prev)) { \ HASH_OOPS("invalid hh_prev %p, actual %p\n", \ _thh->hh_prev, _prev ); \ } \ _bkt_count++; \ _prev = (char*)(_thh); \ _thh = _thh->hh_next; \ } \ _count += _bkt_count; \ if ((head)->hh.tbl->buckets[_bkt_i].count != _bkt_count) { \ HASH_OOPS("invalid bucket count %u, actual %u\n", \ (head)->hh.tbl->buckets[_bkt_i].count, _bkt_count); \ } \ } \ if (_count != (head)->hh.tbl->num_items) { \ HASH_OOPS("invalid hh item count %u, actual %u\n", \ (head)->hh.tbl->num_items, _count ); \ } \ /* traverse hh in app order; check next/prev integrity, count */ \ _count = 0; \ _prev = NULL; \ _thh = &(head)->hh; \ while (_thh) { \ _count++; \ if (_prev !=(char*)(_thh->prev)) { \ HASH_OOPS("invalid prev %p, actual %p\n", \ _thh->prev, _prev ); \ } \ _prev = (char*)ELMT_FROM_HH((head)->hh.tbl, _thh); \ _thh = ( _thh->next ? (UT_hash_handle*)((char*)(_thh->next) + \ (head)->hh.tbl->hho) : NULL ); \ } \ if (_count != (head)->hh.tbl->num_items) { \ HASH_OOPS("invalid app item count %u, actual %u\n", \ (head)->hh.tbl->num_items, _count ); \ } \ } \ } while (0) #else #define HASH_FSCK(hh,head) #endif /* When compiled with -DHASH_EMIT_KEYS, length-prefixed keys are emitted to * the descriptor to which this macro is defined for tuning the hash function. * The app can #include to get the prototype for write(2). */ #ifdef HASH_EMIT_KEYS #define HASH_EMIT_KEY(hh,head,keyptr,fieldlen) \ do { \ unsigned _klen = fieldlen; \ write(HASH_EMIT_KEYS, &_klen, sizeof(_klen)); \ write(HASH_EMIT_KEYS, keyptr, (unsigned long)fieldlen); \ } while (0) #else #define HASH_EMIT_KEY(hh,head,keyptr,fieldlen) #endif /* default to Jenkin's hash unless overridden e.g. DHASH_FUNCTION=HASH_SAX */ #ifdef HASH_FUNCTION #define HASH_FCN HASH_FUNCTION #else #define HASH_FCN HASH_JEN #endif /* The Bernstein hash function, used in Perl prior to v5.6. Note (x<<5+x)=x*33. */ #define HASH_BER(key,keylen,num_bkts,hashv,bkt) \ do { \ unsigned _hb_keylen=(unsigned)keylen; \ const unsigned char *_hb_key=(const unsigned char*)(key); \ (hashv) = 0; \ while (_hb_keylen-- != 0U) { \ (hashv) = (((hashv) << 5) + (hashv)) + *_hb_key++; \ } \ bkt = (hashv) & (num_bkts-1U); \ } while (0) /* SAX/FNV/OAT/JEN hash functions are macro variants of those listed at * http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx */ #define HASH_SAX(key,keylen,num_bkts,hashv,bkt) \ do { \ unsigned _sx_i; \ const unsigned char *_hs_key=(const unsigned char*)(key); \ hashv = 0; \ for(_sx_i=0; _sx_i < keylen; _sx_i++) { \ hashv ^= (hashv << 5) + (hashv >> 2) + _hs_key[_sx_i]; \ } \ bkt = hashv & (num_bkts-1U); \ } while (0) /* FNV-1a variation */ #define HASH_FNV(key,keylen,num_bkts,hashv,bkt) \ do { \ unsigned _fn_i; \ const unsigned char *_hf_key=(const unsigned char*)(key); \ hashv = 2166136261U; \ for(_fn_i=0; _fn_i < keylen; _fn_i++) { \ hashv = hashv ^ _hf_key[_fn_i]; \ hashv = hashv * 16777619U; \ } \ bkt = hashv & (num_bkts-1U); \ } while(0) #define HASH_OAT(key,keylen,num_bkts,hashv,bkt) \ do { \ unsigned _ho_i; \ const unsigned char *_ho_key=(const unsigned char*)(key); \ hashv = 0; \ for(_ho_i=0; _ho_i < keylen; _ho_i++) { \ hashv += _ho_key[_ho_i]; \ hashv += (hashv << 10); \ hashv ^= (hashv >> 6); \ } \ hashv += (hashv << 3); \ hashv ^= (hashv >> 11); \ hashv += (hashv << 15); \ bkt = hashv & (num_bkts-1U); \ } while(0) #define HASH_JEN_MIX(a,b,c) \ do { \ a -= b; a -= c; a ^= ( c >> 13 ); \ b -= c; b -= a; b ^= ( a << 8 ); \ c -= a; c -= b; c ^= ( b >> 13 ); \ a -= b; a -= c; a ^= ( c >> 12 ); \ b -= c; b -= a; b ^= ( a << 16 ); \ c -= a; c -= b; c ^= ( b >> 5 ); \ a -= b; a -= c; a ^= ( c >> 3 ); \ b -= c; b -= a; b ^= ( a << 10 ); \ c -= a; c -= b; c ^= ( b >> 15 ); \ } while (0) #define HASH_JEN(key,keylen,num_bkts,hashv,bkt) \ do { \ unsigned _hj_i,_hj_j,_hj_k; \ unsigned const char *_hj_key=(unsigned const char*)(key); \ hashv = 0xfeedbeefu; \ _hj_i = _hj_j = 0x9e3779b9u; \ _hj_k = (unsigned)(keylen); \ while (_hj_k >= 12U) { \ _hj_i += (_hj_key[0] + ( (unsigned)_hj_key[1] << 8 ) \ + ( (unsigned)_hj_key[2] << 16 ) \ + ( (unsigned)_hj_key[3] << 24 ) ); \ _hj_j += (_hj_key[4] + ( (unsigned)_hj_key[5] << 8 ) \ + ( (unsigned)_hj_key[6] << 16 ) \ + ( (unsigned)_hj_key[7] << 24 ) ); \ hashv += (_hj_key[8] + ( (unsigned)_hj_key[9] << 8 ) \ + ( (unsigned)_hj_key[10] << 16 ) \ + ( (unsigned)_hj_key[11] << 24 ) ); \ \ HASH_JEN_MIX(_hj_i, _hj_j, hashv); \ \ _hj_key += 12; \ _hj_k -= 12U; \ } \ hashv += (unsigned)(keylen); \ switch ( _hj_k ) { \ case 11: hashv += ( (unsigned)_hj_key[10] << 24 ); /* FALLTHROUGH */ \ case 10: hashv += ( (unsigned)_hj_key[9] << 16 ); /* FALLTHROUGH */ \ case 9: hashv += ( (unsigned)_hj_key[8] << 8 ); /* FALLTHROUGH */ \ case 8: _hj_j += ( (unsigned)_hj_key[7] << 24 ); /* FALLTHROUGH */ \ case 7: _hj_j += ( (unsigned)_hj_key[6] << 16 ); /* FALLTHROUGH */ \ case 6: _hj_j += ( (unsigned)_hj_key[5] << 8 ); /* FALLTHROUGH */ \ case 5: _hj_j += _hj_key[4]; /* FALLTHROUGH */ \ case 4: _hj_i += ( (unsigned)_hj_key[3] << 24 ); /* FALLTHROUGH */ \ case 3: _hj_i += ( (unsigned)_hj_key[2] << 16 ); /* FALLTHROUGH */ \ case 2: _hj_i += ( (unsigned)_hj_key[1] << 8 ); /* FALLTHROUGH */ \ case 1: _hj_i += _hj_key[0]; \ } \ HASH_JEN_MIX(_hj_i, _hj_j, hashv); \ bkt = hashv & (num_bkts-1U); \ } while(0) /* The Paul Hsieh hash function */ #undef get16bits #if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \ || defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__) #define get16bits(d) (*((const uint16_t *) (d))) #endif #if !defined (get16bits) #define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8) \ +(uint32_t)(((const uint8_t *)(d))[0]) ) #endif #define HASH_SFH(key,keylen,num_bkts,hashv,bkt) \ do { \ unsigned const char *_sfh_key=(unsigned const char*)(key); \ uint32_t _sfh_tmp, _sfh_len = (uint32_t)keylen; \ \ unsigned _sfh_rem = _sfh_len & 3U; \ _sfh_len >>= 2; \ hashv = 0xcafebabeu; \ \ /* Main loop */ \ for (;_sfh_len > 0U; _sfh_len--) { \ hashv += get16bits (_sfh_key); \ _sfh_tmp = ((uint32_t)(get16bits (_sfh_key+2)) << 11) ^ hashv; \ hashv = (hashv << 16) ^ _sfh_tmp; \ _sfh_key += 2U*sizeof (uint16_t); \ hashv += hashv >> 11; \ } \ \ /* Handle end cases */ \ switch (_sfh_rem) { \ case 3: hashv += get16bits (_sfh_key); \ hashv ^= hashv << 16; \ hashv ^= (uint32_t)(_sfh_key[sizeof (uint16_t)]) << 18; \ hashv += hashv >> 11; \ break; \ case 2: hashv += get16bits (_sfh_key); \ hashv ^= hashv << 11; \ hashv += hashv >> 17; \ break; \ case 1: hashv += *_sfh_key; \ hashv ^= hashv << 10; \ hashv += hashv >> 1; \ } \ \ /* Force "avalanching" of final 127 bits */ \ hashv ^= hashv << 3; \ hashv += hashv >> 5; \ hashv ^= hashv << 4; \ hashv += hashv >> 17; \ hashv ^= hashv << 25; \ hashv += hashv >> 6; \ bkt = hashv & (num_bkts-1U); \ } while(0) #ifdef HASH_USING_NO_STRICT_ALIASING /* The MurmurHash exploits some CPU's (x86,x86_64) tolerance for unaligned reads. * For other types of CPU's (e.g. Sparc) an unaligned read causes a bus error. * MurmurHash uses the faster approach only on CPU's where we know it's safe. * * Note the preprocessor built-in defines can be emitted using: * * gcc -m64 -dM -E - < /dev/null (on gcc) * cc -## a.c (where a.c is a simple test file) (Sun Studio) */ #if (defined(__i386__) || defined(__x86_64__) || defined(_M_IX86)) #define MUR_GETBLOCK(p,i) p[i] #else /* non intel */ #define MUR_PLUS0_ALIGNED(p) (((unsigned long)p & 3UL) == 0UL) #define MUR_PLUS1_ALIGNED(p) (((unsigned long)p & 3UL) == 1UL) #define MUR_PLUS2_ALIGNED(p) (((unsigned long)p & 3UL) == 2UL) #define MUR_PLUS3_ALIGNED(p) (((unsigned long)p & 3UL) == 3UL) #define WP(p) ((uint32_t*)((unsigned long)(p) & ~3UL)) #if (defined(__BIG_ENDIAN__) || defined(SPARC) || defined(__ppc__) || defined(__ppc64__)) #define MUR_THREE_ONE(p) ((((*WP(p))&0x00ffffff) << 8) | (((*(WP(p)+1))&0xff000000) >> 24)) #define MUR_TWO_TWO(p) ((((*WP(p))&0x0000ffff) <<16) | (((*(WP(p)+1))&0xffff0000) >> 16)) #define MUR_ONE_THREE(p) ((((*WP(p))&0x000000ff) <<24) | (((*(WP(p)+1))&0xffffff00) >> 8)) #else /* assume little endian non-intel */ #define MUR_THREE_ONE(p) ((((*WP(p))&0xffffff00) >> 8) | (((*(WP(p)+1))&0x000000ff) << 24)) #define MUR_TWO_TWO(p) ((((*WP(p))&0xffff0000) >>16) | (((*(WP(p)+1))&0x0000ffff) << 16)) #define MUR_ONE_THREE(p) ((((*WP(p))&0xff000000) >>24) | (((*(WP(p)+1))&0x00ffffff) << 8)) #endif #define MUR_GETBLOCK(p,i) (MUR_PLUS0_ALIGNED(p) ? ((p)[i]) : \ (MUR_PLUS1_ALIGNED(p) ? MUR_THREE_ONE(p) : \ (MUR_PLUS2_ALIGNED(p) ? MUR_TWO_TWO(p) : \ MUR_ONE_THREE(p)))) #endif #define MUR_ROTL32(x,r) (((x) << (r)) | ((x) >> (32 - (r)))) #define MUR_FMIX(_h) \ do { \ _h ^= _h >> 16; \ _h *= 0x85ebca6bu; \ _h ^= _h >> 13; \ _h *= 0xc2b2ae35u; \ _h ^= _h >> 16; \ } while(0) #define HASH_MUR(key,keylen,num_bkts,hashv,bkt) \ do { \ const uint8_t *_mur_data = (const uint8_t*)(key); \ const int _mur_nblocks = (int)(keylen) / 4; \ uint32_t _mur_h1 = 0xf88D5353u; \ uint32_t _mur_c1 = 0xcc9e2d51u; \ uint32_t _mur_c2 = 0x1b873593u; \ uint32_t _mur_k1 = 0; \ const uint8_t *_mur_tail; \ const uint32_t *_mur_blocks = (const uint32_t*)(_mur_data+(_mur_nblocks*4)); \ int _mur_i; \ for(_mur_i = -_mur_nblocks; _mur_i!=0; _mur_i++) { \ _mur_k1 = MUR_GETBLOCK(_mur_blocks,_mur_i); \ _mur_k1 *= _mur_c1; \ _mur_k1 = MUR_ROTL32(_mur_k1,15); \ _mur_k1 *= _mur_c2; \ \ _mur_h1 ^= _mur_k1; \ _mur_h1 = MUR_ROTL32(_mur_h1,13); \ _mur_h1 = (_mur_h1*5U) + 0xe6546b64u; \ } \ _mur_tail = (const uint8_t*)(_mur_data + (_mur_nblocks*4)); \ _mur_k1=0; \ switch((keylen) & 3U) { \ case 3: _mur_k1 ^= (uint32_t)_mur_tail[2] << 16; /* FALLTHROUGH */ \ case 2: _mur_k1 ^= (uint32_t)_mur_tail[1] << 8; /* FALLTHROUGH */ \ case 1: _mur_k1 ^= (uint32_t)_mur_tail[0]; \ _mur_k1 *= _mur_c1; \ _mur_k1 = MUR_ROTL32(_mur_k1,15); \ _mur_k1 *= _mur_c2; \ _mur_h1 ^= _mur_k1; \ } \ _mur_h1 ^= (uint32_t)(keylen); \ MUR_FMIX(_mur_h1); \ hashv = _mur_h1; \ bkt = hashv & (num_bkts-1U); \ } while(0) #endif /* HASH_USING_NO_STRICT_ALIASING */ /* key comparison function; return 0 if keys equal */ #define HASH_KEYCMP(a,b,len) memcmp(a,b,(unsigned long)(len)) /* iterate over items in a known bucket to find desired item */ #define HASH_FIND_IN_BKT(tbl,hh,head,keyptr,keylen_in,out) \ do { \ if (head.hh_head != NULL) { DECLTYPE_ASSIGN(out,ELMT_FROM_HH(tbl,head.hh_head)); } \ else { out=NULL; } \ while (out != NULL) { \ if ((out)->hh.keylen == (keylen_in)) { \ if ((HASH_KEYCMP((out)->hh.key,keyptr,keylen_in)) == 0) { break; } \ } \ if ((out)->hh.hh_next != NULL) { DECLTYPE_ASSIGN(out,ELMT_FROM_HH(tbl,(out)->hh.hh_next)); } \ else { out = NULL; } \ } \ } while(0) /* add an item to a bucket */ #define HASH_ADD_TO_BKT(head,addhh) \ do { \ head.count++; \ (addhh)->hh_next = head.hh_head; \ (addhh)->hh_prev = NULL; \ if (head.hh_head != NULL) { (head).hh_head->hh_prev = (addhh); } \ (head).hh_head=addhh; \ if ((head.count >= ((head.expand_mult+1U) * HASH_BKT_CAPACITY_THRESH)) \ && ((addhh)->tbl->noexpand != 1U)) { \ HASH_EXPAND_BUCKETS((addhh)->tbl); \ } \ } while(0) /* remove an item from a given bucket */ #define HASH_DEL_IN_BKT(hh,head,hh_del) \ (head).count--; \ if ((head).hh_head == hh_del) { \ (head).hh_head = hh_del->hh_next; \ } \ if (hh_del->hh_prev) { \ hh_del->hh_prev->hh_next = hh_del->hh_next; \ } \ if (hh_del->hh_next) { \ hh_del->hh_next->hh_prev = hh_del->hh_prev; \ } /* Bucket expansion has the effect of doubling the number of buckets * and redistributing the items into the new buckets. Ideally the * items will distribute more or less evenly into the new buckets * (the extent to which this is true is a measure of the quality of * the hash function as it applies to the key domain). * * With the items distributed into more buckets, the chain length * (item count) in each bucket is reduced. Thus by expanding buckets * the hash keeps a bound on the chain length. This bounded chain * length is the essence of how a hash provides constant time lookup. * * The calculation of tbl->ideal_chain_maxlen below deserves some * explanation. First, keep in mind that we're calculating the ideal * maximum chain length based on the *new* (doubled) bucket count. * In fractions this is just n/b (n=number of items,b=new num buckets). * Since the ideal chain length is an integer, we want to calculate * ceil(n/b). We don't depend on floating point arithmetic in this * hash, so to calculate ceil(n/b) with integers we could write * * ceil(n/b) = (n/b) + ((n%b)?1:0) * * and in fact a previous version of this hash did just that. * But now we have improved things a bit by recognizing that b is * always a power of two. We keep its base 2 log handy (call it lb), * so now we can write this with a bit shift and logical AND: * * ceil(n/b) = (n>>lb) + ( (n & (b-1)) ? 1:0) * */ #define HASH_EXPAND_BUCKETS(tbl) \ do { \ unsigned _he_bkt; \ unsigned _he_bkt_i; \ struct UT_hash_handle *_he_thh, *_he_hh_nxt; \ UT_hash_bucket *_he_new_buckets, *_he_newbkt; \ _he_new_buckets = (UT_hash_bucket*)uthash_malloc( \ 2UL * tbl->num_buckets * sizeof(struct UT_hash_bucket)); \ if (!_he_new_buckets) { uthash_fatal( "out of memory"); } \ memset(_he_new_buckets, 0, \ 2UL * tbl->num_buckets * sizeof(struct UT_hash_bucket)); \ tbl->ideal_chain_maxlen = \ (tbl->num_items >> (tbl->log2_num_buckets+1U)) + \ (((tbl->num_items & ((tbl->num_buckets*2U)-1U)) != 0U) ? 1U : 0U); \ tbl->nonideal_items = 0; \ for(_he_bkt_i = 0; _he_bkt_i < tbl->num_buckets; _he_bkt_i++) \ { \ _he_thh = tbl->buckets[ _he_bkt_i ].hh_head; \ while (_he_thh != NULL) { \ _he_hh_nxt = _he_thh->hh_next; \ HASH_TO_BKT( _he_thh->hashv, tbl->num_buckets*2U, _he_bkt); \ _he_newbkt = &(_he_new_buckets[ _he_bkt ]); \ if (++(_he_newbkt->count) > tbl->ideal_chain_maxlen) { \ tbl->nonideal_items++; \ _he_newbkt->expand_mult = _he_newbkt->count / \ tbl->ideal_chain_maxlen; \ } \ _he_thh->hh_prev = NULL; \ _he_thh->hh_next = _he_newbkt->hh_head; \ if (_he_newbkt->hh_head != NULL) { _he_newbkt->hh_head->hh_prev = \ _he_thh; } \ _he_newbkt->hh_head = _he_thh; \ _he_thh = _he_hh_nxt; \ } \ } \ uthash_free( tbl->buckets, tbl->num_buckets*sizeof(struct UT_hash_bucket) ); \ tbl->num_buckets *= 2U; \ tbl->log2_num_buckets++; \ tbl->buckets = _he_new_buckets; \ tbl->ineff_expands = (tbl->nonideal_items > (tbl->num_items >> 1)) ? \ (tbl->ineff_expands+1U) : 0U; \ if (tbl->ineff_expands > 1U) { \ tbl->noexpand=1; \ uthash_noexpand_fyi(tbl); \ } \ uthash_expand_fyi(tbl); \ } while(0) /* This is an adaptation of Simon Tatham's O(n log(n)) mergesort */ /* Note that HASH_SORT assumes the hash handle name to be hh. * HASH_SRT was added to allow the hash handle name to be passed in. */ #define HASH_SORT(head,cmpfcn) HASH_SRT(hh,head,cmpfcn) #define HASH_SRT(hh,head,cmpfcn) \ do { \ unsigned _hs_i; \ unsigned _hs_looping,_hs_nmerges,_hs_insize,_hs_psize,_hs_qsize; \ struct UT_hash_handle *_hs_p, *_hs_q, *_hs_e, *_hs_list, *_hs_tail; \ if (head != NULL) { \ _hs_insize = 1; \ _hs_looping = 1; \ _hs_list = &((head)->hh); \ while (_hs_looping != 0U) { \ _hs_p = _hs_list; \ _hs_list = NULL; \ _hs_tail = NULL; \ _hs_nmerges = 0; \ while (_hs_p != NULL) { \ _hs_nmerges++; \ _hs_q = _hs_p; \ _hs_psize = 0; \ for ( _hs_i = 0; _hs_i < _hs_insize; _hs_i++ ) { \ _hs_psize++; \ _hs_q = (UT_hash_handle*)((_hs_q->next != NULL) ? \ ((void*)((char*)(_hs_q->next) + \ (head)->hh.tbl->hho)) : NULL); \ if (! (_hs_q) ) { break; } \ } \ _hs_qsize = _hs_insize; \ while ((_hs_psize > 0U) || ((_hs_qsize > 0U) && (_hs_q != NULL))) {\ if (_hs_psize == 0U) { \ _hs_e = _hs_q; \ _hs_q = (UT_hash_handle*)((_hs_q->next != NULL) ? \ ((void*)((char*)(_hs_q->next) + \ (head)->hh.tbl->hho)) : NULL); \ _hs_qsize--; \ } else if ( (_hs_qsize == 0U) || (_hs_q == NULL) ) { \ _hs_e = _hs_p; \ if (_hs_p != NULL){ \ _hs_p = (UT_hash_handle*)((_hs_p->next != NULL) ? \ ((void*)((char*)(_hs_p->next) + \ (head)->hh.tbl->hho)) : NULL); \ } \ _hs_psize--; \ } else if (( \ cmpfcn(DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl,_hs_p)), \ DECLTYPE(head)(ELMT_FROM_HH((head)->hh.tbl,_hs_q))) \ ) <= 0) { \ _hs_e = _hs_p; \ if (_hs_p != NULL){ \ _hs_p = (UT_hash_handle*)((_hs_p->next != NULL) ? \ ((void*)((char*)(_hs_p->next) + \ (head)->hh.tbl->hho)) : NULL); \ } \ _hs_psize--; \ } else { \ _hs_e = _hs_q; \ _hs_q = (UT_hash_handle*)((_hs_q->next != NULL) ? \ ((void*)((char*)(_hs_q->next) + \ (head)->hh.tbl->hho)) : NULL); \ _hs_qsize--; \ } \ if ( _hs_tail != NULL ) { \ _hs_tail->next = ((_hs_e != NULL) ? \ ELMT_FROM_HH((head)->hh.tbl,_hs_e) : NULL); \ } else { \ _hs_list = _hs_e; \ } \ if (_hs_e != NULL) { \ _hs_e->prev = ((_hs_tail != NULL) ? \ ELMT_FROM_HH((head)->hh.tbl,_hs_tail) : NULL); \ } \ _hs_tail = _hs_e; \ } \ _hs_p = _hs_q; \ } \ if (_hs_tail != NULL){ \ _hs_tail->next = NULL; \ } \ if ( _hs_nmerges <= 1U ) { \ _hs_looping=0; \ (head)->hh.tbl->tail = _hs_tail; \ DECLTYPE_ASSIGN(head,ELMT_FROM_HH((head)->hh.tbl, _hs_list)); \ } \ _hs_insize *= 2U; \ } \ HASH_FSCK(hh,head); \ } \ } while (0) /* This function selects items from one hash into another hash. * The end result is that the selected items have dual presence * in both hashes. There is no copy of the items made; rather * they are added into the new hash through a secondary hash * hash handle that must be present in the structure. */ #define HASH_SELECT(hh_dst, dst, hh_src, src, cond) \ do { \ unsigned _src_bkt, _dst_bkt; \ void *_last_elt=NULL, *_elt; \ UT_hash_handle *_src_hh, *_dst_hh, *_last_elt_hh=NULL; \ ptrdiff_t _dst_hho = ((char*)(&(dst)->hh_dst) - (char*)(dst)); \ if (src != NULL) { \ for(_src_bkt=0; _src_bkt < (src)->hh_src.tbl->num_buckets; _src_bkt++) { \ for(_src_hh = (src)->hh_src.tbl->buckets[_src_bkt].hh_head; \ _src_hh != NULL; \ _src_hh = _src_hh->hh_next) { \ _elt = ELMT_FROM_HH((src)->hh_src.tbl, _src_hh); \ if (cond(_elt)) { \ _dst_hh = (UT_hash_handle*)(((char*)_elt) + _dst_hho); \ _dst_hh->key = _src_hh->key; \ _dst_hh->keylen = _src_hh->keylen; \ _dst_hh->hashv = _src_hh->hashv; \ _dst_hh->prev = _last_elt; \ _dst_hh->next = NULL; \ if (_last_elt_hh != NULL) { _last_elt_hh->next = _elt; } \ if (dst == NULL) { \ DECLTYPE_ASSIGN(dst,_elt); \ HASH_MAKE_TABLE(hh_dst,dst); \ } else { \ _dst_hh->tbl = (dst)->hh_dst.tbl; \ } \ HASH_TO_BKT(_dst_hh->hashv, _dst_hh->tbl->num_buckets, _dst_bkt); \ HASH_ADD_TO_BKT(_dst_hh->tbl->buckets[_dst_bkt],_dst_hh); \ (dst)->hh_dst.tbl->num_items++; \ _last_elt = _elt; \ _last_elt_hh = _dst_hh; \ } \ } \ } \ } \ HASH_FSCK(hh_dst,dst); \ } while (0) #define HASH_CLEAR(hh,head) \ do { \ if (head != NULL) { \ uthash_free((head)->hh.tbl->buckets, \ (head)->hh.tbl->num_buckets*sizeof(struct UT_hash_bucket)); \ HASH_BLOOM_FREE((head)->hh.tbl); \ uthash_free((head)->hh.tbl, sizeof(UT_hash_table)); \ (head)=NULL; \ } \ } while(0) #define HASH_OVERHEAD(hh,head) \ ((head != NULL) ? ( \ (size_t)(((head)->hh.tbl->num_items * sizeof(UT_hash_handle)) + \ ((head)->hh.tbl->num_buckets * sizeof(UT_hash_bucket)) + \ sizeof(UT_hash_table) + \ (HASH_BLOOM_BYTELEN))) : 0U) #ifdef NO_DECLTYPE #define HASH_ITER(hh,head,el,tmp) \ for(((el)=(head)), ((*(char**)(&(tmp)))=(char*)((head!=NULL)?(head)->hh.next:NULL)); \ (el) != NULL; ((el)=(tmp)), ((*(char**)(&(tmp)))=(char*)((tmp!=NULL)?(tmp)->hh.next:NULL))) #else #define HASH_ITER(hh,head,el,tmp) \ for(((el)=(head)), ((tmp)=DECLTYPE(el)((head!=NULL)?(head)->hh.next:NULL)); \ (el) != NULL; ((el)=(tmp)), ((tmp)=DECLTYPE(el)((tmp!=NULL)?(tmp)->hh.next:NULL))) #endif /* obtain a count of items in the hash */ #define HASH_COUNT(head) HASH_CNT(hh,head) #define HASH_CNT(hh,head) ((head != NULL)?((head)->hh.tbl->num_items):0U) typedef struct UT_hash_bucket { struct UT_hash_handle *hh_head; unsigned count; /* expand_mult is normally set to 0. In this situation, the max chain length * threshold is enforced at its default value, HASH_BKT_CAPACITY_THRESH. (If * the bucket's chain exceeds this length, bucket expansion is triggered). * However, setting expand_mult to a non-zero value delays bucket expansion * (that would be triggered by additions to this particular bucket) * until its chain length reaches a *multiple* of HASH_BKT_CAPACITY_THRESH. * (The multiplier is simply expand_mult+1). The whole idea of this * multiplier is to reduce bucket expansions, since they are expensive, in * situations where we know that a particular bucket tends to be overused. * It is better to let its chain length grow to a longer yet-still-bounded * value, than to do an O(n) bucket expansion too often. */ unsigned expand_mult; } UT_hash_bucket; /* random signature used only to find hash tables in external analysis */ #define HASH_SIGNATURE 0xa0111fe1u #define HASH_BLOOM_SIGNATURE 0xb12220f2u typedef struct UT_hash_table { UT_hash_bucket *buckets; unsigned num_buckets, log2_num_buckets; unsigned num_items; struct UT_hash_handle *tail; /* tail hh in app order, for fast append */ ptrdiff_t hho; /* hash handle offset (byte pos of hash handle in element */ /* in an ideal situation (all buckets used equally), no bucket would have * more than ceil(#items/#buckets) items. that's the ideal chain length. */ unsigned ideal_chain_maxlen; /* nonideal_items is the number of items in the hash whose chain position * exceeds the ideal chain maxlen. these items pay the penalty for an uneven * hash distribution; reaching them in a chain traversal takes >ideal steps */ unsigned nonideal_items; /* ineffective expands occur when a bucket doubling was performed, but * afterward, more than half the items in the hash had nonideal chain * positions. If this happens on two consecutive expansions we inhibit any * further expansion, as it's not helping; this happens when the hash * function isn't a good fit for the key domain. When expansion is inhibited * the hash will still work, albeit no longer in constant time. */ unsigned ineff_expands, noexpand; uint32_t signature; /* used only to find hash tables in external analysis */ #ifdef HASH_BLOOM uint32_t bloom_sig; /* used only to test bloom exists in external analysis */ uint8_t *bloom_bv; uint8_t bloom_nbits; #endif } UT_hash_table; typedef struct UT_hash_handle { struct UT_hash_table *tbl; void *prev; /* prev element in app order */ void *next; /* next element in app order */ struct UT_hash_handle *hh_prev; /* previous hh in bucket order */ struct UT_hash_handle *hh_next; /* next hh in bucket order */ void *key; /* ptr to enclosing struct's key */ unsigned keylen; /* enclosing struct's key len */ unsigned hashv; /* result of hash-fcn(key) */ } UT_hash_handle; #endif /* UTHASH_H */ hitch-1.1.1/src/hitch.c0000644000175000017500000023661212651704660011605 00000000000000/** * Copyright 2015 Varnish Software * Copyright 2011 Bump Technologies, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY BUMP TECHNOLOGIES, INC. ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BUMP * TECHNOLOGIES, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * The views and conclusions contained in the software and * documentation are those of the authors and should not be * interpreted as representing official policies, either expressed or * implied, of Bump Technologies, Inc. * */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef __linux__ #include #endif #include "uthash.h" #include "ringbuffer.h" #include "miniobj.h" #include "shctx.h" #include "vpf.h" #include "vas.h" #include "configuration.h" #ifndef MSG_NOSIGNAL # define MSG_NOSIGNAL 0 #endif #ifndef AI_ADDRCONFIG # define AI_ADDRCONFIG 0 #endif /* For Mac OS X */ #ifndef TCP_KEEPIDLE # ifdef TCP_KEEPALIVE # define TCP_KEEPIDLE TCP_KEEPALIVE # endif #endif #ifndef SOL_TCP # define SOL_TCP IPPROTO_TCP #endif /* Do we have SNI support? */ #ifndef OPENSSL_NO_TLSEXT #ifndef SSL_CTRL_SET_TLSEXT_HOSTNAME #define OPENSSL_NO_TLSEXT #endif #endif /* Globals */ static struct ev_loop *loop; /* Child proc's read side of mgt->child pipe(2) */ static ev_io mgt_rd; static struct addrinfo *backaddr; static pid_t master_pid; static int core_id; static SSL_SESSION *client_session; /* The current number of active client connections. */ static uint64_t n_conns; /* Current generation of child processes. Bumped after a sighup prior * to launching new children. */ static unsigned child_gen; static unsigned n_sighup; static unsigned n_sigchld; enum child_state_e { CHILD_ACTIVE, CHILD_EXITING }; static enum child_state_e child_state; struct child_proc { unsigned magic; #define CHILD_PROC_MAGIC 0xbc7fe9e6 /* Writer end of pipe(2) for mgt -> child ipc */ int pfd; pid_t pid; unsigned gen; int core_id; VTAILQ_ENTRY(child_proc) list; }; VTAILQ_HEAD(child_proc_head, child_proc); static struct child_proc_head child_procs; struct sslctx_s; struct listen_sock { unsigned magic; #define LISTEN_SOCK_MAGIC 0x5b04e577 VTAILQ_ENTRY(listen_sock) list; ev_io listener; int sock; char *name; struct cfg_cert_file *cert; struct sslctx_s *sctx; char *pspec; struct sockaddr_storage addr; }; VTAILQ_HEAD(listen_sock_head, listen_sock); static struct listen_sock_head listen_socks; static unsigned nlisten_socks; #define LOG_REOPEN_INTERVAL 60 static FILE* logf; static struct stat logf_st; static time_t logf_check_t; #ifdef USE_SHARED_CACHE static ev_io shcupd_listener; static int shcupd_socket; struct addrinfo *shcupd_peers[MAX_SHCUPD_PEERS+1]; static unsigned char shared_secret[SHA_DIGEST_LENGTH]; #endif /*USE_SHARED_CACHE*/ #define NULL_DEV "/dev/null" int create_workers; hitch_config *CONFIG; static struct vpf_fh *pfh = NULL; static char tcp_proxy_line[128] = ""; /* What agent/state requests the shutdown--for proper half-closed * handling */ typedef enum _SHUTDOWN_REQUESTOR { SHUTDOWN_HARD, SHUTDOWN_CLEAR, SHUTDOWN_SSL } SHUTDOWN_REQUESTOR; #ifndef OPENSSL_NO_TLSEXT struct sni_name_s; VTAILQ_HEAD(sni_name_head, sni_name_s); /* SSL contexts. */ typedef struct sslctx_s { unsigned magic; #define SSLCTX_MAGIC 0xcd1ce5ff char *filename; SSL_CTX *ctx; double mtim; struct sni_name_head sni_list; UT_hash_handle hh; } sslctx; /* SNI lookup objects */ typedef struct sni_name_s { unsigned magic; #define SNI_NAME_MAGIC 0xb0626581 char *servername; sslctx *sctx; int is_wildcard; VTAILQ_ENTRY(sni_name_s) list; UT_hash_handle hh; } sni_name; static sni_name *sni_names; static sslctx *ssl_ctxs; static sslctx *default_ctx; static void insert_sni_names(sslctx *sc); static int load_cert_ctx(sslctx *so); #endif /* OPENSSL_NO_TLSEXT */ union ha_proxy_v2_addr { struct { /* for TCP/UDP over IPv4, len = 12 */ uint32_t src_addr; uint32_t dst_addr; uint16_t src_port; uint16_t dst_port; } ipv4; struct { /* for TCP/UDP over IPv6, len = 36 */ uint8_t src_addr[16]; uint8_t dst_addr[16]; uint16_t src_port; uint16_t dst_port; } ipv6; struct { /* for AF_UNIX sockets, len = 216 */ uint8_t src_addr[108]; uint8_t dst_addr[108]; } unix; }; struct ha_proxy_v2_hdr { uint8_t sig[12]; uint8_t ver_cmd; uint8_t fam; uint16_t len; /* number of following bytes * part of the header */ union ha_proxy_v2_addr addr; }; /* * Proxied State * * All state associated with one proxied connection */ typedef struct proxystate { unsigned magic; #define PROXYSTATE_MAGIC 0xcf877ed9 ringbuffer ring_ssl2clear; /* Pushing bytes from * secure to clear * stream */ ringbuffer ring_clear2ssl; /* Pushing bytes from * clear to secure * stream */ ev_io ev_r_ssl; /* Secure stream write event */ ev_io ev_w_ssl; /* Secure stream read event */ ev_io ev_r_handshake; /* Secure stream handshake * write event */ ev_io ev_w_handshake; /* Secure stream handshake * read event */ ev_timer ev_t_handshake; /* handshake timer */ ev_io ev_w_connect; /* Backend connect event */ ev_timer ev_t_connect; /* backend connect timer */ ev_io ev_r_clear; /* Clear stream write event */ ev_io ev_w_clear; /* Clear stream read event */ ev_io ev_proxy; /* proxy read event */ int fd_up; /* Upstream (client) socket */ int fd_down; /* Downstream (backend) * socket */ int want_shutdown:1; /* Connection is * half-shutdown */ int handshaked:1; /* Initial handshake happened */ int clear_connected:1; /* Clear stream is * connected */ int renegotiation:1; /* Renegotation is * occuring */ SSL *ssl; /* OpenSSL SSL state */ struct sockaddr_storage remote_ip; /* Remote ip returned * from `accept` */ int connect_port; /* local port for connection */ } proxystate; static void VWLOG(int level, const char *fmt, va_list ap) { struct timeval tv; struct tm tm; char buf[1024]; int n; va_list ap1; va_copy(ap1, ap); if (CONFIG->SYSLOG) { vsyslog(level, fmt, ap); } if (!logf) { va_end(ap1); return; } AZ(gettimeofday(&tv, NULL)); if (logf != stdout && logf != stderr && tv.tv_sec >= logf_check_t + LOG_REOPEN_INTERVAL) { struct stat st; if (stat(CONFIG->LOG_FILENAME, &st) < 0 || st.st_dev != logf_st.st_dev || st.st_ino != logf_st.st_ino) { fclose(logf); logf = fopen(CONFIG->LOG_FILENAME, "a"); if (logf == NULL || fstat(fileno(logf), &logf_st) < 0) memset(&logf_st, 0, sizeof(logf_st)); } logf_check_t = tv.tv_sec; } AN(localtime_r(&tv.tv_sec, &tm)); n = strftime(buf, sizeof(buf), "%Y%m%dT%H%M%S", &tm); snprintf(buf + n, sizeof(buf) - n, ".%06d [%5d] %s", (int) tv.tv_usec, getpid(), fmt); vfprintf(logf, buf, ap1); va_end(ap1); } static void WLOG(int level, const char *fmt, ...) { va_list ap; va_start(ap, fmt); VWLOG(level, fmt, ap); va_end(ap); } #define LOG(...) \ do { \ if (!CONFIG->QUIET) \ WLOG(LOG_INFO, __VA_ARGS__ ); \ } while (0) #define ERR(...) WLOG(LOG_ERR, __VA_ARGS__ ) #define LOGL(...) WLOG(LOG_INFO, __VA_ARGS__) #define SOCKERR(msg) \ do { \ if (errno == ECONNRESET) { \ LOG(msg ": %s\n", strerror(errno)); \ } else { \ ERR(msg ": %s\n", strerror(errno)); \ } \ } while (0) static void logproxy(int level, const proxystate* ps, const char *fmt, ...) { char buf[1024]; char hbuf[INET6_ADDRSTRLEN+1]; char sbuf[8]; int n; va_list ap; socklen_t salen; CHECK_OBJ_NOTNULL(ps, PROXYSTATE_MAGIC); salen = (ps->remote_ip.ss_family == AF_INET) ? sizeof(struct sockaddr) : sizeof(struct sockaddr_in6); n = getnameinfo((struct sockaddr *) &ps->remote_ip, salen, hbuf, sizeof hbuf, sbuf, sizeof sbuf, NI_NUMERICHOST | NI_NUMERICSERV); if (n != 0) { strcpy(hbuf, "n/a"); strcpy(sbuf, "n/a"); } va_start(ap, fmt); if (ps->remote_ip.ss_family == AF_INET) snprintf(buf, sizeof(buf), "%s:%s :%d %d:%d %s", hbuf, sbuf, ps->connect_port, ps->fd_up, ps->fd_down, fmt); else snprintf(buf, sizeof(buf), "[%s]:%s :%d %d:%d %s", hbuf, sbuf, ps->connect_port, ps->fd_up, ps->fd_down, fmt); VWLOG(level, buf, ap); va_end(ap); } #define LOGPROXY(...) \ do { \ if (!CONFIG->QUIET && (logf || CONFIG->SYSLOG)) \ logproxy(LOG_INFO, __VA_ARGS__ ); \ } while(0) #define ERRPROXY(...) \ do { \ if (logf || CONFIG->SYSLOG) \ logproxy(LOG_ERR, __VA_ARGS__ ); \ } while (0) /* set a file descriptor (socket) to non-blocking mode */ static int setnonblocking(int fd) { int flag = 1; if (ioctl(fd, FIONBIO, &flag) < 0) { assert (errno == ECONNRESET || errno == ENOTCONN); return (-1); } return (0); } /* set a tcp socket to use TCP Keepalive */ static void settcpkeepalive(int fd) { int optval = 1; socklen_t optlen = sizeof(optval); if(setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &optval, optlen) < 0) { SOCKERR("Error activating SO_KEEPALIVE on client socket"); } #ifdef TCP_KEEPIDLE optval = CONFIG->TCP_KEEPALIVE_TIME; optlen = sizeof(optval); if (setsockopt(fd, SOL_TCP, TCP_KEEPIDLE, &optval, optlen) < 0) { SOCKERR("Error setting TCP_KEEPIDLE on client socket"); } #endif } static void fail(const char *s) { ERR("%s: %s\n", s, strerror(errno)); exit(1); } void die(char *fmt, ...) { va_list args; va_start(args, fmt); vfprintf(stderr, fmt, args); va_end(args); exit(1); } #ifndef OPENSSL_NO_DH static int init_dh(SSL_CTX *ctx, const char *cert) { DH *dh; BIO *bio; AN(cert); bio = BIO_new_file(cert, "r"); if (!bio) { ERR_print_errors_fp(stderr); return -1; } dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL); BIO_free(bio); if (!dh) { LOG("{core} Note: no DH parameters found in %s\n", cert); return -1; } LOG("{core} Using DH parameters from %s\n", cert); SSL_CTX_set_tmp_dh(ctx, dh); LOG("{core} DH initialized with %d bit key\n", 8*DH_size(dh)); DH_free(dh); return (0); } static int init_ecdh(SSL_CTX *ctx) { #ifndef OPENSSL_NO_EC #ifdef NID_X9_62_prime256v1 EC_KEY *ecdh = NULL; ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); SSL_CTX_set_tmp_ecdh(ctx, ecdh); EC_KEY_free(ecdh); LOG("{core} ECDH Initialized with NIST P-256\n"); #endif /* NID_X9_62_prime256v1 */ #endif /* OPENSSL_NO_EC */ return 0; } #endif /* OPENSSL_NO_DH */ /* This callback function is executed while OpenSSL processes the SSL * handshake and does SSL record layer stuff. It's used to trap * client-initiated renegotiations. */ static void info_callback(const SSL *ssl, int where, int ret) { proxystate *ps; (void)ret; if (where & SSL_CB_HANDSHAKE_START) { CAST_OBJ_NOTNULL(ps, SSL_get_app_data(ssl), PROXYSTATE_MAGIC); if (ps->handshaked) { ps->renegotiation = 1; LOG("{core} SSL renegotiation asked by client\n"); } } } #ifdef USE_SHARED_CACHE /* Handle incoming message updates */ static void handle_shcupd(struct ev_loop *loop, ev_io *w, int revents) { (void)revents; unsigned char msg[SHSESS_MAX_ENCODED_LEN], hash[EVP_MAX_MD_SIZE]; ssize_t r; unsigned int hash_len; uint32_t encdate; long now = (time_t)ev_now(loop); while ((r = recv(w->fd, msg, sizeof(msg), 0)) > 0) { /* msg len must be greater than 1 Byte of data + sig length */ if (r < (int)(1+sizeof(shared_secret))) continue; /* compute sig */ r -= sizeof(shared_secret); HMAC(EVP_sha1(), shared_secret, sizeof(shared_secret), msg, r, hash, &hash_len); if (hash_len != sizeof(shared_secret)) /* should never happen */ continue; /* check sign */ if (memcmp(msg+r, hash, hash_len)) continue; /* msg len must be greater than 1 Byte of data + * encdate length */ if (r < (int)(1+sizeof(uint32_t))) continue; /* drop too unsync updates */ r -= sizeof(uint32_t); encdate = *((uint32_t *)&msg[r]); if (!(abs((int)(int32_t)now - ntohl(encdate)) < SSL_CTX_get_timeout(default_ctx))) continue; shctx_sess_add(msg, r, now); } } /* Send remote updates messages callback */ void shcupd_session_new(unsigned char *msg, unsigned int len, long cdate) { unsigned int hash_len; struct addrinfo **pai = shcupd_peers; uint32_t ncdate; /* add session creation encoded date to footer */ ncdate = htonl((uint32_t)cdate); memcpy(msg+len, &ncdate, sizeof(ncdate)); len += sizeof(ncdate); /* add msg sign */ HMAC(EVP_sha1(), shared_secret, sizeof(shared_secret), msg, len, msg+len, &hash_len); len += hash_len; /* send msg to peers */ while (*pai) { sendto(shcupd_socket, msg, len, 0, (*pai)->ai_addr, (*pai)->ai_addrlen); pai++; } } /* Compute a sha1 secret from an ASN1 rsa private key */ static int compute_secret(RSA *rsa, unsigned char *secret) { unsigned char *buf, *p; unsigned int length; length = i2d_RSAPrivateKey(rsa, NULL); if (length <= 0) return -1; p = buf = (unsigned char *)malloc(length*sizeof(unsigned char)); if (!buf) return -1; i2d_RSAPrivateKey(rsa,&p); SHA1(buf, length, secret); free(buf); return 0; } /* Create udp socket to receive and send updates */ static int create_shcupd_socket() { struct addrinfo *ai, hints; struct addrinfo **pai = shcupd_peers; memset(&hints, 0, sizeof hints); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG; const int gai_err = getaddrinfo(CONFIG->SHCUPD_IP, CONFIG->SHCUPD_PORT, &hints, &ai); if (gai_err != 0) { ERR("{getaddrinfo}: [%s]\n", gai_strerror(gai_err)); exit(1); } /* check if peers inet family addresses match */ while (*pai) { if ((*pai)->ai_family != ai->ai_family) { ERR("Share host and peers inet family differs\n"); exit(1); } pai++; } int s = socket(ai->ai_family, SOCK_DGRAM, IPPROTO_UDP); if (s == -1) fail("{socket: shared cache updates}"); int t = 1; (void)setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &t, sizeof(int)); #ifdef SO_REUSEPORT (void)setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &t, sizeof(int)); #endif if (setnonblocking(s) < 0) fail("{shared cache: setnonblocking}"); if (ai->ai_addr->sa_family == AF_INET) { struct ip_mreqn mreqn; memset(&mreqn, 0, sizeof(mreqn)); mreqn.imr_multiaddr.s_addr = ((struct sockaddr_in *)ai->ai_addr)->sin_addr.s_addr; if (CONFIG->SHCUPD_MCASTIF) { if (isalpha(*CONFIG->SHCUPD_MCASTIF)) { /* appears to be an iface name */ struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); if (strlen(CONFIG->SHCUPD_MCASTIF) > IFNAMSIZ) { ERR("Error iface name is too " "long [%s]\n", CONFIG->SHCUPD_MCASTIF); exit(1); } memcpy(ifr.ifr_name, CONFIG->SHCUPD_MCASTIF, strlen(CONFIG->SHCUPD_MCASTIF)); if (ioctl(s, SIOCGIFINDEX, &ifr)) { fail("{ioctl: SIOCGIFINDEX}"); } mreqn.imr_ifindex = ifr.ifr_ifindex; } else if (strchr(CONFIG->SHCUPD_MCASTIF,'.')) { /* appears to be an ipv4 address */ mreqn.imr_address.s_addr = inet_addr(CONFIG->SHCUPD_MCASTIF); } else { /* appears to be an iface index */ mreqn.imr_ifindex = atoi(CONFIG->SHCUPD_MCASTIF); } } if (setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreqn, sizeof(mreqn)) < 0) { if (errno != EINVAL) { /* EINVAL if it is not a multicast address, * not an error we consider unicast */ fail("{setsockopt: IP_ADD_MEMBERSIP}"); } } else { /* this is a multicast address */ unsigned char loop = 0; if (setsockopt(s, IPPROTO_IP, IP_MULTICAST_LOOP, &loop, sizeof(loop)) < 0) { fail("{setsockopt: IP_MULTICAST_LOOP}"); } } /* optional set sockopts for sending to multicast msg */ if (CONFIG->SHCUPD_MCASTIF && setsockopt(s, IPPROTO_IP, IP_MULTICAST_IF, &mreqn, sizeof(mreqn)) < 0) { fail("{setsockopt: IP_MULTICAST_IF}"); } if (CONFIG->SHCUPD_MCASTTTL) { unsigned char ttl; ttl = (unsigned char)atoi(CONFIG->SHCUPD_MCASTTTL); if (setsockopt(s, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl)) < 0) { fail("{setsockopt: IP_MULTICAST_TTL}"); } } } #ifdef IPV6_ADD_MEMBERSHIP else if (ai->ai_addr->sa_family == AF_INET6) { struct ipv6_mreq mreq; memset(&mreq, 0, sizeof(mreq)); memcpy(&mreq.ipv6mr_multiaddr, &((struct sockaddr_in6 *)ai->ai_addr)->sin6_addr, sizeof(mreq.ipv6mr_multiaddr)); if (CONFIG->SHCUPD_MCASTIF) { if (isalpha(*CONFIG->SHCUPD_MCASTIF)) { /* appears to be an iface name */ struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); if (strlen(CONFIG->SHCUPD_MCASTIF) > IFNAMSIZ) { ERR("Error iface name is too " "long [%s]\n", CONFIG->SHCUPD_MCASTIF); exit(1); } memcpy(ifr.ifr_name, CONFIG->SHCUPD_MCASTIF, strlen(CONFIG->SHCUPD_MCASTIF)); if (ioctl(s, SIOCGIFINDEX, &ifr)) fail("{ioctl: SIOCGIFINDEX}"); mreq.ipv6mr_interface = ifr.ifr_ifindex; } else { /* option appears to be an iface index */ mreq.ipv6mr_interface = atoi(CONFIG->SHCUPD_MCASTIF); } } if (setsockopt(s, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) { if (errno != EINVAL) { /* EINVAL if it is not a multicast address, * not an error we consider unicast */ fail("{setsockopt: IPV6_ADD_MEMBERSIP}"); } } else { /* this is a multicast address */ unsigned int loop = 0; if (setsockopt(s, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &loop, sizeof(loop)) < 0) { fail("{setsockopt: IPV6_MULTICAST_LOOP}"); } } /* optional set sockopts for sending to multicast msg */ if (setsockopt(s, IPPROTO_IPV6, IPV6_MULTICAST_IF, &mreq.ipv6mr_interface, sizeof(mreq.ipv6mr_interface)) < 0) { fail("{setsockopt: IPV6_MULTICAST_IF}"); } if (CONFIG->SHCUPD_MCASTTTL) { int hops; hops = atoi(CONFIG->SHCUPD_MCASTTTL); if (setsockopt(s, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &hops, sizeof(hops)) < 0) { fail("{setsockopt: IPV6_MULTICAST_HOPS}"); } } } #endif /* IPV6_ADD_MEMBERSHIP */ if (bind(s, ai->ai_addr, ai->ai_addrlen)) { fail("{bind-socket}"); } freeaddrinfo(ai); return s; } #endif /*USE_SHARED_CACHE */ RSA * load_rsa_privatekey(SSL_CTX *ctx, const char *file) { BIO *bio; RSA *rsa; bio = BIO_new_file(file, "r"); if (!bio) { ERR_print_errors_fp(stderr); return NULL; } rsa = PEM_read_bio_RSAPrivateKey(bio, NULL, ctx->default_passwd_callback, ctx->default_passwd_callback_userdata); BIO_free(bio); return rsa; } #ifndef OPENSSL_NO_TLSEXT static int sni_match(const sni_name *sn, const char *srvname) { if (!sn->is_wildcard) return (strcasecmp(srvname, sn->servername) == 0); else { char *s = strchr(srvname, '.'); if (s == NULL) return (0); return (strcasecmp(s, sn->servername + 1) == 0); } } /* * Switch the context of the current SSL object to the most appropriate one * based on the SNI header */ static int sni_switch_ctx(SSL *ssl, int *al, void *data) { (void)data; (void)al; const char *servername; const sni_name *sn; servername = SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name); if (!servername) return SSL_TLSEXT_ERR_NOACK; HASH_FIND_STR(sni_names, servername, sn); if (sn == NULL) { char *s; /* attempt another lookup for wildcard matches */ s = strchr(servername, '.'); if (s != NULL) { HASH_FIND_STR(sni_names, s, sn); } } if (sn != NULL) { CHECK_OBJ_NOTNULL(sn, SNI_NAME_MAGIC); if (sni_match(sn, servername)) { CHECK_OBJ_NOTNULL(sn->sctx, SSLCTX_MAGIC); SSL_set_SSL_CTX(ssl, sn->sctx->ctx); return SSL_TLSEXT_ERR_OK; } } /* No matching certs */ if (CONFIG->SNI_NOMATCH_ABORT) return SSL_TLSEXT_ERR_ALERT_FATAL; else return SSL_TLSEXT_ERR_NOACK; } #endif /* OPENSSL_NO_TLSEXT */ static void sctx_free(sslctx *sc, sni_name **sn_tab) { sni_name *sn, *sntmp; if (sn_tab != NULL) CHECK_OBJ_NOTNULL(*sn_tab, SNI_NAME_MAGIC); CHECK_OBJ_NOTNULL(sc, SSLCTX_MAGIC); VTAILQ_FOREACH_SAFE(sn, &sc->sni_list, list, sntmp) { CHECK_OBJ_NOTNULL(sn, SNI_NAME_MAGIC); VTAILQ_REMOVE(&sc->sni_list, sn, list); if (sn_tab != NULL) HASH_DEL(*sn_tab, sn); free(sn->servername); FREE_OBJ(sn); } free(sc->filename); SSL_CTX_free(sc->ctx); FREE_OBJ(sc); } /* Initialize an SSL context */ sslctx * make_ctx(const struct cfg_cert_file *cf) { SSL_CTX *ctx; sslctx *sc; RSA *rsa; long ssloptions = SSL_OP_NO_SSLv2 | SSL_OP_ALL | SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION; #ifdef SSL_OP_NO_COMPRESSION ssloptions |= SSL_OP_NO_COMPRESSION; #endif if (CONFIG->ETYPE == ENC_TLS) ssloptions |= SSL_OP_NO_SSLv3; ctx = SSL_CTX_new((CONFIG->PMODE == SSL_CLIENT) ? SSLv23_client_method() : SSLv23_server_method()); SSL_CTX_set_options(ctx, ssloptions); SSL_CTX_set_info_callback(ctx, info_callback); if (CONFIG->CIPHER_SUITE) { if (SSL_CTX_set_cipher_list(ctx, CONFIG->CIPHER_SUITE) != 1) { ERR_print_errors_fp(stderr); } } if (CONFIG->PREFER_SERVER_CIPHERS) SSL_CTX_set_options(ctx, SSL_OP_CIPHER_SERVER_PREFERENCE); ALLOC_OBJ(sc, SSLCTX_MAGIC); AN(sc); sc->filename = strdup(cf->filename); sc->mtim = cf->mtim; sc->ctx = ctx; VTAILQ_INIT(&sc->sni_list); if (CONFIG->PMODE == SSL_CLIENT) return (sc); /* SSL_SERVER Mode stuff */ if (SSL_CTX_use_certificate_chain_file(ctx, cf->filename) <= 0) { ERR("Error loading certificate file %s\n", cf->filename); ERR_print_errors_fp(stderr); sctx_free(sc, NULL); return (NULL); } rsa = load_rsa_privatekey(ctx, cf->filename); if (!rsa) { ERR("Error loading RSA private key (%s)\n", cf->filename); sctx_free(sc, NULL); return (NULL); } if (SSL_CTX_use_RSAPrivateKey(ctx, rsa) <= 0) { ERR_print_errors_fp(stderr); RSA_free(rsa); sctx_free(sc, NULL); return (NULL); } #ifndef OPENSSL_NO_DH init_dh(ctx, cf->filename); init_ecdh(ctx); #endif /* OPENSSL_NO_DH */ #ifndef OPENSSL_NO_TLSEXT if (!SSL_CTX_set_tlsext_servername_callback(ctx, sni_switch_ctx)) { ERR("Error setting up SNI support.\n"); } #endif /* OPENSSL_NO_TLSEXT */ #ifdef USE_SHARED_CACHE if (CONFIG->SHARED_CACHE) { if (shared_context_init(ctx, CONFIG->SHARED_CACHE) < 0) { ERR("Unable to alloc memory for shared cache.\n"); RSA_free(rsa); sctx_free(sc, NULL); return (NULL); } if (CONFIG->SHCUPD_PORT) { if (compute_secret(rsa, shared_secret) < 0) { ERR("Unable to compute shared secret.\n"); RSA_free(rsa); sctx_free(sc, NULL); return (NULL); } /* Force TLS tickets because keys differs. */ SSL_CTX_set_options(ctx, SSL_OP_NO_TICKET); if (*shcupd_peers) { shsess_set_new_cbk(shcupd_session_new); } } } #endif RSA_free(rsa); return (sc); } static void insert_sni_names(sslctx *sc) { sni_name *sn, *sn2; char *key; CHECK_OBJ_NOTNULL(sc, SSLCTX_MAGIC); VTAILQ_FOREACH(sn, &sc->sni_list, list) { CHECK_OBJ_NOTNULL(sn, SNI_NAME_MAGIC); key = sn->servername; if (sn->is_wildcard) key = sn->servername + 1; HASH_FIND_STR(sni_names, key, sn2); if (sn2 != NULL) { ERR("Warning: SNI name '%s' from '%s' overriden" " by '%s'\n", key, sn2->sctx->filename, sn->sctx->filename); } HASH_ADD_KEYPTR(hh, sni_names, key, strlen(key), sn); } } #ifndef OPENSSL_NO_TLSEXT static int load_cert_ctx(sslctx *so) { X509 *x509; X509_NAME *x509_name; X509_NAME_ENTRY *x509_entry; BIO *f; STACK_OF(GENERAL_NAME) *names = NULL; GENERAL_NAME *name; int i; #define PUSH_CTX(asn1_str, ctx) \ do { \ sni_name *sn; \ ALLOC_OBJ(sn, SNI_NAME_MAGIC); \ ASN1_STRING_to_UTF8( \ (unsigned char **)&sn->servername, asn1_str); \ sn->is_wildcard = \ (strstr(sn->servername, "*.") == sn->servername); \ sn->sctx = so; \ VTAILQ_INSERT_TAIL(&so->sni_list, sn, list); \ } while (0) f = BIO_new(BIO_s_file()); // TODO: error checking if (!BIO_read_filename(f, so->filename)) { ERR("Could not read certificate '%s'\n", so->filename); return (1); } x509 = PEM_read_bio_X509_AUX(f, NULL, NULL, NULL); BIO_free(f); /* First, look for Subject Alternative Names. */ names = X509_get_ext_d2i(x509, NID_subject_alt_name, NULL, NULL); for (i = 0; i < sk_GENERAL_NAME_num(names); i++) { name = sk_GENERAL_NAME_value(names, i); if (name->type == GEN_DNS) { PUSH_CTX(name->d.dNSName, ctx); } } if (sk_GENERAL_NAME_num(names) > 0) { sk_GENERAL_NAME_pop_free(names, GENERAL_NAME_free); /* If we found some, don't bother looking any further. */ X509_free(x509); return (0); } else if (names != NULL) { sk_GENERAL_NAME_pop_free(names, GENERAL_NAME_free); } /* Now we're left looking at the CN on the cert. */ x509_name = X509_get_subject_name(x509); i = X509_NAME_get_index_by_NID(x509_name, NID_commonName, -1); if (i < 0) { ERR("Could not find Subject Alternative Names" " or a CN on cert %s\n", so->filename); X509_free(x509); return (1); } x509_entry = X509_NAME_get_entry(x509_name, i); AN(x509_entry); PUSH_CTX(x509_entry->value, ctx); X509_free(x509); return (0); } #endif /* OPENSSL_NO_TLSEXT */ /* Check that we don't needlessly load a cert that's already loaded. */ static sslctx * find_ctx(const char *file) { sslctx *so; HASH_FIND_STR(ssl_ctxs, file, so); return (so); } /* Init library and load specified certificate. * Establishes a SSL_ctx, to act as a template for * each connection */ void init_openssl(void) { struct cfg_cert_file *cf, *cftmp; struct listen_sock *ls; sslctx *so; SSL_library_init(); SSL_load_error_strings(); AN(CONFIG->CERT_DEFAULT); /* The last file listed in config is the "default" cert */ default_ctx = make_ctx(CONFIG->CERT_DEFAULT); if (default_ctx == NULL) exit(1); #ifndef OPENSSL_NO_TLSEXT load_cert_ctx(default_ctx); insert_sni_names(default_ctx); // Go through the list of PEMs and make some SSL contexts for // them. We also keep track of the names associated with each // cert so we can do SNI on them later HASH_ITER(hh, CONFIG->CERT_FILES, cf, cftmp) { if (find_ctx(cf->filename) == NULL) { so = make_ctx(cf); if (so == NULL) exit(1); HASH_ADD_KEYPTR(hh, ssl_ctxs, cf->filename, strlen(cf->filename), so); load_cert_ctx(so); insert_sni_names(so); } } VTAILQ_FOREACH(ls, &listen_socks, list) { if (ls->cert) { so = find_ctx(ls->cert->filename); if (so == NULL) { so = make_ctx(ls->cert); AN(so); HASH_ADD_KEYPTR(hh, ssl_ctxs, ls->cert->filename, strlen(ls->cert->filename), so); load_cert_ctx(so); insert_sni_names(so); } ls->sctx = so; } } #undef APPEND_CTX #endif /* OPENSSL_NO_TLSEXT */ if (CONFIG->ENGINE) { ENGINE *e = NULL; ENGINE_load_builtin_engines(); if (!strcmp(CONFIG->ENGINE, "auto")) ENGINE_register_all_complete(); else { if ((e = ENGINE_by_id(CONFIG->ENGINE)) == NULL || !ENGINE_init(e) || !ENGINE_set_default(e, ENGINE_METHOD_ALL)) { ERR_print_errors_fp(stderr); exit(1); } LOG("{core} will use OpenSSL engine %s.\n", ENGINE_get_id(e)); ENGINE_finish(e); ENGINE_free(e); } } } static void destroy_listen_sock(struct listen_sock *ls) { CHECK_OBJ_NOTNULL(ls, LISTEN_SOCK_MAGIC); if (ls->sock > 0) (void) close(ls->sock); free(ls->name); free(ls->pspec); if (ls->cert) { CHECK_OBJ_NOTNULL(ls->cert, CFG_CERT_FILE_MAGIC); ls->cert->ref--; if (ls->cert->ref == 0) { free(ls->cert->filename); FREE_OBJ(ls->cert); } } FREE_OBJ(ls); } /* Create the bound socket in the parent process */ static int create_listen_sock(const struct front_arg *fa, struct listen_sock_head *socks) { struct addrinfo *ai, hints, *it; struct listen_sock *ls, *lstmp; char buf[INET6_ADDRSTRLEN+20]; char abuf[INET6_ADDRSTRLEN]; char pbuf[8]; int n, r; int count = 0; struct listen_sock_head tmp_list; CHECK_OBJ_NOTNULL(fa, FRONT_ARG_MAGIC); VTAILQ_INIT(&tmp_list); memset(&hints, 0, sizeof hints); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG; const int gai_err = getaddrinfo(fa->ip, fa->port, &hints, &ai); if (gai_err != 0) { ERR("{getaddrinfo}: %s: [%s]\n", fa->pspec, gai_strerror(gai_err)); return (-1); } for (it = ai; it != NULL; it = it->ai_next) { ALLOC_OBJ(ls, LISTEN_SOCK_MAGIC); VTAILQ_INSERT_TAIL(&tmp_list, ls, list); count++; ls->sock = socket(it->ai_family, SOCK_STREAM, IPPROTO_TCP); if (ls->sock == -1) { ERR("{socket: main}: %s: %s\n", strerror(errno), fa->pspec); goto creat_ls_err; } int t = 1; if (setsockopt(ls->sock, SOL_SOCKET, SO_REUSEADDR, &t, sizeof(int)) < 0) { ERR("{setsockopt-reuseaddr}: %s: %s\n", strerror(errno), fa->pspec); goto creat_ls_err; } #ifdef SO_REUSEPORT if (setsockopt(ls->sock, SOL_SOCKET, SO_REUSEPORT, &t, sizeof(int)) < 0) { ERR("{setsockopt-reuseport}: %s: %s\n", strerror(errno), fa->pspec); goto creat_ls_err; } #endif if(setnonblocking(ls->sock) < 0) { ERR("{listen sock: setnonblocking}: %s: %s\n", strerror(errno), fa->pspec); goto creat_ls_err; } #ifdef IPV6_V6ONLY t = 1; if (it->ai_family == AF_INET6 && setsockopt(ls->sock, IPPROTO_IPV6, IPV6_V6ONLY, &t, sizeof (t)) != 0) { ERR("{setsockopt-ipv6only}: %s: %s\n", strerror(errno), fa->pspec); goto creat_ls_err; } #endif if (CONFIG->RECV_BUFSIZE > 0) { r = setsockopt(ls->sock, SOL_SOCKET, SO_RCVBUF, &CONFIG->RECV_BUFSIZE, sizeof(CONFIG->RECV_BUFSIZE)); if (r < 0) { ERR("{setsockopt-rcvbuf}: %s: %s\n", strerror(errno),fa->pspec); goto creat_ls_err; } } if (CONFIG->SEND_BUFSIZE > 0) { r = setsockopt(ls->sock, SOL_SOCKET, SO_SNDBUF, &CONFIG->SEND_BUFSIZE, sizeof(CONFIG->SEND_BUFSIZE)); if (r < 0) { ERR("{setsockopt-sndbuf}: %s: %s\n", strerror(errno), fa->pspec); goto creat_ls_err; } } if (bind(ls->sock, it->ai_addr, it->ai_addrlen)) { ERR("{bind-socket}: %s: %s\n", strerror(errno), fa->pspec); goto creat_ls_err; } #ifndef NO_DEFER_ACCEPT #if TCP_DEFER_ACCEPT int timeout = 1; if (setsockopt(ls->sock, IPPROTO_TCP, TCP_DEFER_ACCEPT, &timeout, sizeof(int)) < 0) { ERR("{setsockopt-defer_accept}: %s: %s\n", strerror(errno), fa->pspec); goto creat_ls_err; } #endif /* TCP_DEFER_ACCEPT */ #endif if (listen(ls->sock, CONFIG->BACKLOG) != 0) { ERR("{listen-socket}: %s: %s\n", strerror(errno), fa->pspec); goto creat_ls_err; } memcpy(&ls->addr, it->ai_addr, it->ai_addrlen); n = getnameinfo(it->ai_addr, it->ai_addrlen, abuf, sizeof abuf, pbuf, sizeof pbuf, NI_NUMERICHOST | NI_NUMERICSERV); if (n != 0) { ERR("{getnameinfo}: %s\n", fa->pspec); goto creat_ls_err; } if (it->ai_addr->sa_family == AF_INET6) { sprintf(buf, "[%s]:%s", abuf, pbuf); } else { sprintf(buf, "%s:%s", abuf, pbuf); } ls->name = strdup(buf); AN(ls->name); if (fa->cert != NULL) { ls->cert = fa->cert; fa->cert->ref++; } ls->pspec = strdup(fa->pspec); LOG("{core} Listening on %s\n", ls->name); } VTAILQ_FOREACH_SAFE(ls, &tmp_list, list, lstmp) { VTAILQ_REMOVE(&tmp_list, ls, list); VTAILQ_INSERT_TAIL(socks, ls, list); } freeaddrinfo(ai); return (count); creat_ls_err: freeaddrinfo(ai); VTAILQ_FOREACH_SAFE(ls, &tmp_list, list, lstmp) { VTAILQ_REMOVE(&tmp_list, ls, list); destroy_listen_sock(ls); } return (-1); } /* Initiate a clear-text nonblocking connect() to the backend IP on behalf * of a newly connected upstream (encrypted) client */ static int create_back_socket() { int s = socket(backaddr->ai_family, SOCK_STREAM, IPPROTO_TCP); if (s == -1) return -1; int flag = 1; int ret = setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(flag)); if (ret == -1) ERR("Couldn't setsockopt to backend (TCP_NODELAY): %s\n", strerror(errno)); if (setnonblocking(s) < 0) { (void)close(s); return (-1); } return (s); } /* Only enable a libev ev_io event if the proxied connection still * has both up and down connected */ static void safe_enable_io(proxystate *ps, ev_io *w) { CHECK_OBJ_NOTNULL(ps, PROXYSTATE_MAGIC); if (!ps->want_shutdown) ev_io_start(loop, w); } static void check_exit_state(void) { if (child_state == CHILD_EXITING && n_conns == 0) { LOGL("Child %d (gen: %d) in state EXITING " "is now exiting.\n", core_id, child_gen); _exit(0); } } /* Only enable a libev ev_io event if the proxied connection still * has both up and down connected */ static void shutdown_proxy(proxystate *ps, SHUTDOWN_REQUESTOR req) { CHECK_OBJ_NOTNULL(ps, PROXYSTATE_MAGIC); LOGPROXY(ps, "proxy shutdown req=%d\n", req); if (ps->want_shutdown || req == SHUTDOWN_HARD) { ev_io_stop(loop, &ps->ev_w_ssl); ev_io_stop(loop, &ps->ev_r_ssl); ev_io_stop(loop, &ps->ev_w_handshake); ev_io_stop(loop, &ps->ev_r_handshake); ev_timer_stop(loop, &ps->ev_t_handshake); ev_io_stop(loop, &ps->ev_w_connect); ev_timer_stop(loop, &ps->ev_t_connect); ev_io_stop(loop, &ps->ev_w_clear); ev_io_stop(loop, &ps->ev_r_clear); ev_io_stop(loop, &ps->ev_proxy); close(ps->fd_up); close(ps->fd_down); ERR_clear_error(); SSL_set_shutdown(ps->ssl, SSL_SENT_SHUTDOWN); SSL_free(ps->ssl); ringbuffer_cleanup(&ps->ring_clear2ssl); ringbuffer_cleanup(&ps->ring_ssl2clear); free(ps); n_conns--; check_exit_state(); } else { ps->want_shutdown = 1; if (req == SHUTDOWN_CLEAR && ringbuffer_is_empty(&ps->ring_clear2ssl)) shutdown_proxy(ps, SHUTDOWN_HARD); else if (req == SHUTDOWN_SSL && ringbuffer_is_empty(&ps->ring_ssl2clear)) shutdown_proxy(ps, SHUTDOWN_HARD); } } /* Handle various socket errors */ static void handle_socket_errno(proxystate *ps, int backend) { CHECK_OBJ_NOTNULL(ps, PROXYSTATE_MAGIC); if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) return; if (backend) ERR("{backend} Socket error: %s\n", strerror(errno)); else LOG("{client} Socket error: %s\n", strerror(errno)); shutdown_proxy(ps, SHUTDOWN_CLEAR); } /* Start connect to backend */ static int start_connect(proxystate *ps) { int t = 1; CHECK_OBJ_NOTNULL(ps, PROXYSTATE_MAGIC); t = connect(ps->fd_down, backaddr->ai_addr, backaddr->ai_addrlen); if (t == 0 || errno == EINPROGRESS || errno == EINTR) { ev_io_start(loop, &ps->ev_w_connect); ev_timer_start(loop, &ps->ev_t_connect); return 0; } ERR("{backend-connect}: %s\n", strerror(errno)); shutdown_proxy(ps, SHUTDOWN_HARD); return -1; } /* Read some data from the backend when libev says data is available-- * write it into the upstream buffer and make sure the write event is * enabled for the upstream socket */ static void clear_read(struct ev_loop *loop, ev_io *w, int revents) { (void) revents; int t; proxystate *ps; CAST_OBJ_NOTNULL(ps, w->data, PROXYSTATE_MAGIC); if (ps->want_shutdown) { ev_io_stop(loop, &ps->ev_r_clear); return; } int fd = w->fd; char *buf = ringbuffer_write_ptr(&ps->ring_clear2ssl); t = recv(fd, buf, ps->ring_clear2ssl.data_len, 0); if (t > 0) { ringbuffer_write_append(&ps->ring_clear2ssl, t); if (ringbuffer_is_full(&ps->ring_clear2ssl)) ev_io_stop(loop, &ps->ev_r_clear); if (ps->handshaked) safe_enable_io(ps, &ps->ev_w_ssl); } else if (t == 0) { LOGPROXY(ps,"Connection closed by %s\n", fd == ps->fd_down ? "backend" : "client"); shutdown_proxy(ps, SHUTDOWN_CLEAR); } else { assert(t == -1); handle_socket_errno(ps, fd == ps->fd_down ? 1 : 0); } } /* Write some data, previously received on the secure upstream socket, * out of the downstream buffer and onto the backend socket */ static void clear_write(struct ev_loop *loop, ev_io *w, int revents) { (void)revents; int t; proxystate *ps; int fd = w->fd; int sz; CAST_OBJ_NOTNULL(ps, w->data, PROXYSTATE_MAGIC); assert(!ringbuffer_is_empty(&ps->ring_ssl2clear)); char *next = ringbuffer_read_next(&ps->ring_ssl2clear, &sz); t = send(fd, next, sz, MSG_NOSIGNAL); if (t > 0) { if (t == sz) { ringbuffer_read_pop(&ps->ring_ssl2clear); if (ps->handshaked) safe_enable_io(ps, &ps->ev_r_ssl); if (ringbuffer_is_empty(&ps->ring_ssl2clear)) { if (ps->want_shutdown) { shutdown_proxy(ps, SHUTDOWN_HARD); return; // dealloc'd } ev_io_stop(loop, &ps->ev_w_clear); } } else { ringbuffer_read_skip(&ps->ring_ssl2clear, t); } } else { assert(t == -1); handle_socket_errno(ps, fd == ps->fd_down ? 1 : 0); } } static void start_handshake(proxystate *ps, int err); /* Continue/complete the asynchronous connect() before starting data * transmission between front/backend */ static void handle_connect(struct ev_loop *loop, ev_io *w, int revents) { int t, r; proxystate *ps; (void)revents; CAST_OBJ_NOTNULL(ps, w->data, PROXYSTATE_MAGIC); t = connect(ps->fd_down, backaddr->ai_addr, backaddr->ai_addrlen); if (!t || errno == EISCONN || !errno) { ev_io_stop(loop, &ps->ev_w_connect); ev_timer_stop(loop, &ps->ev_t_connect); if (!ps->clear_connected) { struct sockaddr_storage addr; socklen_t sl; sl = sizeof(addr); r = getsockname(ps->fd_down, (struct sockaddr*) &addr, &sl); AZ(r); ps->connect_port = ntohs(((struct sockaddr_in*)&addr)->sin_port); LOGPROXY(ps, "backend connected\n"); ps->clear_connected = 1; /* if incoming buffer is not full */ if (!ringbuffer_is_full(&ps->ring_clear2ssl)) safe_enable_io(ps, &ps->ev_r_clear); /* if outgoing buffer is not empty */ if (!ringbuffer_is_empty(&ps->ring_ssl2clear)) // not safe.. we want to resume stream // even during half-closed ev_io_start(loop, &ps->ev_w_clear); } else { /* Clear side already connected so connect is on * secure side: perform handshake */ start_handshake(ps, SSL_ERROR_WANT_WRITE); } } else if (errno == EINPROGRESS || errno == EINTR || errno == EALREADY) { /* do nothing, we'll get phoned home again... */ } else { ERR("{backend-connect}: %s\n", strerror(errno)); shutdown_proxy(ps, SHUTDOWN_HARD); } } static void connect_timeout(EV_P_ ev_timer *w, int revents) { (void)loop; (void)revents; proxystate *ps; CAST_OBJ_NOTNULL(ps, w->data, PROXYSTATE_MAGIC); ERRPROXY(ps,"backend connect timeout\n"); //shutdown_proxy(ps, SHUTDOWN_HARD); } /* Upon receiving a signal from OpenSSL that a handshake is required, re-wire * the read/write events to hook up to the handshake handlers */ static void start_handshake(proxystate *ps, int err) { CHECK_OBJ_NOTNULL(ps, PROXYSTATE_MAGIC); ev_io_stop(loop, &ps->ev_r_ssl); ev_io_stop(loop, &ps->ev_w_ssl); ps->handshaked = 0; LOGPROXY(ps,"ssl handshake start\n"); if (err == SSL_ERROR_WANT_READ) ev_io_start(loop, &ps->ev_r_handshake); else if (err == SSL_ERROR_WANT_WRITE) ev_io_start(loop, &ps->ev_w_handshake); ev_timer_start(loop, &ps->ev_t_handshake); } static void write_proxy_v2(proxystate *ps, const struct sockaddr *local) { struct ha_proxy_v2_hdr *p; union addr { struct sockaddr sa; struct sockaddr_in sa4; struct sockaddr_in6 sa6; } *l, *r; CHECK_OBJ_NOTNULL(ps, PROXYSTATE_MAGIC); p = (struct ha_proxy_v2_hdr *) ringbuffer_write_ptr(&ps->ring_ssl2clear); size_t len = 16; l = (union addr *) local; r = (union addr *) &ps->remote_ip; memcpy(&p->sig,"\r\n\r\n\0\r\nQUIT\n", 12); p->ver_cmd = 0x21; /* v2|PROXY */ p->fam = l->sa.sa_family == AF_INET ? 0x11 : 0x21; p->len = l->sa.sa_family == AF_INET ? htons(12) : htons(36); if (l->sa.sa_family == AF_INET) { len += 12; /* src/client */ memcpy(&p->addr.ipv4.src_addr, &r->sa4.sin_addr.s_addr, sizeof p->addr.ipv4.src_addr); memcpy(&p->addr.ipv4.src_port, &r->sa4.sin_port, sizeof p->addr.ipv4.src_port); /* dst/server */ memcpy(&p->addr.ipv4.dst_addr, &l->sa4.sin_addr.s_addr, sizeof p->addr.ipv4.dst_addr); memcpy(&p->addr.ipv4.dst_port, &l->sa4.sin_port, sizeof p->addr.ipv4.dst_port); } else { assert (l->sa.sa_family == AF_INET6); len += 36; /* src/client */ memcpy(&p->addr.ipv6.src_addr, &r->sa6.sin6_addr.s6_addr, sizeof p->addr.ipv6.src_addr); memcpy(&p->addr.ipv6.src_port, &r->sa6.sin6_port, sizeof p->addr.ipv6.src_port); /* dst/server */ memcpy(&p->addr.ipv6.dst_addr, &l->sa6.sin6_addr.s6_addr, sizeof p->addr.ipv6.dst_addr); memcpy(&p->addr.ipv6.dst_port, &l->sa6.sin6_port, sizeof p->addr.ipv6.dst_port); } ringbuffer_write_append(&ps->ring_ssl2clear, len); } static void write_proxy_v1(proxystate *ps, const struct sockaddr *local, socklen_t slen) { char *p; char src_addr[INET6_ADDRSTRLEN+1], dst_addr[INET6_ADDRSTRLEN+1]; char src_port[8], dst_port[8]; size_t len; int n; CHECK_OBJ_NOTNULL(ps, PROXYSTATE_MAGIC); p = ringbuffer_write_ptr(&ps->ring_ssl2clear); n = getnameinfo(local, slen, dst_addr, sizeof dst_addr, dst_port, sizeof dst_port, NI_NUMERICHOST | NI_NUMERICSERV); AZ(n); n = getnameinfo((struct sockaddr *) &ps->remote_ip, slen, src_addr, sizeof src_addr, src_port, sizeof src_port, NI_NUMERICHOST | NI_NUMERICSERV); AZ(n); if (local->sa_family == AF_INET) { len = sprintf(p, "PROXY TCP4 %s %s %s %s\r\n", src_addr, dst_addr, src_port, dst_port); } else { assert (local->sa_family == AF_INET6); len = sprintf(p, "PROXY TCP6 %s %s %s %s\r\n", src_addr, dst_addr, src_port, dst_port); } assert (len > 0); ringbuffer_write_append(&ps->ring_ssl2clear, len); } static void write_ip_octet(proxystate *ps) { char *ring_pnt; CHECK_OBJ_NOTNULL(ps, PROXYSTATE_MAGIC); ring_pnt = ringbuffer_write_ptr(&ps->ring_ssl2clear); assert(ps->remote_ip.ss_family == AF_INET || ps->remote_ip.ss_family == AF_INET6); *ring_pnt++ = (unsigned char) ps->remote_ip.ss_family; if (ps->remote_ip.ss_family == AF_INET6) { memcpy(ring_pnt, &((struct sockaddr_in6 *) &ps->remote_ip)->sin6_addr.s6_addr, 16U); ringbuffer_write_append(&ps->ring_ssl2clear, 1U + 16U); } else { memcpy(ring_pnt, &((struct sockaddr_in *) &ps->remote_ip)->sin_addr.s_addr, 4U); ringbuffer_write_append(&ps->ring_ssl2clear, 1U + 4U); } } /* After OpenSSL is done with a handshake, re-wire standard read/write handlers * for data transmission */ static void end_handshake(proxystate *ps) { CHECK_OBJ_NOTNULL(ps, PROXYSTATE_MAGIC); ev_io_stop(loop, &ps->ev_r_handshake); ev_io_stop(loop, &ps->ev_w_handshake); ev_timer_stop(loop, &ps->ev_t_handshake); LOGPROXY(ps,"ssl end handshake\n"); /* Disable renegotiation (CVE-2009-3555) */ if (ps->ssl->s3) { ps->ssl->s3->flags |= SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS; } ps->handshaked = 1; /* Check if clear side is connected */ if (!ps->clear_connected) { if (CONFIG->WRITE_PROXY_LINE_V1 || CONFIG->WRITE_PROXY_LINE_V2) { struct sockaddr_storage local; socklen_t slen = sizeof local; AZ(getsockname(ps->fd_up, (struct sockaddr *) &local, &slen)); if (CONFIG->WRITE_PROXY_LINE_V1) write_proxy_v1(ps, (struct sockaddr *) &local, slen); else write_proxy_v2(ps, (struct sockaddr *) &local); } else if (CONFIG->WRITE_IP_OCTET) { write_ip_octet(ps); } /* start connect now */ if (0 != start_connect(ps)) return; } else { /* hitch used in client mode, keep client session ) */ if (!SSL_session_reused(ps->ssl)) { if (client_session) SSL_SESSION_free(client_session); client_session = SSL_get1_session(ps->ssl); } } /* if incoming buffer is not full */ if (!ringbuffer_is_full(&ps->ring_ssl2clear)) safe_enable_io(ps, &ps->ev_r_ssl); /* if outgoing buffer is not empty */ if (!ringbuffer_is_empty(&ps->ring_clear2ssl)) // not safe.. we want to resume stream even during half-closed ev_io_start(loop, &ps->ev_w_ssl); } static void client_proxy_proxy(struct ev_loop *loop, ev_io *w, int revents) { (void)revents; int t; char *proxy = tcp_proxy_line; char *end = tcp_proxy_line + sizeof(tcp_proxy_line); proxystate *ps; BIO *b; CAST_OBJ_NOTNULL(ps, w->data, PROXYSTATE_MAGIC); b = SSL_get_rbio(ps->ssl); // Copy characters one-by-one until we hit a \n or an error while (proxy != end && (t = BIO_read(b, proxy, 1)) == 1) { if (*proxy++ == '\n') break; } if (proxy == end) { LOG("{client} Unexpectedly long PROXY line. Malformed req?"); shutdown_proxy(ps, SHUTDOWN_SSL); } else if (t == 1) { if (ringbuffer_is_full(&ps->ring_ssl2clear)) { LOG("{client} Error writing PROXY line"); shutdown_proxy(ps, SHUTDOWN_SSL); return; } char *ring = ringbuffer_write_ptr(&ps->ring_ssl2clear); memcpy(ring, tcp_proxy_line, proxy - tcp_proxy_line); ringbuffer_write_append(&ps->ring_ssl2clear, proxy - tcp_proxy_line); // Finished reading the PROXY header if (*(proxy - 1) == '\n') { ev_io_stop(loop, &ps->ev_proxy); // Start the real handshake start_handshake(ps, SSL_ERROR_WANT_READ); } } else if (!BIO_should_retry(b)) { LOG("{client} Unexpected error reading PROXY line"); shutdown_proxy(ps, SHUTDOWN_SSL); } } static void log_ssl_error (proxystate* ps, const char* what) { int e; CHECK_OBJ_NOTNULL(ps, PROXYSTATE_MAGIC); while ((e = ERR_get_error())) { char buf[1024]; ERR_error_string_n(e, buf, sizeof(buf)); ERRPROXY(ps, "%s: %s\n", what, buf); } } /* The libev I/O handler during the OpenSSL handshake phase. Basically, just * let OpenSSL do what it likes with the socket and obey its requests for reads * or writes */ static void client_handshake(struct ev_loop *loop, ev_io *w, int revents) { (void)revents; int t; proxystate *ps; CAST_OBJ_NOTNULL(ps, w->data, PROXYSTATE_MAGIC); LOGPROXY(ps,"ssl client handshake revents=%x\n",revents); t = SSL_do_handshake(ps->ssl); if (t == 1) { end_handshake(ps); } else { int err = SSL_get_error(ps->ssl, t); LOGPROXY(ps,"ssl client handshake err=%d\n",err); if (err == SSL_ERROR_WANT_READ) { ev_io_stop(loop, &ps->ev_w_handshake); ev_io_start(loop, &ps->ev_r_handshake); } else if (err == SSL_ERROR_WANT_WRITE) { ev_io_stop(loop, &ps->ev_r_handshake); ev_io_start(loop, &ps->ev_w_handshake); } else if (err == SSL_ERROR_ZERO_RETURN) { LOG("{%s} Connection closed (in handshake)\n", w->fd == ps->fd_up ? "client" : "backend"); shutdown_proxy(ps, SHUTDOWN_SSL); } else { if (err == SSL_ERROR_SSL) { log_ssl_error(ps, "Handshake failure"); } else { LOG("{%s} Unexpected SSL error " "(in handshake): %d\n", w->fd == ps->fd_up ? "client" : "backend", err); } shutdown_proxy(ps, SHUTDOWN_SSL); } } } static void handshake_timeout(EV_P_ ev_timer *w, int revents) { (void)loop; (void)revents; proxystate *ps; CAST_OBJ_NOTNULL(ps, w->data, PROXYSTATE_MAGIC); LOGPROXY(ps,"SSL handshake timeout\n"); shutdown_proxy(ps, SHUTDOWN_HARD); } #define SSLERR(ps, which, log) \ switch (err) { \ case SSL_ERROR_ZERO_RETURN: \ log(ps,"Connection closed by " which "\n"); \ break; \ case SSL_ERROR_SYSCALL: \ if (errno == 0) { \ log(ps,"Connection closed by " which "\n"); \ } else { \ log(ps,"SSL socket error (" which "): %s\n", \ strerror(errno)); \ } \ break; \ default: \ log(ps,"{" which "} Unexpected SSL_read error (" \ which "): %d\n", err); \ } /* Handle a socket error condition passed to us from OpenSSL */ static void handle_fatal_ssl_error(proxystate *ps, int err, int backend) { CHECK_OBJ_NOTNULL(ps, PROXYSTATE_MAGIC); if (backend) { SSLERR(ps, "backend", ERRPROXY); } else { SSLERR(ps, "client", LOGPROXY); } shutdown_proxy(ps, SHUTDOWN_SSL); } /* Read some data from the upstream secure socket via OpenSSL, * and buffer anything we get for writing to the backend */ static void ssl_read(struct ev_loop *loop, ev_io *w, int revents) { (void)revents; int t; proxystate *ps; CAST_OBJ_NOTNULL(ps, w->data, PROXYSTATE_MAGIC); if (ps->want_shutdown) { ev_io_stop(loop, &ps->ev_r_ssl); return; } if (ringbuffer_is_full(&ps->ring_ssl2clear)) { ERRPROXY(ps, "attempt to read ssl when ring full"); ev_io_stop(loop, &ps->ev_r_ssl); return; } char *buf = ringbuffer_write_ptr(&ps->ring_ssl2clear); t = SSL_read(ps->ssl, buf, ps->ring_ssl2clear.data_len); /* Fix CVE-2009-3555. Disable reneg if started by client. */ if (ps->renegotiation) { shutdown_proxy(ps, SHUTDOWN_SSL); return; } if (t > 0) { ringbuffer_write_append(&ps->ring_ssl2clear, t); if (ringbuffer_is_full(&ps->ring_ssl2clear)) ev_io_stop(loop, &ps->ev_r_ssl); if (ps->clear_connected) safe_enable_io(ps, &ps->ev_w_clear); } else { int err = SSL_get_error(ps->ssl, t); if (err == SSL_ERROR_WANT_WRITE) { start_handshake(ps, err); } else if (err == SSL_ERROR_WANT_READ) { /* NOOP. Incomplete SSL data */ } else { if (err == SSL_ERROR_SSL) { log_ssl_error(ps, "SSL_read error"); } else { LOG("{%s} SSL_read error: %d\n", w->fd == ps->fd_up ? "client" : "backend", err); } handle_fatal_ssl_error(ps, err, w->fd == ps->fd_up ? 0 : 1); } } } /* Write some previously-buffered backend data upstream on the * secure socket using OpenSSL */ static void ssl_write(struct ev_loop *loop, ev_io *w, int revents) { (void)revents; int t; int sz; proxystate *ps; CAST_OBJ_NOTNULL(ps, w->data, PROXYSTATE_MAGIC); assert(!ringbuffer_is_empty(&ps->ring_clear2ssl)); char *next = ringbuffer_read_next(&ps->ring_clear2ssl, &sz); t = SSL_write(ps->ssl, next, sz); if (t > 0) { if (t == sz) { ringbuffer_read_pop(&ps->ring_clear2ssl); if (ps->clear_connected) // can be re-enabled b/c we've popped safe_enable_io(ps, &ps->ev_r_clear); if (ringbuffer_is_empty(&ps->ring_clear2ssl)) { if (ps->want_shutdown) { shutdown_proxy(ps, SHUTDOWN_HARD); return; } ev_io_stop(loop, &ps->ev_w_ssl); } } else { ringbuffer_read_skip(&ps->ring_clear2ssl, t); } } else { int err = SSL_get_error(ps->ssl, t); if (err == SSL_ERROR_WANT_READ) { start_handshake(ps, err); } else if (err == SSL_ERROR_WANT_WRITE) { /* NOOP. Incomplete SSL data */ } else { if (err == SSL_ERROR_SSL) { log_ssl_error(ps, "SSL_write error"); } else { LOG("{%s} SSL_write error: %d\n", w->fd == ps->fd_up ? "client" : "backend", err); } handle_fatal_ssl_error(ps, err, w->fd == ps->fd_up ? 0 : 1); } } } /* libev read handler for the bound sockets. Socket is accepted, * the proxystate is allocated and initalized, and we're off the races * connecting to the backend */ static void handle_accept(struct ev_loop *loop, ev_io *w, int revents) { (void)revents; (void)loop; struct sockaddr_storage addr; sslctx *so; proxystate *ps; socklen_t sl = sizeof(addr); #if HAVE_ACCEPT4==1 int client = accept4(w->fd, (struct sockaddr *) &addr, &sl, SOCK_NONBLOCK); #else int client = accept(w->fd, (struct sockaddr *) &addr, &sl); #endif if (client == -1) { switch (errno) { case EMFILE: ERR("{client} accept() failed; " "too many open files for this process\n"); break; case ENFILE: ERR("{client} accept() failed; " "too many open files for this system\n"); break; default: if (errno != EINTR && errno != EWOULDBLOCK && errno != EAGAIN && errno != ENOTTY && errno != ECONNABORTED) { SOCKERR("{client} accept() failed"); } } return; } int flag = 1; int ret = setsockopt(client, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(flag) ); if (ret == -1) { SOCKERR("Couldn't setsockopt on client (TCP_NODELAY)"); } #ifdef TCP_CWND int cwnd = 10; ret = setsockopt(client, IPPROTO_TCP, TCP_CWND, &cwnd, sizeof(cwnd)); if (ret == -1) { SOCKERR("Couldn't setsockopt on client (TCP_CWND)"); } #endif #if HAVE_ACCEPT4==0 if (setnonblocking(client) < 0) { SOCKERR("{client} setnonblocking failed"); (void) close(client); return; } #endif settcpkeepalive(client); int back = create_back_socket(); if (back == -1) { (void) close(client); ERR("{backend-socket}: %s\n", strerror(errno)); return; } CAST_OBJ_NOTNULL(so, w->data, SSLCTX_MAGIC); SSL *ssl = SSL_new(so->ctx); long mode = SSL_MODE_ENABLE_PARTIAL_WRITE; #ifdef SSL_MODE_RELEASE_BUFFERS mode |= SSL_MODE_RELEASE_BUFFERS; #endif SSL_set_mode(ssl, mode); SSL_set_accept_state(ssl); SSL_set_fd(ssl, client); ALLOC_OBJ(ps, PROXYSTATE_MAGIC); ps->fd_up = client; ps->fd_down = back; ps->ssl = ssl; ps->want_shutdown = 0; ps->clear_connected = 0; ps->handshaked = 0; ps->renegotiation = 0; ps->remote_ip = addr; ps->connect_port = 0; ringbuffer_init(&ps->ring_clear2ssl, CONFIG->RING_SLOTS, CONFIG->RING_DATA_LEN); ringbuffer_init(&ps->ring_ssl2clear, CONFIG->RING_SLOTS, CONFIG->RING_DATA_LEN); /* set up events */ ev_io_init(&ps->ev_r_ssl, ssl_read, client, EV_READ); ev_io_init(&ps->ev_w_ssl, ssl_write, client, EV_WRITE); ev_io_init(&ps->ev_r_handshake, client_handshake, client, EV_READ); ev_io_init(&ps->ev_w_handshake, client_handshake, client, EV_WRITE); ev_timer_init(&ps->ev_t_handshake, handshake_timeout, CONFIG->SSL_HANDSHAKE_TIMEOUT, 0.); ev_io_init(&ps->ev_proxy, client_proxy_proxy, client, EV_READ); ev_io_init(&ps->ev_w_connect, handle_connect, back, EV_WRITE); ev_timer_init(&ps->ev_t_connect, connect_timeout, CONFIG->BACKEND_CONNECT_TIMEOUT, 0.); ev_io_init(&ps->ev_w_clear, clear_write, back, EV_WRITE); ev_io_init(&ps->ev_r_clear, clear_read, back, EV_READ); ps->ev_r_ssl.data = ps; ps->ev_w_ssl.data = ps; ps->ev_r_clear.data = ps; ps->ev_w_clear.data = ps; ps->ev_proxy.data = ps; ps->ev_w_connect.data = ps; ps->ev_t_connect.data = ps; ps->ev_r_handshake.data = ps; ps->ev_w_handshake.data = ps; ps->ev_t_handshake.data = ps; /* Link back proxystate to SSL state */ SSL_set_app_data(ssl, ps); n_conns++; LOGPROXY(ps, "proxy connect\n"); if (CONFIG->PROXY_PROXY_LINE) { ev_io_start(loop, &ps->ev_proxy); } else { /* for client-first handshake */ start_handshake(ps, SSL_ERROR_WANT_READ); } } static void check_ppid(struct ev_loop *loop, ev_timer *w, int revents) { struct listen_sock *ls; (void)revents; pid_t ppid = getppid(); if (ppid != master_pid) { ERR("{core} Process %d detected parent death, " "closing listener sockets.\n", core_id); ev_timer_stop(loop, w); VTAILQ_FOREACH(ls, &listen_socks, list) { CHECK_OBJ_NOTNULL(ls, LISTEN_SOCK_MAGIC); ev_io_stop(loop, &ls->listener); close(ls->sock); } } } static void handle_mgt_rd(struct ev_loop *loop, ev_io *w, int revents) { unsigned cg; ssize_t r; struct listen_sock *ls; (void) revents; r = read(w->fd, &cg, sizeof(cg)); if (r == -1) { if (errno == EWOULDBLOCK || errno == EAGAIN) return; SOCKERR("Error in mgt->child read operation. " "Restarting process."); /* If something went wrong here, the process will be * left in utter limbo as to whether it should keep * running or not. Kill the process and let the mgt * process start it back up. */ _exit(1); } else if (r == 0) { /* Parent died .. */ _exit(1); } if (cg != child_gen) { /* This means this process has reached its retirement age. */ child_state = CHILD_EXITING; /* Stop accepting new connections. */ VTAILQ_FOREACH(ls, &listen_socks, list) { CHECK_OBJ_NOTNULL(ls, LISTEN_SOCK_MAGIC); ev_io_stop(loop, &ls->listener); close(ls->sock); } check_exit_state(); } LOGL("Child %d (gen: %d): State %s\n", core_id, child_gen, (child_state == CHILD_EXITING) ? "EXITING" : "ACTIVE"); } static void handle_clear_accept(struct ev_loop *loop, ev_io *w, int revents) { (void)revents; (void)loop; struct sockaddr_storage addr; sslctx *so; proxystate *ps; socklen_t sl = sizeof(addr); int client = accept(w->fd, (struct sockaddr *) &addr, &sl); if (client == -1) { switch (errno) { case EMFILE: ERR("{client} accept() failed; " "too many open files for this process\n"); break; case ENFILE: ERR("{client} accept() failed; " "too many open files for this system\n"); break; default: if (errno != EINTR && errno != EWOULDBLOCK && errno != EAGAIN && errno != ECONNABORTED) { SOCKERR("{client} accept() failed"); } break; } return; } int flag = 1; int ret = setsockopt(client, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(flag) ); if (ret == -1) { ERR("Couldn't setsockopt on client (TCP_NODELAY): %s\n", strerror(errno)); } #ifdef TCP_CWND int cwnd = 10; ret = setsockopt(client, IPPROTO_TCP, TCP_CWND, &cwnd, sizeof(cwnd)); if (ret == -1) { ERR("Couldn't setsockopt on client (TCP_CWND): %s\n", strerror(errno)); } #endif if (setnonblocking(client)) { SOCKERR("{client} setnonblocking failed"); (void) close(client); return; } settcpkeepalive(client); int back = create_back_socket(); if (back == -1) { close(client); ERR("{backend-socket}: %s\n", strerror(errno)); return; } CAST_OBJ_NOTNULL(so, w->data, SSLCTX_MAGIC); SSL *ssl = SSL_new(so->ctx); long mode = SSL_MODE_ENABLE_PARTIAL_WRITE; #ifdef SSL_MODE_RELEASE_BUFFERS mode |= SSL_MODE_RELEASE_BUFFERS; #endif SSL_set_mode(ssl, mode); SSL_set_connect_state(ssl); SSL_set_fd(ssl, back); if (client_session) SSL_set_session(ssl, client_session); ALLOC_OBJ(ps, PROXYSTATE_MAGIC); ps->fd_up = client; ps->fd_down = back; ps->ssl = ssl; ps->want_shutdown = 0; ps->clear_connected = 1; ps->handshaked = 0; ps->renegotiation = 0; ps->remote_ip = addr; ringbuffer_init(&ps->ring_clear2ssl, CONFIG->RING_SLOTS, CONFIG->RING_DATA_LEN); ringbuffer_init(&ps->ring_ssl2clear, CONFIG->RING_SLOTS, CONFIG->RING_DATA_LEN); /* set up events */ ev_io_init(&ps->ev_r_clear, clear_read, client, EV_READ); ev_io_init(&ps->ev_w_clear, clear_write, client, EV_WRITE); ev_io_init(&ps->ev_w_connect, handle_connect, back, EV_WRITE); ev_timer_init(&ps->ev_t_connect, connect_timeout, CONFIG->BACKEND_CONNECT_TIMEOUT, 0.); ev_io_init(&ps->ev_r_handshake, client_handshake, back, EV_READ); ev_io_init(&ps->ev_w_handshake, client_handshake, back, EV_WRITE); ev_timer_init(&ps->ev_t_handshake, handshake_timeout, CONFIG->SSL_HANDSHAKE_TIMEOUT, 0.); ev_io_init(&ps->ev_w_ssl, ssl_write, back, EV_WRITE); ev_io_init(&ps->ev_r_ssl, ssl_read, back, EV_READ); ps->ev_r_ssl.data = ps; ps->ev_w_ssl.data = ps; ps->ev_r_clear.data = ps; ps->ev_w_clear.data = ps; ps->ev_w_connect.data = ps; ps->ev_r_handshake.data = ps; ps->ev_w_handshake.data = ps; ps->ev_t_handshake.data = ps; /* Link back proxystate to SSL state */ SSL_set_app_data(ssl, ps); n_conns++; ev_io_start(loop, &ps->ev_r_clear); start_connect(ps); /* start connect */ } /* Set up the child (worker) process including libev event loop, read event * on the bound sockets, etc */ static void handle_connections(int mgt_fd) { struct listen_sock *ls; struct sigaction sa; child_state = CHILD_ACTIVE; LOGL("{core} Process %d online\n", core_id); /* child cannot create new children... */ create_workers = 0; /* nor can they handle SIGHUP */ sa.sa_flags = 0; sa.sa_handler = SIG_IGN; sigemptyset(&sa.sa_mask); AZ(sigaction(SIGHUP, &sa, NULL)); #if defined(CPU_ZERO) && defined(CPU_SET) cpu_set_t cpus; CPU_ZERO(&cpus); CPU_SET(core_id, &cpus); int res = sched_setaffinity(0, sizeof(cpus), &cpus); if (!res) LOG("{core} Successfully attached to CPU #%d\n", core_id); else ERR("{core-warning} Unable to attach to CPU #%d; " "do you have that many cores?\n", core_id); #endif loop = ev_default_loop(EVFLAG_AUTO); ev_timer timer_ppid_check; ev_timer_init(&timer_ppid_check, check_ppid, 1.0, 1.0); ev_timer_start(loop, &timer_ppid_check); VTAILQ_FOREACH(ls, &listen_socks, list) { ev_io_init(&ls->listener, (CONFIG->PMODE == SSL_CLIENT) ? handle_clear_accept : handle_accept, ls->sock, EV_READ); if (ls->sctx) ls->listener.data = ls->sctx; else ls->listener.data = default_ctx; ev_io_start(loop, &ls->listener); } AZ(setnonblocking(mgt_fd)); ev_io_init(&mgt_rd, handle_mgt_rd, mgt_fd, EV_READ); ev_io_start(loop, &mgt_rd); ev_loop(loop, 0); ERR("Child %d (gen: %d) exiting.\n", core_id, child_gen); _exit(1); } void change_root() { if (chroot(CONFIG->CHROOT) == -1) fail("chroot"); if (chdir("/")) fail("chdir"); } void drop_privileges(void) { if (geteuid() == 0) { if (CONFIG->UID >= 0) AZ(setgroups(0, NULL)); if (CONFIG->GID >= 0) AZ(setgid(CONFIG->GID)); if (CONFIG->UID >= 0) AZ(setuid(CONFIG->UID)); } else { LOG("{core} Not running as root, no priv-sep\n"); } /* On Linux >= 2.4, you need to set the dumpable flag to get core dumps after you have done a setuid. */ #ifdef __linux__ if (prctl(PR_SET_DUMPABLE, 1) != 0) LOG("Could not set dumpable bit. Core dumps turned off\n"); #endif } void init_globals(void) { /* backaddr */ struct addrinfo hints; VTAILQ_INIT(&listen_socks); VTAILQ_INIT(&child_procs); memset(&hints, 0, sizeof hints); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = 0; const int gai_err = getaddrinfo(CONFIG->BACK_IP, CONFIG->BACK_PORT, &hints, &backaddr); if (gai_err != 0) { ERR("{getaddrinfo}: [%s]", gai_strerror(gai_err)); exit(1); } #ifdef USE_SHARED_CACHE if (CONFIG->SHARED_CACHE) { /* cache update peers addresses */ shcupd_peer_opt *spo = CONFIG->SHCUPD_PEERS; struct addrinfo **pai = shcupd_peers; while (spo->ip) { memset(&hints, 0, sizeof hints); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; hints.ai_flags = 0; const int gai_err = getaddrinfo(spo->ip, spo->port ? spo->port : CONFIG->SHCUPD_PORT, &hints, pai); if (gai_err != 0) { ERR("{getaddrinfo}: [%s]", gai_strerror(gai_err)); exit(1); } spo++; pai++; } } #endif if (CONFIG->SYSLOG) openlog("hitch", LOG_CONS | LOG_PID | LOG_NDELAY, CONFIG->SYSLOG_FACILITY); } /* Forks COUNT children starting with START_INDEX. We keep a struct * child_proc per child so the parent can manage it later. */ void start_children(int start_index, int count) { struct child_proc *c; int pfd[2]; /* don't do anything if we're not allowed to create new children */ if (!create_workers) return; for (core_id = start_index; core_id < start_index + count; core_id++) { ALLOC_OBJ(c, CHILD_PROC_MAGIC); AZ(pipe(pfd)); c->pfd = pfd[1]; c->gen = child_gen; c->pid = fork(); c->core_id = core_id; if (c->pid == -1) { ERR("{core} fork() failed: %s; Goodbye cruel world!\n", strerror(errno)); exit(1); } else if (c->pid == 0) { /* child */ close(pfd[1]); FREE_OBJ(c); if (CONFIG->UID >= 0 || CONFIG->GID >= 0) drop_privileges(); if (geteuid() == 0) { ERR("{core} ERROR: " "Refusing to run workers as root.\n"); _exit(1); } handle_connections(pfd[0]); exit(0); } else { /* parent. Track new child. */ close(pfd[0]); VTAILQ_INSERT_TAIL(&child_procs, c, list); } } } /* Forks a new child to replace the old, dead, one with the given PID.*/ void replace_child_with_pid(pid_t pid) { struct child_proc *c, *cp; /* find old child's slot and put a new child there */ VTAILQ_FOREACH_SAFE(c, &child_procs, list, cp) { if (c->pid == pid) { VTAILQ_REMOVE(&child_procs, c, list); /* Only replace if it matches current generation. */ if (c->gen == child_gen) start_children(c->core_id, 1); FREE_OBJ(c); return; } } ERR("Cannot find index for child pid %d", pid); } /* Manage status changes in child processes */ static void do_wait(void) { struct child_proc *c, *ctmp; int status; int pid; VTAILQ_FOREACH_SAFE(c, &child_procs, list, ctmp) { pid = waitpid(c->pid, &status, WNOHANG); if (pid == 0) { /* child has not exited */ continue; } else if (pid == -1) { if (errno == EINTR) ERR("{core} Interrupted waitpid\n"); else fail("waitpid"); } else { if (WIFEXITED(status)) { ERR("{core} Child %d exited with status %d.\n", pid, WEXITSTATUS(status)); replace_child_with_pid(pid); } else if (WIFSIGNALED(status)) { ERR("{core} Child %d was terminated by " "signal %d.\n", pid, WTERMSIG(status)); replace_child_with_pid(pid); } } } } static void sigchld_handler(int signum) { assert(signum == SIGCHLD); n_sigchld++; } static void sigh_terminate (int __attribute__ ((unused)) signo) { struct child_proc *c; /* don't create any more children */ create_workers = 0; /* are we the master? */ if (getpid() == master_pid) { LOGL("{core} Received signal %d, shutting down.\n", signo); /* kill all children */ VTAILQ_FOREACH(c, &child_procs, list) { /* LOG("Stopping worker pid %d.\n", c->pid); */ if (c->pid > 1 && kill(c->pid, SIGTERM) != 0) { ERR("{core} Unable to send SIGTERM to worker " "pid %d: %s\n", c->pid, strerror(errno)); } } /* LOG("Shutdown complete.\n"); */ } /* this is it, we're done... */ exit(0); } static void sighup_handler(int signum) { assert(signum == SIGHUP); n_sighup++; } static void init_signals() { struct sigaction act; sigemptyset(&act.sa_mask); act.sa_flags = 0; act.sa_handler = SIG_IGN; /* Avoid getting PIPE signal when writing to a closed file descriptor */ if (sigaction(SIGPIPE, &act, NULL) < 0) fail("sigaction - sigpipe"); /* We don't care if someone stops and starts a child process * with kill (1) */ act.sa_flags = SA_NOCLDSTOP; act.sa_handler = sigchld_handler; /* We do care when child processes change status */ if (sigaction(SIGCHLD, &act, NULL) < 0) fail("sigaction - sigchld"); /* catch INT and TERM signals */ act.sa_flags = 0; act.sa_handler = sigh_terminate; if (sigaction(SIGINT, &act, NULL) < 0) { ERR("Unable to register SIGINT signal handler: %s\n", strerror(errno)); exit(1); } if (sigaction(SIGTERM, &act, NULL) < 0) { ERR("Unable to register SIGTERM signal handler: %s\n", strerror(errno)); exit(1); } act.sa_handler = sighup_handler; if (sigaction(SIGHUP, &act, NULL) != 0) { ERR("Unable to register SIGHUP signal handler: %s\n", strerror(errno)); exit(1); } } static void daemonize() { if (logf == stdout || logf == stderr) { logf = NULL; } /* go to root directory */ if (chdir("/") != 0) { ERR("Unable change directory to /: %s\n", strerror(errno)); exit(1); } /* let's make some children, baby :) */ pid_t pid = fork(); if (pid < 0) { ERR("Unable to daemonize: fork failed: %s\n", strerror(errno)); exit(1); } /* am i the parent? */ if (pid != 0) { LOGL("{core} Daemonized as pid %d.\n", pid); exit(0); } /* reopen standard streams to null device */ if (freopen(NULL_DEV, "r", stdin) == NULL) { ERR("Unable to reopen stdin to %s: %s\n", NULL_DEV, strerror(errno)); exit(1); } if (freopen(NULL_DEV, "w", stdout) == NULL) { ERR("Unable to reopen stdout to %s: %s\n", NULL_DEV, strerror(errno)); exit(1); } if (freopen(NULL_DEV, "w", stderr) == NULL) { ERR("Unable to reopen stderr to %s: %s\n", NULL_DEV, strerror(errno)); exit(1); } /* this is child, the new master */ pid_t s = setsid(); if (s < 0) { ERR("Unable to create new session, setsid(2) failed: " "%s :: %d\n", strerror(errno), s); exit(1); } LOG("Successfully daemonized as pid %d.\n", getpid()); } static void openssl_check_version() { /* detect OpenSSL version in runtime */ long openssl_version = SSLeay(); /* check if we're running the same openssl that we were */ /* compiled with */ if ((openssl_version ^ OPENSSL_VERSION_NUMBER) & ~0xff0L) { ERR( "WARNING: {core} OpenSSL version mismatch; " "hitch was compiled with %lx, now using %lx.\n", (unsigned long int)OPENSSL_VERSION_NUMBER, (unsigned long int)openssl_version ); /* now what? exit now? */ /* exit(1); */ } LOG("{core} Using OpenSSL version %lx.\n", (unsigned long int)openssl_version); } static void remove_pfh(void) { if (pfh && master_pid == getpid()) { VPF_Remove(pfh); } } struct cfg_tpc_obj; enum cfg_tpc_type { CFG_LISTEN_ADDR, CFG_CERT /* ... */ }; /* Commit/rollback handling: - KEEP: - commit: reuse - rollback: do nothing - NEW: - commit: use as new - rollback: drop - DROP: - commit: drop - rollback: do nothing */ enum cfg_tpc_handling { CFG_TPC_KEEP, CFG_TPC_NEW, CFG_TPC_DROP }; typedef void cfg_tpc_rollback_f(struct cfg_tpc_obj *o); typedef void cfg_tpc_commit_f(struct cfg_tpc_obj *o); struct cfg_tpc_obj { unsigned magic; #define CFG_TPC_OBJ_MAGIC 0xd6953e5f enum cfg_tpc_type type; enum cfg_tpc_handling handling; void *p[2]; cfg_tpc_rollback_f *rollback; cfg_tpc_commit_f *commit; VTAILQ_ENTRY(cfg_tpc_obj) list; }; VTAILQ_HEAD(cfg_tpc_obj_head, cfg_tpc_obj); static struct cfg_tpc_obj * make_cfg_obj(enum cfg_tpc_type type, enum cfg_tpc_handling handling, void *priv, cfg_tpc_rollback_f *rollback, cfg_tpc_commit_f *commit) { struct cfg_tpc_obj *o; ALLOC_OBJ(o, CFG_TPC_OBJ_MAGIC); AN(o); o->type = type; o->handling = handling; o->p[0] = priv; o->rollback = rollback; o->commit = commit; return (o); } static void ls_rollback(struct cfg_tpc_obj *o) { struct listen_sock *ls; if (o->handling == CFG_TPC_NEW) { CAST_OBJ_NOTNULL(ls, o->p[0], LISTEN_SOCK_MAGIC); destroy_listen_sock(ls); } /* KEEP/DROP: ignore */ } static void ls_commit(struct cfg_tpc_obj *o) { struct listen_sock *ls; sslctx *sc; CAST_OBJ_NOTNULL(ls, o->p[0], LISTEN_SOCK_MAGIC); switch (o->handling) { case CFG_TPC_NEW: VTAILQ_INSERT_TAIL(&listen_socks, ls, list); /* FALL-THROUGH */ case CFG_TPC_KEEP: if (o->p[1]) { CAST_OBJ_NOTNULL(sc, o->p[1], SSLCTX_MAGIC); ls->sctx = sc; } break; case CFG_TPC_DROP: VTAILQ_REMOVE(&listen_socks, ls, list); destroy_listen_sock(ls); break; } } /* Query reload of listen sockets. Returns -1 on failure. Failure: Caller calls .rollback() on the objects added in cfg_objs. Success: Caller calls .commit() */ static int ls_query(struct front_arg *new_set, struct cfg_tpc_obj_head *cfg_objs) { struct listen_sock *ls, *lstmp; struct front_arg *fa, *ftmp; struct cfg_tpc_obj *o; struct listen_sock_head lsocks; int n; VTAILQ_INIT(&lsocks); VTAILQ_FOREACH(ls, &listen_socks, list) { HASH_FIND_STR(new_set, ls->pspec, fa); if (fa != NULL) { fa->mark = 1; o = make_cfg_obj(CFG_LISTEN_ADDR, CFG_TPC_KEEP, ls, ls_rollback, ls_commit); } else o = make_cfg_obj(CFG_LISTEN_ADDR, CFG_TPC_DROP, ls, ls_rollback, ls_commit); VTAILQ_INSERT_TAIL(cfg_objs, o, list); } HASH_ITER(hh, new_set, fa, ftmp) { if (!fa->mark) { n = create_listen_sock(fa, &lsocks); if (n <= 0) return (-1); VTAILQ_FOREACH_SAFE(ls, &lsocks, list, lstmp) { VTAILQ_REMOVE(&lsocks, ls, list); o = make_cfg_obj(CFG_LISTEN_ADDR, CFG_TPC_NEW, ls, ls_rollback, ls_commit); VTAILQ_INSERT_TAIL(cfg_objs, o, list); } } } return (0); } static void cert_rollback(struct cfg_tpc_obj *o) { sslctx *sc; if (o->handling != CFG_TPC_NEW) return; CAST_OBJ_NOTNULL(sc, o->p[0], SSLCTX_MAGIC); sctx_free(sc, NULL); } static void cert_commit(struct cfg_tpc_obj *o) { sslctx *sc; CAST_OBJ_NOTNULL(sc, o->p[0], SSLCTX_MAGIC); switch (o->handling) { case CFG_TPC_NEW: HASH_ADD_KEYPTR(hh, ssl_ctxs, sc->filename, strlen(sc->filename), sc); insert_sni_names(sc); break; case CFG_TPC_KEEP: WRONG("unreachable"); break; case CFG_TPC_DROP: HASH_DEL(ssl_ctxs, sc); sctx_free(sc, &sni_names); break; } } static void dcert_rollback(struct cfg_tpc_obj *o) { cert_rollback(o); } static void dcert_commit(struct cfg_tpc_obj *o) { sslctx *sc; CAST_OBJ_NOTNULL(sc, o->p[0], SSLCTX_MAGIC); CHECK_OBJ_NOTNULL(sni_names, SNI_NAME_MAGIC); switch (o->handling) { case CFG_TPC_NEW: sctx_free(default_ctx, &sni_names); default_ctx = sc; insert_sni_names(sc); break; case CFG_TPC_KEEP: /* FALL-THROUGH */ case CFG_TPC_DROP: /* We always have a default cert. This should not * happen. */ WRONG("unreachable"); break; } } /* Query reload of certificate files */ static int cert_query(hitch_config *cfg, struct cfg_tpc_obj_head *cfg_objs) { struct cfg_cert_file *cf, *cftmp; sslctx *sc, *sctmp; struct cfg_tpc_obj *o, *otmp; struct listen_sock *ls; /* NB: The ordering here is significant. It is imperative that * all DROP objects are inserted before any NEW objects, in * order to not wreak havoc in cert_commit(). */ HASH_ITER(hh, ssl_ctxs, sc, sctmp) { HASH_FIND_STR(cfg->CERT_FILES, sc->filename, cf); if (cf != NULL && cf->mtim <= sc->mtim) { cf->mark = 1; cf->priv = sc; } else { o = make_cfg_obj(CFG_CERT, CFG_TPC_DROP, sc, cert_rollback, cert_commit); VTAILQ_INSERT_TAIL(cfg_objs, o, list); } } /* handle default cert. Default cert has its own * rollback/commit functions. */ AN(cfg->CERT_DEFAULT); cf = cfg->CERT_DEFAULT; CHECK_OBJ_NOTNULL(default_ctx, SSLCTX_MAGIC); if (strcmp(default_ctx->filename, cf->filename) != 0 || cf->mtim > default_ctx->mtim) { sc = make_ctx(cf); if (sc == NULL) return (-1); if (load_cert_ctx(sc) != 0) { sctx_free(sc, NULL); return (-1); } o = make_cfg_obj(CFG_CERT, CFG_TPC_NEW, sc, dcert_rollback, dcert_commit); VTAILQ_INSERT_TAIL(cfg_objs, o, list); } HASH_ITER(hh, cfg->CERT_FILES, cf, cftmp) { if (cf->mark) continue; sc = make_ctx(cf); if (sc == NULL) return (-1); if (load_cert_ctx(sc) != 0) { sctx_free(sc, NULL); return (-1); } cf->priv = sc; o = make_cfg_obj(CFG_CERT, CFG_TPC_NEW, sc, cert_rollback, cert_commit); VTAILQ_INSERT_TAIL(cfg_objs, o, list); } /* This is a little hacky, but we need to also initialize any * new certs specific to the already queried listen * endpoints. */ VTAILQ_FOREACH(o, cfg_objs, list) { if (o->type != CFG_LISTEN_ADDR) break; if (o->handling == CFG_TPC_DROP) continue; CAST_OBJ_NOTNULL(ls, o->p[0], LISTEN_SOCK_MAGIC); if (ls->cert == NULL) continue; CHECK_OBJ_NOTNULL(ls->cert, CFG_CERT_FILE_MAGIC); HASH_FIND_STR(cfg->CERT_FILES, ls->cert->filename, cf); if (cf != NULL) { CAST_OBJ_NOTNULL(sc, cf->priv, SSLCTX_MAGIC); } else { sc = make_ctx(ls->cert); if (sc == NULL) return (-1); if (load_cert_ctx(sc) != 0) { sctx_free(sc, NULL); return (-1); } otmp = make_cfg_obj(CFG_CERT, CFG_TPC_NEW, sc, cert_rollback, cert_commit); VTAILQ_INSERT_TAIL(cfg_objs, otmp, list); } o->p[1] = sc; } return (0); } static void reconfigure(int argc, char **argv) { struct child_proc *c; hitch_config *cfg_new; int i, rv; struct cfg_tpc_obj_head cfg_objs; struct cfg_tpc_obj *cto, *cto_tmp; struct timeval tv; double t0, t1; LOGL("Received SIGHUP: Initiating configuration reload.\n"); AZ(gettimeofday(&tv, NULL)); t0 = tv.tv_sec + 1e-6 * tv.tv_usec; VTAILQ_INIT(&cfg_objs); cfg_new = config_new(); AN(cfg_new); if (config_parse_cli(argc, argv, cfg_new, &rv) != 0) { ERR("Config reload failed: %s\n", config_error_get()); config_destroy(cfg_new); return; } /* NB: the ordering of the foo_query() calls here is * significant. */ if (ls_query(cfg_new->LISTEN_ARGS, &cfg_objs) < 0 || cert_query(cfg_new, &cfg_objs) < 0) { VTAILQ_FOREACH_SAFE(cto, &cfg_objs, list, cto_tmp) { VTAILQ_REMOVE(&cfg_objs, cto, list); AN(cto->rollback); cto->rollback(cto); FREE_OBJ(cto); } ERR("{core} Config reload failed.\n"); return; } else { VTAILQ_FOREACH_SAFE(cto, &cfg_objs, list, cto_tmp) { VTAILQ_REMOVE(&cfg_objs, cto, list); AN(cto->commit); cto->commit(cto); FREE_OBJ(cto); } } AZ(gettimeofday(&tv, NULL)); t1 = tv.tv_sec + 1e-6 * tv.tv_usec; LOGL("{core} Config reloaded in %.2lf seconds. " "Starting new child processes.\n", t1 - t0); child_gen++; start_children(0, CONFIG->NCORES); VTAILQ_FOREACH(c, &child_procs, list) { if (c->gen != child_gen) { errno = 0; do { i = write(c->pfd, &child_gen, sizeof(child_gen)); if (i == -1 && errno != EINTR) { ERR("WARNING: {core} Unable to " "gracefully reload child %d" " (%s).\n", c->pid, strerror(errno)); (void)kill(c->pid, SIGTERM); break; } } while (i == -1 && errno == EINTR); } } config_destroy(CONFIG); CONFIG = cfg_new; } /* Process command line args, create the bound socket, * spawn child (worker) processes, and respawn if any die */ int main(int argc, char **argv) { // initialize configuration struct front_arg *fa, *ftmp; int rv; CONFIG = config_new(); // parse command line if (config_parse_cli(argc, argv, CONFIG, &rv) != 0) { fprintf(stderr, "%s", config_error_get()); return (rv); } if (CONFIG->TEST) { fprintf(stderr, "Trying to initialize SSL contexts with your" " certificates\n"); init_globals(); init_openssl(); fprintf(stderr, "%s configuration looks ok.\n", basename(argv[0])); return (0); } if (CONFIG->LOG_FILENAME) { FILE* f; if ((f = fopen(CONFIG->LOG_FILENAME, "a")) == NULL) { logf = stderr; ERR("FATAL: Unable to open log file: %s: %s\n", CONFIG->LOG_FILENAME, strerror(errno)); exit(2); } logf = f; if (CONFIG->UID >=0 || CONFIG->GID >= 0) { AZ(fchown(fileno(logf), CONFIG->UID, CONFIG->GID)); } AZ(fstat(fileno(logf), &logf_st)); logf_check_t = time(NULL); } else { logf = CONFIG->QUIET ? stderr : stdout; } AZ(setvbuf(logf, NULL, _IONBF, BUFSIZ)); if (CONFIG->DAEMONIZE && (logf == stdout || logf == stderr)) logf = NULL; LOGL("{core} %s starting\n", PACKAGE_STRING); create_workers = 1; openssl_check_version(); init_signals(); init_globals(); HASH_ITER(hh, CONFIG->LISTEN_ARGS, fa, ftmp) { int c = create_listen_sock(fa, &listen_socks); if (c <= 0) exit(1); nlisten_socks += c; } #ifdef USE_SHARED_CACHE if (CONFIG->SHCUPD_PORT) { /* create socket to send(children) and receive(parent) cache updates */ shcupd_socket = create_shcupd_socket(); } #endif /* USE_SHARED_CACHE */ /* load certificates, pass to handle_connections */ LOGL("{core} Loading certificate pem files (%d)\n", HASH_COUNT(CONFIG->CERT_FILES) + 1); init_openssl(); if (CONFIG->CHROOT && CONFIG->CHROOT[0]) change_root(); if (geteuid() == 0 && CONFIG->UID < 0) { ERR("{core} ERROR: Refusing to run workers as root.\n"); exit(1); } if (CONFIG->DAEMONIZE) daemonize(); master_pid = getpid(); if (CONFIG->PIDFILE) { pfh = VPF_Open(CONFIG->PIDFILE, 0644, NULL); if (pfh == NULL) { ERR("FATAL: Could not open pid (-p) file (%s): %s\n", CONFIG->PIDFILE, strerror(errno)); exit(1); } AZ(VPF_Write(pfh)); atexit(remove_pfh); } start_children(0, CONFIG->NCORES); #ifdef USE_SHARED_CACHE if (CONFIG->SHCUPD_PORT) { /* start event loop to receive cache updates */ loop = ev_default_loop(EVFLAG_AUTO); ev_io_init(&shcupd_listener, handle_shcupd, shcupd_socket, EV_READ); ev_io_start(loop, &shcupd_listener); ev_loop(loop, 0); } #endif /* USE_SHARED_CACHE */ LOGL("{core} %s initialization complete\n", PACKAGE_STRING); for (;;) { /* Sleep and let the children work. * Parent will be woken up if a signal arrives */ pause(); while (n_sighup != 0) { n_sighup = 0; reconfigure(argc, argv); } while (n_sigchld != 0) { n_sigchld = 0; do_wait(); } } exit(0); /* just a formality; we never get here */ } hitch-1.1.1/src/configuration.c0000644000175000017500000007620512644705174013360 00000000000000/** * configuration.c * * Original author: Brane F. Gracnar */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "config.h" #include "miniobj.h" #include "configuration.h" #include "vas.h" #define ADDR_LEN 150 #define PORT_LEN 6 #define CFG_BOOL_ON "on" // BEGIN: configuration parameters #define CFG_CIPHERS "ciphers" #define CFG_SSL_ENGINE "ssl-engine" #define CFG_PREFER_SERVER_CIPHERS "prefer-server-ciphers" #define CFG_BACKEND "backend" #define CFG_FRONTEND "frontend" #define CFG_WORKERS "workers" #define CFG_BACKLOG "backlog" #define CFG_KEEPALIVE "keepalive" #define CFG_CHROOT "chroot" #define CFG_USER "user" #define CFG_GROUP "group" #define CFG_QUIET "quiet" #define CFG_SYSLOG "syslog" #define CFG_SYSLOG_FACILITY "syslog-facility" #define CFG_PARAM_SYSLOG_FACILITY 11015 #define CFG_DAEMON "daemon" #define CFG_WRITE_IP "write-ip" #define CFG_WRITE_PROXY "write-proxy" #define CFG_WRITE_PROXY_V1 "write-proxy-v1" #define CFG_WRITE_PROXY_V2 "write-proxy-v2" #define CFG_PEM_FILE "pem-file" #define CFG_PROXY_PROXY "proxy-proxy" #define CFG_BACKEND_CONNECT_TIMEOUT "backend-connect-timeout" #define CFG_SSL_HANDSHAKE_TIMEOUT "ssl-handshake-timeout" #define CFG_RECV_BUFSIZE "recv-bufsize" #define CFG_SEND_BUFSIZE "send-bufsize" #define CFG_LOG_FILENAME "log-filename" #define CFG_RING_SLOTS "ring-slots" #define CFG_RING_DATA_LEN "ring-data-len" #define CFG_PIDFILE "pidfile" #define CFG_SNI_NOMATCH_ABORT "sni-nomatch-abort" #ifdef USE_SHARED_CACHE #define CFG_SHARED_CACHE "shared-cache" #define CFG_SHARED_CACHE_LISTEN "shared-cache-listen" #define CFG_SHARED_CACHE_PEER "shared-cache-peer" #define CFG_SHARED_CACHE_MCASTIF "shared-cache-if" #endif #define FMT_STR "%s = %s\n" #define FMT_QSTR "%s = \"%s\"\n" #define FMT_ISTR "%s = %d\n" #define CONFIG_BUF_SIZE 1024 #define CFG_PARAM_CFGFILE 10000 #define CFG_CONFIG "config" // END: configuration parameters static char error_buf[CONFIG_BUF_SIZE]; static char tmp_buf[150]; static void config_error_set(char *fmt, ...) { int len; char buf[CONFIG_BUF_SIZE] = ""; va_list args; va_start(args, fmt); len = vsnprintf(buf, (sizeof(buf) - 1), fmt, args); va_end(args); len += 1; if (len > CONFIG_BUF_SIZE) len = CONFIG_BUF_SIZE; memcpy(error_buf, buf, len); } char * config_error_get(void) { return error_buf; } hitch_config * config_new(void) { hitch_config *r; struct front_arg *fa; r = calloc(1, sizeof(hitch_config)); AN(r); // set default values r->ETYPE = ENC_TLS; r->PMODE = SSL_SERVER; r->WRITE_IP_OCTET = 0; r->WRITE_PROXY_LINE_V1= 0; r->WRITE_PROXY_LINE_V2= 0; r->PROXY_PROXY_LINE = 0; r->CHROOT = NULL; r->UID = -1; r->GID = -1; r->BACK_IP = strdup("127.0.0.1"); r->BACK_PORT = strdup("8000"); r->NCORES = 1; r->CIPHER_SUITE = NULL; r->ENGINE = NULL; r->BACKLOG = 100; r->SNI_NOMATCH_ABORT = 0; r->CERT_DEFAULT = NULL; r->CERT_FILES = NULL; r->LISTEN_ARGS = NULL; ALLOC_OBJ(fa, FRONT_ARG_MAGIC); fa->port = strdup("8443"); fa->pspec = strdup("default"); HASH_ADD_KEYPTR(hh, r->LISTEN_ARGS, fa->pspec, strlen(fa->pspec), fa); r->LISTEN_DEFAULT = fa; #ifdef USE_SHARED_CACHE r->SHARED_CACHE = 0; r->SHCUPD_IP = NULL; r->SHCUPD_PORT = NULL; for (int i = 0 ; i < MAX_SHCUPD_PEERS; i++) memset(&r->SHCUPD_PEERS[i], 0, sizeof(shcupd_peer_opt)); r->SHCUPD_MCASTIF = NULL; r->SHCUPD_MCASTTTL = NULL; #endif r->QUIET = 0; r->SYSLOG = 0; r->SYSLOG_FACILITY = LOG_DAEMON; r->TCP_KEEPALIVE_TIME = 3600; r->DAEMONIZE = 0; r->PREFER_SERVER_CIPHERS = 0; r->TEST = 0; r->BACKEND_CONNECT_TIMEOUT = 30; r->SSL_HANDSHAKE_TIMEOUT = 30; r->RECV_BUFSIZE = -1; r->SEND_BUFSIZE = -1; r->LOG_FILENAME = NULL; r->PIDFILE = NULL; r->RING_SLOTS = 0; r->RING_DATA_LEN = 0; return r; } void config_destroy(hitch_config *cfg) { // printf("config_destroy() in pid %d: %p\n", getpid(), cfg); struct front_arg *fa, *ftmp; struct cfg_cert_file *cf, *cftmp; if (cfg == NULL) return; // free all members! free(cfg->CHROOT); HASH_ITER(hh, cfg->LISTEN_ARGS, fa, ftmp) { CHECK_OBJ_NOTNULL(fa, FRONT_ARG_MAGIC); HASH_DEL(cfg->LISTEN_ARGS, fa); free(fa->ip); free(fa->port); free(fa->pspec); CHECK_OBJ_ORNULL(fa->cert, CFG_CERT_FILE_MAGIC); if (fa->cert != NULL) { fa->cert->ref--; if (fa->cert->ref == 0) { free(fa->cert->filename); FREE_OBJ(fa->cert); } } FREE_OBJ(fa); } free(cfg->BACK_IP); free(cfg->BACK_PORT); HASH_ITER(hh, cfg->CERT_FILES, cf, cftmp) { CHECK_OBJ_NOTNULL(cf, CFG_CERT_FILE_MAGIC); HASH_DEL(cfg->CERT_FILES, cf); free(cf->filename); FREE_OBJ(cf); } if (cfg->CERT_DEFAULT != NULL) { free(cfg->CERT_DEFAULT->filename); FREE_OBJ(cfg->CERT_DEFAULT); } free(cfg->CIPHER_SUITE); free(cfg->ENGINE); free(cfg->PIDFILE); #ifdef USE_SHARED_CACHE free(cfg->SHCUPD_IP); free(cfg->SHCUPD_PORT); for (int i = 0; i < MAX_SHCUPD_PEERS; i++) { free(cfg->SHCUPD_PEERS[i].ip); free(cfg->SHCUPD_PEERS[i].port); } free(cfg->SHCUPD_MCASTIF); free(cfg->SHCUPD_MCASTTTL); #endif free(cfg); } int config_parse_content(char *line, char **key, char **value) { assert(line != NULL); if (line[0] == '#') return 1; // NOOP if (strlen(line) < 1 || line[0] == '\n' || strcmp(line, "\r\n") == 0) return 1; while (*line != '\0' && isspace(*line)) line++; *key = line; while(*line != '\0' && (isalnum(*line) || *line == '-')) line++; if (*line == '\0' || *(line+1) == '\0') return -1; *line = '\0'; // key end. line++; while(*line != '\0' && (*line != '=')) line++; if (*line != '=') return -3; if (*line == '\0' || *(line+1) == '\0') return -1; line++; while(*line != '\0' && (isspace(*line) || *line == '"' || *line == '\'')) line++; if (*line == '\0') return -1; *value = line; while (*line != '\0' && *line != '"' && *line != '\'' && !isspace(*line)) line++; *line = '\0'; // value end. if (strlen(*key) <= 1 || strlen(*value) < 1) return -1; return(0); } char * config_assign_str(char **dst, char *v) { assert(v != NULL); if (strlen(v) <= 0) return(NULL); if (*dst != NULL) free(*dst); *dst = strdup(v); return *dst; } int config_param_val_bool(char *val, int *res) { assert(val != NULL); if (strcasecmp(val, CFG_BOOL_ON) == 0 || strcasecmp(val, "yes") == 0 || strcasecmp(val, "y") == 0 || strcasecmp(val, "true") == 0 || strcasecmp(val, "t") == 0 || strcasecmp(val, "1") == 0) { *res = 1; } return 1; } int config_param_host_port_wildcard(const char *str, char **addr, char **port, char **cert, int wildcard_okay) { const char *cert_ptr = NULL; if (str == NULL) { config_error_set("Invalid/unset host/port string."); return 0; } if (strlen(str) > ADDR_LEN) { config_error_set("Host address too long."); return 0; } // address/port buffers char port_buf[PORT_LEN]; char addr_buf[ADDR_LEN]; memset(port_buf, '\0', sizeof(port_buf)); memset(addr_buf, '\0', sizeof(addr_buf)); // NEW FORMAT: [address]:port if (*str == '[') { const char *ptr = str + 1; const char *x = strrchr(ptr, ']'); if (x == NULL) { config_error_set("Invalid address '%s'.", str); return 0; } // address if ((unsigned)(x - ptr) >= sizeof(addr_buf)) { config_error_set("Invalid address '%s'.", str); return 0; } strncpy(addr_buf, ptr, (x - ptr)); // port if (x[1] != ':' || x[2] == '\0') { config_error_set("Invalid port specifier in string '%s'.", str); return 0; } ptr = x + 2; x = strchr(ptr, '+'); if (x == NULL) memcpy(port_buf, ptr, sizeof(port_buf) - 1); else memcpy(port_buf, ptr, (x - ptr)); // cert if (cert && x) { cert_ptr = x + 1; } } // OLD FORMAT: address,port else { config_error_set("Invalid address string '%s'", str); return 0; } // printf("PARSED ADDR '%s', PORT '%s'\n", addr_buf, port_buf); int p = atoi(port_buf); if (p < 1 || p > 65536) { config_error_set("Invalid port number '%s'", port_buf); return 0; } if (strcmp(addr_buf, "*") == 0) { if (wildcard_okay) free(*addr); else { config_error_set("Invalid address: wildcards are not allowed."); return 0; } } else { *addr = strdup(addr_buf); } *port = strdup(port_buf); if (cert_ptr != NULL) *cert = strdup(cert_ptr); /* printf("ADDR FINAL: '%s', '%s', '%s'\n", *addr, *port, */ /* cert ? *cert : ""); */ return 1; } int config_param_host_port(char *str, char **addr, char **port) { return config_param_host_port_wildcard(str, addr, port, NULL, 0); } int config_param_val_int(char *str, int *dst, int positive_only) { int num; assert(str != NULL); num = atoi(str); if (positive_only && num < 0) { config_error_set("Not a positive number."); return 0; } *dst = num; return 1; } int config_param_val_long(char *str, long *dst, int positive_only) { long num; assert(str != NULL); num = atol(str); if (positive_only && num <= 0) { config_error_set("Not a positive number."); return 0; } *dst = num; return 1; } int config_param_pem_file(char *filename, struct cfg_cert_file **cfptr) { struct stat st; struct cfg_cert_file *cert; *cfptr = NULL; if (strlen(filename) <= 0) return (0); if (stat(filename, &st) != 0) { config_error_set("Unable to stat x509 " "certificate PEM file '%s': ", filename, strerror(errno)); return (0); } if (! S_ISREG(st.st_mode)) { config_error_set("Invalid x509 certificate " "PEM file '%s': Not a file.", filename); return (0); } ALLOC_OBJ(cert, CFG_CERT_FILE_MAGIC); AN(cert); config_assign_str(&cert->filename, filename); cert->mtim = st.st_mtim.tv_sec + st.st_mtim.tv_nsec * 1e-9; *cfptr = cert; cert->ref++; return (1); } #ifdef USE_SHARED_CACHE /* Parse mcast and ttl options */ int config_param_shcupd_mcastif(char *str, char **iface, char **ttl) { char buf[150]; char *sp; if (strlen(str) >= sizeof buf) { config_error_set("Invalid option for IFACE[,TTL]"); return 0; } sp = strchr(str, ','); if (!sp) { if (!strcmp(str, "*")) *iface = NULL; else *iface = str; *ttl = NULL; return 1; } else if (!strncmp(str, "*", sp - str)) { *iface = NULL; } else { *sp = 0; *iface = str; } *ttl = sp + 1; return 1; } int config_param_shcupd_peer(char *str, hitch_config *cfg) { if (cfg == NULL) { config_error_set("Configuration pointer is NULL."); return 0; } // parse result int r = 1; // find place for new peer int offset = 0; int i = 0; for (i = 0; i < MAX_SHCUPD_PEERS; i++) { if (cfg->SHCUPD_PEERS[i].ip == NULL && cfg->SHCUPD_PEERS[i].port == NULL) { offset = i; break; } } if (i >= MAX_SHCUPD_PEERS) { config_error_set( "Reached maximum number of shared cache update peers (%d).", MAX_SHCUPD_PEERS ); return 0; } // create place for new peer char *addr = malloc(ADDR_LEN); if (addr == NULL) { config_error_set( "Unable to allocate memory for new shared cache update peer address: %s", strerror(errno) ); r = 0; goto outta_parse_peer; } memset(addr, '\0', ADDR_LEN); char *port = malloc(PORT_LEN); if (port == NULL) { config_error_set( "Unable to allocate memory for new shared cache update peer port: %s", strerror(errno) ); r = 0; goto outta_parse_peer; } memset(port, '\0', PORT_LEN); // try to parse address if (! config_param_host_port(str, &addr, &port)) { r = 0; goto outta_parse_peer; } outta_parse_peer: if (! r) { if (addr != NULL) free(addr); if (port != NULL) free(port); } else { cfg->SHCUPD_PEERS[offset].ip = addr; cfg->SHCUPD_PEERS[offset].port = port; } return r; } #endif /* USE_SHARED_CACHE */ int config_param_validate(char *k, char *v, hitch_config *cfg, char *file, int line) { int r = 1; struct stat st; assert(k != NULL); assert(v != NULL); assert(strlen(k) >= 2); if (strcmp(k, "tls") == 0) { cfg->ETYPE = ENC_TLS; } else if (strcmp(k, "ssl") == 0) { cfg->ETYPE = ENC_SSL; } else if (strcmp(k, CFG_CIPHERS) == 0) { if (strlen(v) > 0) { config_assign_str(&cfg->CIPHER_SUITE, v); } } else if (strcmp(k, CFG_SSL_ENGINE) == 0) { if (strlen(v) > 0) { config_assign_str(&cfg->ENGINE, v); } } else if (strcmp(k, CFG_PREFER_SERVER_CIPHERS) == 0) { r = config_param_val_bool(v, &cfg->PREFER_SERVER_CIPHERS); } else if (strcmp(k, CFG_FRONTEND) == 0) { struct front_arg *fa; struct cfg_cert_file *cert; char *certfile = NULL; ALLOC_OBJ(fa, FRONT_ARG_MAGIC); r = config_param_host_port_wildcard(v, &fa->ip, &fa->port, &certfile, 1); if (r != 0) { if (cfg->LISTEN_DEFAULT != NULL) { /* drop default listen arg. */ struct front_arg *def = NULL; HASH_FIND_STR(cfg->LISTEN_ARGS, "default", def); AN(def); HASH_DEL(cfg->LISTEN_ARGS, def); free(def->ip); free(def->port); free(def->cert); free(def->pspec); FREE_OBJ(def); cfg->LISTEN_DEFAULT = NULL; } fa->pspec = strdup(v); HASH_ADD_KEYPTR(hh, cfg->LISTEN_ARGS, fa->pspec, strlen(fa->pspec), fa); if (certfile != NULL) { r = config_param_pem_file(certfile, &cert); if (r != 0) { AN(cert); fa->cert = cert; } free(certfile); } } else { FREE_OBJ(fa); } } else if (strcmp(k, CFG_BACKEND) == 0) { free(cfg->BACK_PORT); free(cfg->BACK_IP); r = config_param_host_port(v, &cfg->BACK_IP, &cfg->BACK_PORT); } else if (strcmp(k, CFG_WORKERS) == 0) { r = config_param_val_long(v, &cfg->NCORES, 1); } else if (strcmp(k, CFG_BACKLOG) == 0) { r = config_param_val_int(v, &cfg->BACKLOG, 0); } else if (strcmp(k, CFG_KEEPALIVE) == 0) { r = config_param_val_int(v, &cfg->TCP_KEEPALIVE_TIME, 1); } #ifdef USE_SHARED_CACHE else if (strcmp(k, CFG_SHARED_CACHE) == 0) { r = config_param_val_int(v, &cfg->SHARED_CACHE, 1); } else if (strcmp(k, CFG_SHARED_CACHE_LISTEN) == 0) { if (strlen(v) > 0) r = config_param_host_port_wildcard(v, &cfg->SHCUPD_IP, &cfg->SHCUPD_PORT, NULL, 1); } else if (strcmp(k, CFG_SHARED_CACHE_PEER) == 0) { r = config_param_shcupd_peer(v, cfg); } else if (strcmp(k, CFG_SHARED_CACHE_MCASTIF) == 0) { r = config_param_shcupd_mcastif(v, &cfg->SHCUPD_MCASTIF, &cfg->SHCUPD_MCASTTTL); } #endif else if (strcmp(k, CFG_CHROOT) == 0) { if (strlen(v) > 0) { // check directory if (stat(v, &st) != 0) { config_error_set("Unable to stat directory" " '%s': %s'.",v,strerror(errno)); r = 0; } else { if (! S_ISDIR(st.st_mode)) { config_error_set("Bad chroot directory " "'%s': Not a directory.", v, strerror(errno)); r = 0; } else { config_assign_str(&cfg->CHROOT, v); } } } } else if (strcmp(k, CFG_USER) == 0) { if (strlen(v) > 0) { struct passwd *passwd; passwd = getpwnam(v); if (!passwd) { config_error_set("Invalid user '%s'.", v); r = 0; } else { cfg->UID = passwd->pw_uid; cfg->GID = passwd->pw_gid; } } } else if (strcmp(k, CFG_GROUP) == 0) { if (strlen(v) > 0) { struct group *grp; grp = getgrnam(v); if (!grp) { config_error_set("Invalid group '%s'.", v); r = 0; } else { cfg->GID = grp->gr_gid; } } } else if (strcmp(k, CFG_QUIET) == 0) { r = config_param_val_bool(v, &cfg->QUIET); } else if (strcmp(k, CFG_SYSLOG) == 0) { r = config_param_val_bool(v, &cfg->SYSLOG); } else if (strcmp(k, CFG_SYSLOG_FACILITY) == 0) { int facility = -1; r = 1; #define SYSLOG_FAC(m, s) \ if (!strcmp(v, s)) \ facility = m; #include "sysl_tbl.h" #undef SYSLOG_FAC if (facility != -1) cfg->SYSLOG_FACILITY = facility; else { config_error_set("Invalid facility '%s'.", v); r = 0; } } else if (strcmp(k, CFG_DAEMON) == 0) { r = config_param_val_bool(v, &cfg->DAEMONIZE); } else if (strcmp(k, CFG_WRITE_IP) == 0) { r = config_param_val_bool(v, &cfg->WRITE_IP_OCTET); } else if (strcmp(k, CFG_WRITE_PROXY) == 0) { r = config_param_val_bool(v, &cfg->WRITE_PROXY_LINE_V2); } else if (strcmp(k, CFG_WRITE_PROXY_V1) == 0) { r = config_param_val_bool(v, &cfg->WRITE_PROXY_LINE_V1); } else if (strcmp(k, CFG_WRITE_PROXY_V2) == 0) { r = config_param_val_bool(v, &cfg->WRITE_PROXY_LINE_V2); } else if (strcmp(k, CFG_PROXY_PROXY) == 0) { r = config_param_val_bool(v, &cfg->PROXY_PROXY_LINE); } else if (strcmp(k, CFG_PEM_FILE) == 0) { struct cfg_cert_file *cert; r = config_param_pem_file(v, &cert); if (r != 0) { AN(cert); if (cfg->CERT_DEFAULT != NULL) { struct cfg_cert_file *tmp = cfg->CERT_DEFAULT; HASH_ADD_KEYPTR(hh, cfg->CERT_FILES, tmp->filename, strlen(tmp->filename), tmp); } cfg->CERT_DEFAULT = cert; } } else if (strcmp(k, CFG_BACKEND_CONNECT_TIMEOUT) == 0) { r = config_param_val_int(v, &cfg->BACKEND_CONNECT_TIMEOUT, 1); } else if (strcmp(k, CFG_SSL_HANDSHAKE_TIMEOUT) == 0) { r = config_param_val_int(v, &cfg->SSL_HANDSHAKE_TIMEOUT, 1); } else if (strcmp(k, CFG_RECV_BUFSIZE) == 0) { r = config_param_val_int(v, &cfg->RECV_BUFSIZE, 1); } else if (strcmp(k, CFG_SEND_BUFSIZE) == 0) { r = config_param_val_int(v, &cfg->SEND_BUFSIZE, 1); } else if (strcmp(k, CFG_LOG_FILENAME) == 0) { if (strlen(v) > 0) { config_assign_str(&cfg->LOG_FILENAME, v); } } else if (strcmp(k, CFG_PIDFILE) == 0) { if (strlen(v) > 0) { config_assign_str(&cfg->PIDFILE, v); } } else if (strcmp(k, CFG_RING_SLOTS) == 0) { r = config_param_val_int(v, &cfg->RING_SLOTS, 1); } else if (strcmp(k, CFG_RING_DATA_LEN) == 0) { r = config_param_val_int(v, &cfg->RING_DATA_LEN, 1); } else if (strcmp(k, CFG_SNI_NOMATCH_ABORT) == 0) { r = config_param_val_bool(v, &cfg->SNI_NOMATCH_ABORT); } else { fprintf( stderr, "Ignoring unknown configuration key '%s' in configuration file '%s', line %d\n", k, file, line ); } if (!r) { if (file != NULL) config_error_set("Error in configuration file '%s', " "line %d: %s\n", file, line, config_error_get()); else config_error_set("Invalid parameter '%s': %s", k, config_error_get()); return (1); } return (0); } int config_file_parse(char *file, hitch_config *cfg) { char line[CONFIG_BUF_SIZE]; char *key, *value; FILE *fd = NULL; int r; AN(cfg); // should we read stdin? if (file == NULL || strlen(file) < 1 || strcmp(file, "-") == 0) fd = stdin; else fd = fopen(file, "r"); if (fd == NULL) { config_error_set("Unable to open configuration file '%s': %s\n", file, strerror(errno)); return (1); } int i = 0; while (1) { if (fgets(line, sizeof(line)-1, fd) == NULL) break; i++; r = config_parse_content((char*)&line, &key, &value); if (r != 0) /* comments/blank lines */ continue; // printf("File '%s', line %d, key: '%s', value: '%s'\n", file, i, key, value); if (config_param_validate(key, value, cfg, file, i) != 0) { fclose(fd); return (1); } } fclose(fd); return (0); } char * config_disp_str(char *str) { return (str == NULL) ? "" : str; } char * config_disp_bool(int v) { return (v > 0) ? CFG_BOOL_ON : "off"; } char * config_disp_uid(uid_t uid) { memset(tmp_buf, '\0', sizeof(tmp_buf)); if (uid == 0 && geteuid() != 0) return tmp_buf; struct passwd *pw = getpwuid(uid); if (pw) { memcpy(tmp_buf, pw->pw_name, strlen(pw->pw_name)); } return tmp_buf; } char * config_disp_gid (gid_t gid) { memset(tmp_buf, '\0', sizeof(tmp_buf)); if (gid == 0 && geteuid() != 0) return tmp_buf; struct group *gr = getgrgid(gid); if (gr) { memcpy(tmp_buf, gr->gr_name, strlen(gr->gr_name)); } return tmp_buf; } char * config_disp_hostport(char *host, char *port) { memset(tmp_buf, '\0', sizeof(tmp_buf)); if (host == NULL && port == NULL) return ""; strcat(tmp_buf, "["); if (host == NULL) strcat(tmp_buf, "*"); else { strncat(tmp_buf, host, 40); } strcat(tmp_buf, "]:"); strncat(tmp_buf, port, 5); return tmp_buf; } const char * config_disp_log_facility (int facility) { switch (facility) { #define SYSLOG_FAC(m, s) \ case m: \ return (s); #include "sysl_tbl.h" #undef SYSLOG_FAC default: return "UNKNOWN"; } } void config_print_usage_fd(char *prog, FILE *out) { hitch_config *cfg; cfg = config_new(); AN(cfg); if (out == NULL) out = stderr; fprintf(out, "Usage: %s [OPTIONS] PEM\n\n", basename(prog)); fprintf(out, "This is hitch, The Scalable TLS Unwrapping Daemon.\n\n"); fprintf(out, "CONFIGURATION:\n"); fprintf(out, "\n"); fprintf(out, " --config=FILE Load configuration from specified file.\n"); fprintf(out, "\n"); fprintf(out, "ENCRYPTION METHODS:\n"); fprintf(out, "\n"); fprintf(out, " --tls TLSv1 (default. No SSLv3)\n"); fprintf(out, " --ssl SSLv3 (enables SSLv3)\n"); fprintf(out, " -c --ciphers=SUITE Sets allowed ciphers (Default: \"%s\")\n", config_disp_str(cfg->CIPHER_SUITE)); fprintf(out, " -e --ssl-engine=NAME Sets OpenSSL engine (Default: \"%s\")\n", config_disp_str(cfg->ENGINE)); fprintf(out, " -O --prefer-server-ciphers Prefer server list order\n"); fprintf(out, "\n"); fprintf(out, "SOCKET:\n"); fprintf(out, "\n"); fprintf(out, " --client Enable client proxy mode\n"); fprintf(out, " -b --backend=[HOST]:PORT Backend [connect] (default is \"%s\")\n", config_disp_hostport(cfg->BACK_IP, cfg->BACK_PORT)); fprintf(out, " -f --frontend=[HOST]:PORT[+CERT] Frontend [bind] (default is \"%s\")\n", config_disp_hostport(cfg->LISTEN_DEFAULT->ip, cfg->LISTEN_DEFAULT->port)); fprintf(out, " (Note: brackets are mandatory in endpoint specifiers.)"); #ifdef USE_SHARED_CACHE fprintf(out, "\n"); fprintf(out, " -U --shared-cache-listen=HOST,PORT\n"); fprintf(out, " Accept cache updates on UDP (Default: \"%s\")\n", config_disp_hostport(cfg->SHCUPD_IP, cfg->SHCUPD_PORT)); fprintf(out, " NOTE: This option requires enabled SSL session cache.\n"); fprintf(out, " -P --shared-cache-peer=HOST,PORT\n"); fprintf(out, " Send cache updates to specified peer\n"); fprintf(out, " NOTE: This option can be specified multiple times.\n"); fprintf(out, " -M --shared-cache-if=IFACE[,TTL]\n"); fprintf(out, " Force iface and ttl to receive and send multicast updates\n"); #endif fprintf(out, "\n"); fprintf(out, "PERFORMANCE:\n"); fprintf(out, "\n"); fprintf(out, " -n --workers=NUM Number of worker processes (Default: %ld)\n", cfg->NCORES); fprintf(out, " -B --backlog=NUM Set listen backlog size (Default: %d)\n", cfg->BACKLOG); fprintf(out, " -k --keepalive=SECS TCP keepalive on client socket (Default: %d)\n", cfg->TCP_KEEPALIVE_TIME); #ifdef USE_SHARED_CACHE fprintf(out, " -C --session-cache=NUM Enable and set SSL session cache to specified number\n"); fprintf(out, " of sessions (Default: %d)\n", cfg->SHARED_CACHE); #endif fprintf(out, "\n"); fprintf(out, "SECURITY:\n"); fprintf(out, "\n"); fprintf(out, " -r --chroot=DIR Sets chroot directory (Default: \"%s\")\n", config_disp_str(cfg->CHROOT)); fprintf(out, " -u --user=USER Set uid/gid after binding the socket (Default: \"%s\")\n", config_disp_uid(cfg->UID)); fprintf(out, " -g --group=GROUP Set gid after binding the socket (Default: \"%s\")\n", config_disp_gid(cfg->GID)); fprintf(out, "\n"); fprintf(out, "LOGGING:\n"); fprintf(out, " -q --quiet Be quiet; emit only error messages\n"); fprintf(out, " -s --syslog Send log message to syslog in addition to stderr/stdout\n"); fprintf(out, " --syslog-facility=FACILITY Syslog facility to use (Default: \"%s\")\n", config_disp_log_facility(cfg->SYSLOG_FACILITY)); fprintf(out, "\n"); fprintf(out, "OTHER OPTIONS:\n"); fprintf(out, " --daemon Fork into background and become a daemon (Default: %s)\n", config_disp_bool(cfg->DAEMONIZE)); fprintf(out, " --write-ip Write 1 octet with the IP family followed by the IP\n"); fprintf(out, " address in 4 (IPv4) or 16 (IPv6) octets little-endian\n"); fprintf(out, " to backend before the actual data\n"); fprintf(out, " (Default: %s)\n", config_disp_bool(cfg->WRITE_IP_OCTET)); fprintf(out, " --write-proxy-v1 Write HaProxy's PROXY v1 (IPv4 or IPv6) protocol line\n" ); fprintf(out, " before actual data\n"); fprintf(out, " (Default: %s)\n", config_disp_bool(cfg->WRITE_PROXY_LINE_V1)); fprintf(out, " --write-proxy-v2 Write HaProxy's PROXY v2 binary (IPv4 or IPv6) protocol line\n" ); fprintf(out, " before actual data\n"); fprintf(out, " (Default: %s)\n", config_disp_bool(cfg->WRITE_PROXY_LINE_V2)); fprintf(out, " --write-proxy Equivalent to --write-proxy-v2. For PROXY version 1 use\n"); fprintf(out, " --write-proxy-v1 explicitly\n"); fprintf(out, " --proxy-proxy Proxy HaProxy's PROXY (IPv4 or IPv6) protocol line\n" ); fprintf(out, " before actual data (PROXY v1 only)\n"); fprintf(out, " (Default: %s)\n", config_disp_bool(cfg->PROXY_PROXY_LINE)); fprintf(out, " --sni-nomatch-abort Abort handshake when client " "submits an unrecognized SNI server name\n" ); fprintf(out, " (Default: %s)\n", config_disp_bool(cfg->SNI_NOMATCH_ABORT)); fprintf(out, "\n"); fprintf(out, " -t --test Test configuration and exit\n"); fprintf(out, " -p --pidfile=FILE PID file\n"); fprintf(out, " -V --version Print program version and exit\n"); fprintf(out, " -h --help This help message\n"); config_destroy(cfg); } void config_print_usage(char *prog) { config_print_usage_fd(prog, stdout); } int config_parse_cli(int argc, char **argv, hitch_config *cfg, int *retval) { static int tls = 0, ssl = 0; static int client = 0; int c, i; optind = 1; AN(retval); *retval = 0; struct option long_options[] = { { CFG_CONFIG, 1, NULL, CFG_PARAM_CFGFILE }, { "tls", 0, &tls, 1}, { "ssl", 0, &ssl, 1}, { "client", 0, &client, 1}, { CFG_CIPHERS, 1, NULL, 'c' }, { CFG_PREFER_SERVER_CIPHERS, 0, NULL, 'O' }, { CFG_BACKEND, 1, NULL, 'b' }, { CFG_FRONTEND, 1, NULL, 'f' }, { CFG_WORKERS, 1, NULL, 'n' }, { CFG_BACKLOG, 1, NULL, 'B' }, #ifdef USE_SHARED_CACHE { CFG_SHARED_CACHE, 1, NULL, 'C' }, { CFG_SHARED_CACHE_LISTEN, 1, NULL, 'U' }, { CFG_SHARED_CACHE_PEER, 1, NULL, 'P' }, { CFG_SHARED_CACHE_MCASTIF, 1, NULL, 'M' }, #endif { CFG_PIDFILE, 1, NULL, 'p' }, { CFG_KEEPALIVE, 1, NULL, 'k' }, { CFG_CHROOT, 1, NULL, 'r' }, { CFG_USER, 1, NULL, 'u' }, { CFG_GROUP, 1, NULL, 'g' }, { CFG_QUIET, 0, NULL, 'q' }, { CFG_SYSLOG, 0, NULL, 's' }, { CFG_SYSLOG_FACILITY, 1, NULL, CFG_PARAM_SYSLOG_FACILITY }, { CFG_DAEMON, 0, &cfg->DAEMONIZE, 1 }, { CFG_WRITE_IP, 0, &cfg->WRITE_IP_OCTET, 1 }, { CFG_WRITE_PROXY_V1, 0, &cfg->WRITE_PROXY_LINE_V1, 1 }, { CFG_WRITE_PROXY_V2, 0, &cfg->WRITE_PROXY_LINE_V2, 1 }, { CFG_WRITE_PROXY, 0, &cfg->WRITE_PROXY_LINE_V2, 1 }, { CFG_PROXY_PROXY, 0, &cfg->PROXY_PROXY_LINE, 1 }, { CFG_SNI_NOMATCH_ABORT, 0, &cfg->SNI_NOMATCH_ABORT, 1 }, { "test", 0, NULL, 't' }, { "version", 0, NULL, 'V' }, { "help", 0, NULL, 'h' }, { 0, 0, 0, 0 } }; if (argc == 1) { config_print_usage(argv[0]); *retval = 0; return (1); } while (1) { int ret = 0; int option_index = 0; c = getopt_long(argc, argv, "c:e:Ob:f:n:B:C:U:p:P:M:k:r:u:g:qstVh", long_options, &option_index); if (c == -1) break; switch (c) { case 0: break; case CFG_PARAM_CFGFILE: if (config_file_parse(optarg, cfg) != 0) { *retval = 1; return (1); } break; case CFG_PARAM_SYSLOG_FACILITY: ret = config_param_validate(CFG_SYSLOG_FACILITY, optarg, cfg, NULL, 0); break; case 'c': ret = config_param_validate(CFG_CIPHERS, optarg, cfg, NULL, 0); break; case 'e': ret = config_param_validate(CFG_SSL_ENGINE, optarg, cfg, NULL, 0); break; case 'O': ret = config_param_validate(CFG_PREFER_SERVER_CIPHERS, CFG_BOOL_ON, cfg, NULL, 0); break; case 'b': ret = config_param_validate(CFG_BACKEND, optarg, cfg, NULL, 0); break; case 'f': ret = config_param_validate(CFG_FRONTEND, optarg, cfg, NULL, 0); break; case 'n': ret = config_param_validate(CFG_WORKERS, optarg, cfg, NULL, 0); break; case 'B': ret = config_param_validate(CFG_BACKLOG, optarg, cfg, NULL, 0); break; #ifdef USE_SHARED_CACHE case 'C': ret = config_param_validate(CFG_SHARED_CACHE, optarg, cfg, NULL, 0); break; case 'U': ret = config_param_validate(CFG_SHARED_CACHE_LISTEN, optarg, cfg, NULL, 0); break; case 'P': ret = config_param_validate(CFG_SHARED_CACHE_PEER, optarg, cfg, NULL, 0)s; break; case 'M': ret =config_param_validate(CFG_SHARED_CACHE_MCASTIF, optarg, cfg, NULL, 0); break; #endif case 'p': ret = config_param_validate(CFG_PIDFILE, optarg, cfg, NULL, 0); break; case 'k': ret = config_param_validate(CFG_KEEPALIVE, optarg, cfg, NULL, 0); break; case 'r': ret = config_param_validate(CFG_CHROOT, optarg, cfg, NULL, 0); break; case 'u': ret = config_param_validate(CFG_USER, optarg, cfg, NULL, 0); break; case 'g': ret = config_param_validate(CFG_GROUP, optarg, cfg, NULL, 0); break; case 'q': ret = config_param_validate(CFG_QUIET, CFG_BOOL_ON, cfg, NULL, 0); break; case 's': ret = config_param_validate(CFG_SYSLOG, CFG_BOOL_ON, cfg, NULL, 0); break; case 't': cfg->TEST = 1; break; case 'V': printf("%s %s\n", basename(argv[0]), VERSION); *retval = 0; return (1); break; case 'h': config_print_usage(argv[0]); *retval = 0; return (1); break; default: config_error_set("Invalid command line parameters. " "Run %s --help for instructions.", basename(argv[0])); *retval = 1; return (1); } if (ret != 0) { *retval = 1; return (1); } } if (tls && ssl) { config_error_set("Options --tls and --ssl are mutually" " exclusive."); *retval = 1; return (1); } else { if (ssl) cfg->ETYPE = ENC_SSL; else if (tls) cfg->ETYPE = ENC_TLS; } if (client) cfg->PMODE = SSL_CLIENT; if ((!!cfg->WRITE_IP_OCTET + !!cfg->PROXY_PROXY_LINE + !!cfg->WRITE_PROXY_LINE_V1 + !!cfg->WRITE_PROXY_LINE_V2) >= 2) { config_error_set("Options --write-ip, --write-proxy-proxy," " --write-proxy-v1 and --write-proxy-v2 are" " mutually exclusive."); *retval = 1; return (1); } if (cfg->DAEMONIZE) { cfg->SYSLOG = 1; cfg->QUIET = 1; } #ifdef USE_SHARED_CACHE if (cfg->SHCUPD_IP != NULL && ! cfg->SHARED_CACHE) { config_error_set("Shared cache update listener is defined," " but shared cache is disabled."); *retval = 1; return (1); } #endif // Any arguments left are presumed to be PEM files argc -= optind; argv += optind; for (i = 0; i < argc; i++) { if (config_param_validate(CFG_PEM_FILE, argv[i], cfg, NULL, 0)) { *retval = 1; return (1); } } if (cfg->PMODE == SSL_SERVER && cfg->CERT_DEFAULT == NULL) { config_error_set("No x509 certificate PEM file specified!"); *retval = 1; return (1); } return (0); } hitch-1.1.1/src/sysl_tbl.h0000644000175000017500000000106212617116675012340 00000000000000SYSLOG_FAC(LOG_AUTH, "auth") SYSLOG_FAC(LOG_AUTHPRIV, "authpriv") SYSLOG_FAC(LOG_CRON, "cron") SYSLOG_FAC(LOG_DAEMON, "daemon") SYSLOG_FAC(LOG_FTP, "ftp") SYSLOG_FAC(LOG_LOCAL0, "local0") SYSLOG_FAC(LOG_LOCAL1, "local1") SYSLOG_FAC(LOG_LOCAL2, "local2") SYSLOG_FAC(LOG_LOCAL3, "local3") SYSLOG_FAC(LOG_LOCAL4, "local4") SYSLOG_FAC(LOG_LOCAL5, "local5") SYSLOG_FAC(LOG_LOCAL6, "local6") SYSLOG_FAC(LOG_LOCAL7, "local7") SYSLOG_FAC(LOG_LPR, "lpr") SYSLOG_FAC(LOG_MAIL, "mail") SYSLOG_FAC(LOG_NEWS, "news") SYSLOG_FAC(LOG_USER, "user") SYSLOG_FAC(LOG_UUCP, "uucp") hitch-1.1.1/src/ringbuffer.c0000644000175000017500000000760612644705160012634 00000000000000/*- * Copyright 2011 Bump Technologies, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY BUMP TECHNOLOGIES, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL BUMP TECHNOLOGIES, INC. OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * * The views and conclusions contained in the software and documentation are * those of the authors and should not be interpreted as representing * official policies, either expressed or implied, of Bump Technologies, Inc. * **/ #include "ringbuffer.h" #include "vas.h" #include /* Initialize a ringbuffer structure to empty */ void ringbuffer_init(ringbuffer *rb, int num_slots, int data_len) { rb->num_slots = num_slots ?: DEF_RING_SLOTS; rb->data_len = data_len ?: DEF_RING_DATA_LEN; rb->slots = (bufent*)malloc(rb->num_slots * sizeof(rb->slots[0])); rb->head = &rb->slots[0]; rb->tail = &rb->slots[0]; int x; for (x=0; x < rb->num_slots; x++) { rb->slots[x].next = &(rb->slots[(x + 1) % rb->num_slots]); rb->slots[x].data = (char *)malloc(rb->data_len); } rb->used = 0; rb->bytes_written = 0; } void ringbuffer_cleanup(ringbuffer *rb) { int x; for (x=0; x < rb->num_slots; x++) { free(rb->slots[x].data); } free(rb->slots); } /** READ FUNCTIONS **/ /* Return a char * that represents the current unconsumed buffer */ char * ringbuffer_read_next(ringbuffer *rb, int * length) { assert(rb->used); *length = rb->head->left; return rb->head->ptr; } /* Mark consumption of only part of the read head buffer */ void ringbuffer_read_skip(ringbuffer *rb, int length) { assert(rb->used); rb->head->ptr += length; rb->head->left -= length; } /* Pop a consumed (fully read) head from the buffer */ void ringbuffer_read_pop(ringbuffer *rb) { assert(rb->used); rb->head = rb->head->next; rb->used--; } /** WRITE FUNCTIONS **/ /* Return the tail ptr (current target of new writes) */ char * ringbuffer_write_ptr(ringbuffer *rb) { assert(rb->used < rb->num_slots); return rb->tail->data; } /* Mark the tail appended for `length` bytes, and move the cursor * to the next slot */ void ringbuffer_write_append(ringbuffer *rb, int length) { assert(rb->used < rb->num_slots); rb->used++; rb->tail->ptr = rb->tail->data; rb->tail->left = length; rb->tail = rb->tail->next; } /** RING STATE FUNCTIONS **/ /* Used size of the ringbuffer */ int ringbuffer_size(ringbuffer *rb) { return rb->used; } /* Used size of the ringbuffer */ int ringbuffer_capacity(ringbuffer *rb) { return rb->num_slots; } /* Is the ringbuffer completely empty (implies: no data to be written) */ int ringbuffer_is_empty(ringbuffer *rb) { return rb->used == 0; } /* Is the ringbuffer completely full (implies: no more data should be read) */ int ringbuffer_is_full(ringbuffer *rb) { return rb->used == rb->num_slots; } hitch-1.1.1/src/Makefile.in0000644000175000017500000004417412651707277012416 00000000000000# Makefile.in generated by automake 1.15 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2014 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 = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } 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 = : sbin_PROGRAMS = hitch$(EXEEXT) @USE_SHCTX_TRUE@am__append_1 = shctx.c @USE_SHCTX_TRUE@am__append_2 = ebtree/libebtree.a @USE_SHCTX_TRUE@am__append_3 = -Iebtree subdir = src 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) DIST_COMMON = $(srcdir)/Makefile.am $(nobase_noinst_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(sbindir)" PROGRAMS = $(sbin_PROGRAMS) am__hitch_SOURCES_DIST = configuration.c ringbuffer.c hitch.c vpf.c \ flopen.c vas.c shctx.c @USE_SHCTX_TRUE@am__objects_1 = shctx.$(OBJEXT) am_hitch_OBJECTS = configuration.$(OBJEXT) ringbuffer.$(OBJEXT) \ hitch.$(OBJEXT) vpf.$(OBJEXT) flopen.$(OBJEXT) vas.$(OBJEXT) \ $(am__objects_1) hitch_OBJECTS = $(am_hitch_OBJECTS) am__DEPENDENCIES_1 = hitch_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__append_2) 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) 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 = $(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 = $(hitch_SOURCES) DIST_SOURCES = $(am__hitch_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(nobase_noinst_HEADERS) 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 am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_CPPFLAGS = -I/usr/include/libev/ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LDFLAGS = @AM_LDFLAGS@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ 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@ RST2MAN = @RST2MAN@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ 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_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ 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@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = tests AM_CFLAGS = -O2 -g -std=c99 -fno-strict-aliasing -Wall -W \ -D_GNU_SOURCE $(am__append_3) nobase_noinst_HEADERS = ringbuffer.h configuration.h shctx.h miniobj.h vqueue.h vpf.h flopen.h uthash.h sysl_tbl.h vas.h hitch_SOURCES = configuration.c ringbuffer.c hitch.c vpf.c flopen.c \ vas.c $(am__append_1) hitch_LDADD = $(AM_LDFLAGS) -lcrypto $(am__append_2) all: all-am .SUFFIXES: .SUFFIXES: .c .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) --foreign src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign src/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-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ ; 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) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ } \ ; done uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || 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)$(sbindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(sbindir)" && rm -f $$files clean-sbinPROGRAMS: -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) hitch$(EXEEXT): $(hitch_OBJECTS) $(hitch_DEPENDENCIES) $(EXTRA_hitch_DEPENDENCIES) @rm -f hitch$(EXEEXT) $(AM_V_CCLD)$(LINK) $(hitch_OBJECTS) $(hitch_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/configuration.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flopen.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hitch.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ringbuffer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shctx.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vas.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vpf.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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) '$<'` 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) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sbindir)"; 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-sbinPROGRAMS 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-sbinPROGRAMS 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 pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sbinPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-sbinPROGRAMS cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic 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-sbinPROGRAMS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-sbinPROGRAMS .PRECIOUS: Makefile # 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: hitch-1.1.1/src/vqueue.h0000644000175000017500000004673212546560025012025 00000000000000/*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)queue.h 8.5 (Berkeley) 8/20/94 * $FreeBSD: head/sys/sys/queue.h 251887 2013-06-18 02:57:56Z lstewart $ */ #ifndef VARNISH_QUEUE_H #define VARNISH_QUEUE_H /* * This file defines four types of data structures: singly-linked lists, * singly-linked tail queues, lists and tail queues. * * A singly-linked list is headed by a single forward pointer. The elements * are singly linked for minimum space and pointer manipulation overhead at * the expense of O(n) removal for arbitrary elements. New elements can be * added to the list after an existing element or at the head of the list. * Elements being removed from the head of the list should use the explicit * macro for this purpose for optimum efficiency. A singly-linked list may * only be traversed in the forward direction. Singly-linked lists are ideal * for applications with large datasets and few or no removals or for * implementing a LIFO queue. * * A singly-linked tail queue is headed by a pair of pointers, one to the * head of the list and the other to the tail of the list. The elements are * singly linked for minimum space and pointer manipulation overhead at the * expense of O(n) removal for arbitrary elements. New elements can be added * to the list after an existing element, at the head of the list, or at the * end of the list. Elements being removed from the head of the tail queue * should use the explicit macro for this purpose for optimum efficiency. * A singly-linked tail queue may only be traversed in the forward direction. * Singly-linked tail queues are ideal for applications with large datasets * and few or no removals or for implementing a FIFO queue. * * A list is headed by a single forward pointer (or an array of forward * pointers for a hash table header). The elements are doubly linked * so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before * or after an existing element or at the head of the list. A list * may be traversed in either direction. * * A tail queue is headed by a pair of pointers, one to the head of the * list and the other to the tail of the list. The elements are doubly * linked so that an arbitrary element can be removed without a need to * traverse the list. New elements can be added to the list before or * after an existing element, at the head of the list, or at the end of * the list. A tail queue may be traversed in either direction. * * For details on the use of these macros, see the queue(3) manual page. * * * VSLIST VLIST VSTAILQ VTAILQ * _HEAD + + + + * _HEAD_INITIALIZER + + + + * _ENTRY + + + + * _INIT + + + + * _EMPTY + + + + * _FIRST + + + + * _NEXT + + + + * _PREV - + - + * _LAST - - + + * _FOREACH + + + + * _FOREACH_FROM + + + + * _FOREACH_SAFE + + + + * _FOREACH_FROM_SAFE + + + + * _FOREACH_REVERSE - - - + * _FOREACH_REVERSE_FROM - - - + * _FOREACH_REVERSE_SAFE - - - + * _FOREACH_REVERSE_FROM_SAFE - - - + * _INSERT_HEAD + + + + * _INSERT_BEFORE - + - + * _INSERT_AFTER + + + + * _INSERT_TAIL - - + + * _CONCAT - - + + * _REMOVE_AFTER + - + - * _REMOVE_HEAD + - + - * _REMOVE + + + + * _SWAP + + + + * */ #define TRACEBUF #define TRACEBUF_INITIALIZER #define TRASHIT(x) /* * Singly-linked List declarations. */ #define VSLIST_HEAD(name, type) \ struct name { \ struct type *vslh_first; /* first element */ \ } #define VSLIST_HEAD_INITIALIZER(head) \ { NULL } #define VSLIST_ENTRY(type) \ struct { \ struct type *vsle_next; /* next element */ \ } /* * Singly-linked List functions. */ #define VSLIST_EMPTY(head) ((head)->vslh_first == NULL) #define VSLIST_FIRST(head) ((head)->vslh_first) #define VSLIST_FOREACH(var, head, field) \ for ((var) = VSLIST_FIRST((head)); \ (var); \ (var) = VSLIST_NEXT((var), field)) #define VSLIST_FOREACH_FROM(var, head, field) \ for ((var) = ((var) ? (var) : VSLIST_FIRST((head))); \ (var); \ (var) = VSLIST_NEXT((var), field)) #define VSLIST_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = VSLIST_FIRST((head)); \ (var) && ((tvar) = VSLIST_NEXT((var), field), 1); \ (var) = (tvar)) #define VSLIST_FOREACH_FROM_SAFE(var, head, field, tvar) \ for ((var) = ((var) ? (var) : VSLIST_FIRST((head))); \ (var) && ((tvar) = VSLIST_NEXT((var), field), 1); \ (var) = (tvar)) #define VSLIST_FOREACH_PREVPTR(var, varp, head, field) \ for ((varp) = &VSLIST_FIRST((head)); \ ((var) = *(varp)) != NULL; \ (varp) = &VSLIST_NEXT((var), field)) #define VSLIST_INIT(head) do { \ VSLIST_FIRST((head)) = NULL; \ } while (0) #define VSLIST_INSERT_AFTER(slistelm, elm, field) do { \ VSLIST_NEXT((elm), field) = VSLIST_NEXT((slistelm), field); \ VSLIST_NEXT((slistelm), field) = (elm); \ } while (0) #define VSLIST_INSERT_HEAD(head, elm, field) do { \ VSLIST_NEXT((elm), field) = VSLIST_FIRST((head)); \ VSLIST_FIRST((head)) = (elm); \ } while (0) #define VSLIST_NEXT(elm, field) ((elm)->field.vsle_next) #define VSLIST_REMOVE(head, elm, type, field) do { \ if (VSLIST_FIRST((head)) == (elm)) { \ VSLIST_REMOVE_HEAD((head), field); \ } \ else { \ struct type *curelm = VSLIST_FIRST((head)); \ while (VSLIST_NEXT(curelm, field) != (elm)) \ curelm = VSLIST_NEXT(curelm, field); \ VSLIST_REMOVE_AFTER(curelm, field); \ } \ TRASHIT(*oldnext); \ } while (0) #define VSLIST_REMOVE_AFTER(elm, field) do { \ VSLIST_NEXT(elm, field) = \ VSLIST_NEXT(VSLIST_NEXT(elm, field), field); \ } while (0) #define VSLIST_REMOVE_HEAD(head, field) do { \ VSLIST_FIRST((head)) = VSLIST_NEXT(VSLIST_FIRST((head)), field);\ } while (0) #define VSLIST_SWAP(head1, head2, type) do { \ struct type *swap_first = VSLIST_FIRST(head1); \ VSLIST_FIRST(head1) = VSLIST_FIRST(head2); \ VSLIST_FIRST(head2) = swap_first; \ } while (0) /* * Singly-linked Tail queue declarations. */ #define VSTAILQ_HEAD(name, type) \ struct name { \ struct type *vstqh_first;/* first element */ \ struct type **vstqh_last;/* addr of last next element */ \ } #define VSTAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).vstqh_first } #define VSTAILQ_ENTRY(type) \ struct { \ struct type *vstqe_next; /* next element */ \ } /* * Singly-linked Tail queue functions. */ #define VSTAILQ_CONCAT(head1, head2) do { \ if (!VSTAILQ_EMPTY((head2))) { \ *(head1)->vstqh_last = (head2)->vstqh_first; \ (head1)->vstqh_last = (head2)->vstqh_last; \ VSTAILQ_INIT((head2)); \ } \ } while (0) #define VSTAILQ_EMPTY(head) ((head)->vstqh_first == NULL) #define VSTAILQ_FIRST(head) ((head)->vstqh_first) #define VSTAILQ_FOREACH(var, head, field) \ for((var) = VSTAILQ_FIRST((head)); \ (var); \ (var) = VSTAILQ_NEXT((var), field)) #define VSTAILQ_FOREACH_FROM(var, head, field) \ for ((var) = ((var) ? (var) : VSTAILQ_FIRST((head))); \ (var); \ (var) = VSTAILQ_NEXT((var), field)) #define VSTAILQ_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = VSTAILQ_FIRST((head)); \ (var) && ((tvar) = VSTAILQ_NEXT((var), field), 1); \ (var) = (tvar)) #define VSTAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \ for ((var) = ((var) ? (var) : VSTAILQ_FIRST((head))); \ (var) && ((tvar) = VSTAILQ_NEXT((var), field), 1); \ (var) = (tvar)) #define VSTAILQ_INIT(head) do { \ VSTAILQ_FIRST((head)) = NULL; \ (head)->vstqh_last = &VSTAILQ_FIRST((head)); \ } while (0) #define VSTAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \ if ((VSTAILQ_NEXT((elm), field) = VSTAILQ_NEXT((tqelm), field)) == NULL)\ (head)->vstqh_last = &VSTAILQ_NEXT((elm), field); \ VSTAILQ_NEXT((tqelm), field) = (elm); \ } while (0) #define VSTAILQ_INSERT_HEAD(head, elm, field) do { \ if ((VSTAILQ_NEXT((elm), field) = VSTAILQ_FIRST((head))) == NULL)\ (head)->vstqh_last = &VSTAILQ_NEXT((elm), field); \ VSTAILQ_FIRST((head)) = (elm); \ } while (0) #define VSTAILQ_INSERT_TAIL(head, elm, field) do { \ VSTAILQ_NEXT((elm), field) = NULL; \ *(head)->vstqh_last = (elm); \ (head)->vstqh_last = &VSTAILQ_NEXT((elm), field); \ } while (0) #define VSTAILQ_LAST(head, type, field) \ (VSTAILQ_EMPTY((head)) ? NULL : \ __containerof((head)->vstqh_last, struct type, field.vstqe_next)) #define VSTAILQ_NEXT(elm, field) ((elm)->field.vstqe_next) #define VSTAILQ_REMOVE(head, elm, type, field) do { \ if (VSTAILQ_FIRST((head)) == (elm)) { \ VSTAILQ_REMOVE_HEAD((head), field); \ } \ else { \ struct type *curelm = VSTAILQ_FIRST((head)); \ while (VSTAILQ_NEXT(curelm, field) != (elm)) \ curelm = VSTAILQ_NEXT(curelm, field); \ VSTAILQ_REMOVE_AFTER(head, curelm, field); \ } \ TRASHIT(*oldnext); \ } while (0) #define VSTAILQ_REMOVE_AFTER(head, elm, field) do { \ if ((VSTAILQ_NEXT(elm, field) = \ VSTAILQ_NEXT(VSTAILQ_NEXT(elm, field), field)) == NULL) \ (head)->vstqh_last = &VSTAILQ_NEXT((elm), field); \ } while (0) #define VSTAILQ_REMOVE_HEAD(head, field) do { \ if ((VSTAILQ_FIRST((head)) = \ VSTAILQ_NEXT(VSTAILQ_FIRST((head)), field)) == NULL) \ (head)->vstqh_last = &VSTAILQ_FIRST((head)); \ } while (0) #define VSTAILQ_SWAP(head1, head2, type) do { \ struct type *swap_first = VSTAILQ_FIRST(head1); \ struct type **swap_last = (head1)->vstqh_last; \ VSTAILQ_FIRST(head1) = VSTAILQ_FIRST(head2); \ (head1)->vstqh_last = (head2)->vstqh_last; \ VSTAILQ_FIRST(head2) = swap_first; \ (head2)->vstqh_last = swap_last; \ if (VSTAILQ_EMPTY(head1)) \ (head1)->vstqh_last = &VSTAILQ_FIRST(head1); \ if (VSTAILQ_EMPTY(head2)) \ (head2)->vstqh_last = &VSTAILQ_FIRST(head2); \ } while (0) /* * List declarations. */ #define VLIST_HEAD(name, type) \ struct name { \ struct type *vlh_first; /* first element */ \ } #define VLIST_HEAD_INITIALIZER(head) \ { NULL } #define VLIST_ENTRY(type) \ struct { \ struct type *vle_next; /* next element */ \ struct type **vle_prev; /* address of previous next element */ \ } /* * List functions. */ #define VLIST_EMPTY(head) ((head)->vlh_first == NULL) #define VLIST_FIRST(head) ((head)->vlh_first) #define VLIST_FOREACH(var, head, field) \ for ((var) = VLIST_FIRST((head)); \ (var); \ (var) = VLIST_NEXT((var), field)) #define VLIST_FOREACH_FROM(var, head, field) \ for ((var) = ((var) ? (var) : VLIST_FIRST((head))); \ (var); \ (var) = VLIST_NEXT((var), field)) #define VLIST_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = VLIST_FIRST((head)); \ (var) && ((tvar) = VLIST_NEXT((var), field), 1); \ (var) = (tvar)) #define VLIST_FOREACH_FROM_SAFE(var, head, field, tvar) \ for ((var) = ((var) ? (var) : VLIST_FIRST((head))); \ (var) && ((tvar) = VLIST_NEXT((var), field), 1); \ (var) = (tvar)) #define VLIST_INIT(head) do { \ VLIST_FIRST((head)) = NULL; \ } while (0) #define VLIST_INSERT_AFTER(listelm, elm, field) do { \ if ((VLIST_NEXT((elm), field) = VLIST_NEXT((listelm), field)) != NULL)\ VLIST_NEXT((listelm), field)->field.vle_prev = \ &VLIST_NEXT((elm), field); \ VLIST_NEXT((listelm), field) = (elm); \ (elm)->field.vle_prev = &VLIST_NEXT((listelm), field); \ } while (0) #define VLIST_INSERT_BEFORE(listelm, elm, field) do { \ (elm)->field.vle_prev = (listelm)->field.vle_prev; \ VLIST_NEXT((elm), field) = (listelm); \ *(listelm)->field.vle_prev = (elm); \ (listelm)->field.vle_prev = &VLIST_NEXT((elm), field); \ } while (0) #define VLIST_INSERT_HEAD(head, elm, field) do { \ if ((VLIST_NEXT((elm), field) = VLIST_FIRST((head))) != NULL) \ VLIST_FIRST((head))->field.vle_prev = &VLIST_NEXT((elm), field);\ VLIST_FIRST((head)) = (elm); \ (elm)->field.vle_prev = &VLIST_FIRST((head)); \ } while (0) #define VLIST_NEXT(elm, field) ((elm)->field.vle_next) #define VLIST_PREV(elm, head, type, field) \ ((elm)->field.vle_prev == &VLIST_FIRST((head)) ? NULL : \ __containerof((elm)->field.vle_prev, struct type, field.vle_next)) #define VLIST_REMOVE(elm, field) do { \ if (VLIST_NEXT((elm), field) != NULL) \ VLIST_NEXT((elm), field)->field.vle_prev = \ (elm)->field.vle_prev; \ *(elm)->field.vle_prev = VLIST_NEXT((elm), field); \ TRASHIT(*oldnext); \ TRASHIT(*oldprev); \ } while (0) #define VLIST_SWAP(head1, head2, type, field) do { \ struct type *swap_tmp = VLIST_FIRST((head1)); \ VLIST_FIRST((head1)) = VLIST_FIRST((head2)); \ VLIST_FIRST((head2)) = swap_tmp; \ if ((swap_tmp = VLIST_FIRST((head1))) != NULL) \ swap_tmp->field.vle_prev = &VLIST_FIRST((head1)); \ if ((swap_tmp = VLIST_FIRST((head2))) != NULL) \ swap_tmp->field.vle_prev = &VLIST_FIRST((head2)); \ } while (0) /* * Tail queue declarations. */ #define VTAILQ_HEAD(name, type) \ struct name { \ struct type *vtqh_first; /* first element */ \ struct type **vtqh_last; /* addr of last next element */ \ TRACEBUF \ } #define VTAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).vtqh_first, TRACEBUF_INITIALIZER } #define VTAILQ_ENTRY(type) \ struct { \ struct type *vtqe_next; /* next element */ \ struct type **vtqe_prev; /* address of previous next element */\ TRACEBUF \ } /*lint -e(18) */ /* * Tail queue functions. */ #define VTAILQ_CONCAT(head1, head2, field) do { \ if (!VTAILQ_EMPTY(head2)) { \ *(head1)->vtqh_last = (head2)->vtqh_first; \ (head2)->vtqh_first->field.vtqe_prev = (head1)->vtqh_last;\ (head1)->vtqh_last = (head2)->vtqh_last; \ VTAILQ_INIT((head2)); \ } \ } while (0) #define VTAILQ_EMPTY(head) ((head)->vtqh_first == NULL) #define VTAILQ_FIRST(head) ((head)->vtqh_first) #define VTAILQ_FOREACH(var, head, field) \ for ((var) = VTAILQ_FIRST((head)); \ (var); \ (var) = VTAILQ_NEXT((var), field)) #define VTAILQ_FOREACH_FROM(var, head, field) \ for ((var) = ((var) ? (var) : VTAILQ_FIRST((head))); \ (var); \ (var) = VTAILQ_NEXT((var), field)) #define VTAILQ_FOREACH_SAFE(var, head, field, tvar) \ for ((var) = VTAILQ_FIRST((head)); \ (var) && ((tvar) = VTAILQ_NEXT((var), field), 1); \ (var) = (tvar)) #define VTAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \ for ((var) = ((var) ? (var) : VTAILQ_FIRST((head))); \ (var) && ((tvar) = VTAILQ_NEXT((var), field), 1); \ (var) = (tvar)) #define VTAILQ_FOREACH_REVERSE(var, head, headname, field) \ for ((var) = VTAILQ_LAST((head), headname); \ (var); \ (var) = VTAILQ_PREV((var), headname, field)) #define VTAILQ_FOREACH_REVERSE_FROM(var, head, headname, field) \ for ((var) = ((var) ? (var) : VTAILQ_LAST((head), headname)); \ (var); \ (var) = VTAILQ_PREV((var), headname, field)) #define VTAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \ for ((var) = VTAILQ_LAST((head), headname); \ (var) && ((tvar) = VTAILQ_PREV((var), headname, field), 1); \ (var) = (tvar)) #define VTAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar) \ for ((var) = ((var) ? (var) : VTAILQ_LAST((head), headname)); \ (var) && ((tvar) = VTAILQ_PREV((var), headname, field), 1); \ (var) = (tvar)) #define VTAILQ_INIT(head) do { \ VTAILQ_FIRST((head)) = NULL; \ (head)->vtqh_last = &VTAILQ_FIRST((head)); \ } while (0) #define VTAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ if ((VTAILQ_NEXT((elm), field) = VTAILQ_NEXT((listelm), field)) != NULL)\ VTAILQ_NEXT((elm), field)->field.vtqe_prev = \ &VTAILQ_NEXT((elm), field); \ else { \ (head)->vtqh_last = &VTAILQ_NEXT((elm), field); \ } \ VTAILQ_NEXT((listelm), field) = (elm); \ (elm)->field.vtqe_prev = &VTAILQ_NEXT((listelm), field); \ } while (0) #define VTAILQ_INSERT_BEFORE(listelm, elm, field) do { \ (elm)->field.vtqe_prev = (listelm)->field.vtqe_prev; \ VTAILQ_NEXT((elm), field) = (listelm); \ *(listelm)->field.vtqe_prev = (elm); \ (listelm)->field.vtqe_prev = &VTAILQ_NEXT((elm), field); \ } while (0) #define VTAILQ_INSERT_HEAD(head, elm, field) do { \ if ((VTAILQ_NEXT((elm), field) = VTAILQ_FIRST((head))) != NULL) \ VTAILQ_FIRST((head))->field.vtqe_prev = \ &VTAILQ_NEXT((elm), field); \ else \ (head)->vtqh_last = &VTAILQ_NEXT((elm), field); \ VTAILQ_FIRST((head)) = (elm); \ (elm)->field.vtqe_prev = &VTAILQ_FIRST((head)); \ } while (0) #define VTAILQ_INSERT_TAIL(head, elm, field) do { \ VTAILQ_NEXT((elm), field) = NULL; \ (elm)->field.vtqe_prev = (head)->vtqh_last; \ *(head)->vtqh_last = (elm); \ (head)->vtqh_last = &VTAILQ_NEXT((elm), field); \ } while (0) #define VTAILQ_LAST(head, headname) \ (*(((struct headname *)((head)->vtqh_last))->vtqh_last)) #define VTAILQ_NEXT(elm, field) ((elm)->field.vtqe_next) #define VTAILQ_PREV(elm, headname, field) \ (*(((struct headname *)((elm)->field.vtqe_prev))->vtqh_last)) #define VTAILQ_REMOVE(head, elm, field) do { \ if ((VTAILQ_NEXT((elm), field)) != NULL) \ VTAILQ_NEXT((elm), field)->field.vtqe_prev = \ (elm)->field.vtqe_prev; \ else { \ (head)->vtqh_last = (elm)->field.vtqe_prev; \ } \ *(elm)->field.vtqe_prev = VTAILQ_NEXT((elm), field); \ TRASHIT(*oldnext); \ TRASHIT(*oldprev); \ } while (0) #define VTAILQ_SWAP(head1, head2, type, field) do { \ struct type *swap_first = (head1)->vtqh_first; \ struct type **swap_last = (head1)->vtqh_last; \ (head1)->vtqh_first = (head2)->vtqh_first; \ (head1)->vtqh_last = (head2)->vtqh_last; \ (head2)->vtqh_first = swap_first; \ (head2)->vtqh_last = swap_last; \ if ((swap_first = (head1)->vtqh_first) != NULL) \ swap_first->field.vtqe_prev = &(head1)->vtqh_first; \ else \ (head1)->vtqh_last = &(head1)->vtqh_first; \ if ((swap_first = (head2)->vtqh_first) != NULL) \ swap_first->field.vtqe_prev = &(head2)->vtqh_first; \ else \ (head2)->vtqh_last = &(head2)->vtqh_first; \ } while (0) #endif /* !VARNISH_QUEUE_H */ hitch-1.1.1/src/flopen.h0000644000175000017500000000314112546560025011761 00000000000000/*- * Copyright (c) 2007 Dag-Erling Coïdan Smørgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer * in this position and unchanged. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Derived from: * $FreeBSD: src/lib/libutil/libutil.h,v 1.44 2007/05/10 15:01:42 des Exp $ */ #ifndef FLOPEN_H_INCLUDED #define FLOPEN_H_INCLUDED int flopen(const char *, int, ...); int fltest(int fd, pid_t *pid); #endif hitch-1.1.1/src/flopen.c0000644000175000017500000000676212546560025011770 00000000000000/*- * Copyright (c) 2007 Dag-Erling Coïdan Smørgrav * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer * in this position and unchanged. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * Derived from: * $FreeBSD: head/lib/libutil/flopen.c 184094 2008-10-20 18:11:30Z des $ */ #include "config.h" #include #include #include #include #include #include #include "flopen.h" int flopen(const char *path, int flags, ...) { int fd, operation, serrno, trunc; struct flock lock; struct stat sb, fsb; mode_t mode; #ifdef O_EXLOCK flags &= ~O_EXLOCK; #endif mode = 0; if (flags & O_CREAT) { va_list ap; va_start(ap, flags); mode = (mode_t)va_arg(ap, int); /* mode_t promoted to int */ va_end(ap); } memset(&lock, 0, sizeof lock); lock.l_type = ((flags & O_ACCMODE) == O_RDONLY) ? F_RDLCK : F_WRLCK; lock.l_whence = SEEK_SET; operation = (flags & O_NONBLOCK) ? F_SETLK : F_SETLKW; trunc = (flags & O_TRUNC); flags &= ~O_TRUNC; for (;;) { if ((fd = open(path, flags, mode)) == -1) /* non-existent or no access */ return (-1); if (fcntl(fd, operation, &lock) == -1) { /* unsupported or interrupted */ serrno = errno; (void)close(fd); errno = serrno; return (-1); } if (stat(path, &sb) == -1) { /* disappeared from under our feet */ (void)close(fd); continue; } if (fstat(fd, &fsb) == -1) { /* can't happen [tm] */ serrno = errno; (void)close(fd); errno = serrno; return (-1); } if (sb.st_dev != fsb.st_dev || sb.st_ino != fsb.st_ino) { /* changed under our feet */ (void)close(fd); continue; } if (trunc && ftruncate(fd, 0) != 0) { /* can't happen [tm] */ serrno = errno; (void)close(fd); errno = serrno; return (-1); } return (fd); } } /* Tests if the given fd is locked through flopen * If pid is non-NULL, stores the pid of the process holding the lock there * Returns 1 if the file is locked * Returns 0 if the file is unlocked * Returns -1 on error (and errno) */ int fltest(int fd, pid_t *pid) { struct flock lock; memset(&lock, 0, sizeof lock); lock.l_type = F_WRLCK; lock.l_whence = SEEK_SET; if (fcntl(fd, F_GETLK, &lock) == -1) return (-1); if (lock.l_type == F_UNLCK) return (0); if (pid != NULL) *pid = lock.l_pid; return (1); } hitch-1.1.1/src/shctx.h0000644000175000017500000000353612546560025011637 00000000000000/* * shctx.h * * Copyright (C) 2011 EXCELIANCE * * Author: Emeric Brun - emeric@exceliance.fr * */ #ifndef SHCTX_H #define SHCTX_H #include #include #ifndef SHSESS_MAX_FOOTER_LEN #define SHSESS_MAX_FOOTER_LEN sizeof(uint32_t) \ + EVP_MAX_MD_SIZE #endif #ifndef SHSESS_MAX_DATA_LEN #define SHSESS_MAX_DATA_LEN 512 #endif #define SHSESS_MAX_ENCODED_LEN SSL_MAX_SSL_SESSION_ID_LENGTH \ + SHSESS_MAX_DATA_LEN \ + SHSESS_MAX_FOOTER_LEN /* Callback called on a new session event: * session contains the sessionid zeros padded to SSL_MAX_SSL_SESSION_ID_LENGTH * followed by ASN1 session encoding. * len is set to SSL_MAX_SSL_SESSION_ID_LENGTH + ASN1 session length * len is always less than SSL_MAX_SSL_SESSION_ID_LENGTH + SHSESS_MAX_DATA_LEN. * Remaining Bytes from len to SHSESS_MAX_ENCODED_LEN can be used to add a footer. * cdate is the creation date timestamp. */ void shsess_set_new_cbk(void (*func)(unsigned char *session, unsigned int len, long cdate)); /* Add a session into the cache, * session contains the sessionid zeros padded to SSL_MAX_SSL_SESSION_ID_LENGTH * followed by ASN1 session encoding. * len is set to SSL_MAX_SSL_SESSION_ID_LENGTH + ASN1 data length. * if len greater than SHSESS_MAX_ENCODED_LEN, session is not added. * if cdate not 0, on get events session creation date will be reset to cdate */ void shctx_sess_add(const unsigned char *session, unsigned int session_len, long cdate); /* Init shared memory context if not allocated and set SSL context callbacks * size is the max number of stored session * Returns: -1 on alloc failure, size if performs context alloc, and 0 if just * perform callbacks registration */ int shared_context_init(SSL_CTX *ctx, int size); #endif /* SHCTX_H */ hitch-1.1.1/src/Makefile.am0000644000175000017500000000074612644705377012403 00000000000000 sbin_PROGRAMS = hitch EXTRA_DIST = tests AM_CPPFLAGS = -I/usr/include/libev/ AM_CFLAGS = -O2 -g -std=c99 -fno-strict-aliasing -Wall -W -D_GNU_SOURCE nobase_noinst_HEADERS = ringbuffer.h configuration.h shctx.h miniobj.h vqueue.h vpf.h flopen.h uthash.h sysl_tbl.h vas.h hitch_SOURCES = configuration.c ringbuffer.c hitch.c vpf.c flopen.c vas.c hitch_LDADD = $(AM_LDFLAGS) -lcrypto if USE_SHCTX hitch_SOURCES += shctx.c hitch_LDADD += ebtree/libebtree.a AM_CFLAGS += -Iebtree endif hitch-1.1.1/src/vpf.h0000644000175000017500000000327612546560025011302 00000000000000/*- * Copyright (c) 2005 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * Derived from: * $FreeBSD: src/lib/libutil/libutil.h,v 1.41 2005/08/24 17:21:38 pjd Exp $ */ #ifndef VPF_H_INCLUDED #define VPF_H_INCLUDED struct vpf_fh; struct vpf_fh *VPF_Open(const char *path, mode_t mode, pid_t *pidptr); int VPF_Write(struct vpf_fh *pfh); int VPF_Close(struct vpf_fh *pfh); int VPF_Remove(struct vpf_fh *pfh); #endif hitch-1.1.1/src/vpf.c0000644000175000017500000001271312546560025011271 00000000000000/*- * Copyright (c) 2005 Pawel Jakub Dawidek * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * Derived from: * $FreeBSD: head/lib/libutil/pidfile.c 184091 2008-10-20 17:41:08Z des $ */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include "flopen.h" #include "vpf.h" struct vpf_fh { int pf_fd; char pf_path[MAXPATHLEN + 1]; dev_t pf_dev; ino_t pf_ino; }; static int _VPF_Remove(struct vpf_fh *pfh, int freeit); static int vpf_verify(const struct vpf_fh *pfh) { struct stat sb; if (pfh == NULL || pfh->pf_fd == -1) return (EINVAL); /* * Check remembered descriptor. */ if (fstat(pfh->pf_fd, &sb) == -1) return (errno); if (sb.st_dev != pfh->pf_dev || sb.st_ino != pfh->pf_ino) return (EINVAL); return (0); } static int vpf_read(const char *path, pid_t *pidptr) { char buf[16], *endptr; int error, fd, i; fd = open(path, O_RDONLY); if (fd == -1) return (errno); i = read(fd, buf, sizeof(buf) - 1); error = errno; /* Remember errno in case close() wants to change it. */ (void)close(fd); if (i == -1) return (error); buf[i] = '\0'; *pidptr = strtol(buf, &endptr, 10); if (endptr != &buf[i]) return (EINVAL); return (0); } struct vpf_fh * VPF_Open(const char *path, mode_t mode, pid_t *pidptr) { struct vpf_fh *pfh; struct stat sb; int error, fd, len; pfh = malloc(sizeof(*pfh)); if (pfh == NULL) return (NULL); #if 0 if (path == NULL) len = snprintf(pfh->pf_path, sizeof(pfh->pf_path), "/var/run/%s.pid", getprogname()); else #endif { assert(path != NULL); len = snprintf(pfh->pf_path, sizeof(pfh->pf_path), "%s", path); } if (len >= (int)sizeof(pfh->pf_path)) { free(pfh); errno = ENAMETOOLONG; return (NULL); } /* * Open the PID file and obtain exclusive lock. * We truncate PID file here only to remove old PID immediatelly, * PID file will be truncated again in VPF_Write(), so * VPF_Write() can be called multiple times. */ fd = flopen(pfh->pf_path, O_WRONLY | O_CREAT | O_TRUNC | O_NONBLOCK, mode); if (fd == -1) { if (errno == EWOULDBLOCK && pidptr != NULL) { errno = vpf_read(pfh->pf_path, pidptr); if (errno == 0) errno = EEXIST; } free(pfh); return (NULL); } /* * Remember file information, so in VPF_Write() we are sure we write * to the proper descriptor. */ if (fstat(fd, &sb) == -1) { error = errno; (void)unlink(pfh->pf_path); (void)close(fd); free(pfh); errno = error; return (NULL); } pfh->pf_fd = fd; pfh->pf_dev = sb.st_dev; pfh->pf_ino = sb.st_ino; return (pfh); } int VPF_Write(struct vpf_fh *pfh) { char pidstr[16]; int error, fd; /* * Check remembered descriptor, so we don't overwrite some other * file if pidfile was closed and descriptor reused. */ errno = vpf_verify(pfh); if (errno != 0) { /* * Don't close descriptor, because we are not sure if it's ours. */ return (-1); } fd = pfh->pf_fd; /* * Truncate PID file, so multiple calls of VPF_Write() are allowed. */ if (ftruncate(fd, 0) == -1) { error = errno; (void)_VPF_Remove(pfh, 0); errno = error; return (-1); } error = snprintf(pidstr, sizeof(pidstr), "%ju", (uintmax_t)getpid()); assert(error < (int) sizeof pidstr); if (pwrite(fd, pidstr, strlen(pidstr), 0) != (ssize_t)strlen(pidstr)) { error = errno; (void)_VPF_Remove(pfh, 0); errno = error; return (-1); } return (0); } int VPF_Close(struct vpf_fh *pfh) { int error; error = vpf_verify(pfh); if (error != 0) { errno = error; return (-1); } if (close(pfh->pf_fd) == -1) error = errno; free(pfh); if (error != 0) { errno = error; return (-1); } return (0); } static int _VPF_Remove(struct vpf_fh *pfh, int freeit) { int error; error = vpf_verify(pfh); if (error != 0) { errno = error; return (-1); } if (unlink(pfh->pf_path) == -1) error = errno; if (close(pfh->pf_fd) == -1) { if (error == 0) error = errno; } if (freeit) free(pfh); else pfh->pf_fd = -1; if (error != 0) { errno = error; return (-1); } return (0); } int VPF_Remove(struct vpf_fh *pfh) { return (_VPF_Remove(pfh, 1)); } hitch-1.1.1/src/ringbuffer.h0000644000175000017500000000522612546560025012635 00000000000000/** * Copyright 2011 Bump Technologies, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY BUMP TECHNOLOGIES, INC. ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BUMP TECHNOLOGIES, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of Bump Technologies, Inc. * **/ #ifndef RINGBUFFER_H #define RINGBUFFER_H #include /* Tweak these for potential memory/throughput tradeoffs */ #define DEF_RING_SLOTS 3 #define DEF_RING_DATA_LEN (1024 * 32) typedef struct bufent { char *data; char *ptr; size_t left; struct bufent *next; } bufent; typedef struct ringbuffer { bufent *slots; bufent *head; // reads from the head bufent *tail; // writes to the tail int used; int num_slots; int data_len; size_t bytes_written; } ringbuffer; void ringbuffer_init(ringbuffer *rb, int num_slots, int data_len); void ringbuffer_cleanup(ringbuffer *rb); char * ringbuffer_read_next(ringbuffer *rb, int * length); void ringbuffer_read_skip(ringbuffer *rb, int length); void ringbuffer_read_pop(ringbuffer *rb); char * ringbuffer_write_ptr(ringbuffer *rb); void ringbuffer_write_append(ringbuffer *rb, int length); int ringbuffer_size(ringbuffer *rb); int ringbuffer_capacity(ringbuffer *rb); int ringbuffer_is_empty(ringbuffer *rb); int ringbuffer_is_full(ringbuffer *rb); #endif /* RINGBUFFER_H */ hitch-1.1.1/src/configuration.h0000644000175000017500000000420612617116675013357 00000000000000/** * configuration.h * * Author: Brane F. Gracnar * */ #include #include "vqueue.h" #include "uthash.h" #ifdef USE_SHARED_CACHE #include "shctx.h" #ifndef MAX_SHCUPD_PEERS #define MAX_SHCUPD_PEERS 15 #endif typedef struct shcupd_peer_opt { char *ip; char *port; } shcupd_peer_opt; #endif typedef enum { ENC_TLS, ENC_SSL } ENC_TYPE; typedef enum { SSL_SERVER, SSL_CLIENT } PROXY_MODE; struct cfg_cert_file { unsigned magic; #define CFG_CERT_FILE_MAGIC 0x58c280d2 char *filename; void *priv; int mark; unsigned ref; double mtim; UT_hash_handle hh; }; struct front_arg { unsigned magic; #define FRONT_ARG_MAGIC 0x07a16cb5 char *ip; char *port; struct cfg_cert_file *cert; char *pspec; int mark; UT_hash_handle hh; }; /* configuration structure */ struct __hitch_config { ENC_TYPE ETYPE; PROXY_MODE PMODE; int WRITE_IP_OCTET; int WRITE_PROXY_LINE_V1; int WRITE_PROXY_LINE_V2; int PROXY_PROXY_LINE; char *CHROOT; int UID; int GID; struct front_arg *LISTEN_ARGS; struct front_arg *LISTEN_DEFAULT; char *BACK_IP; char *BACK_PORT; long NCORES; struct cfg_cert_file *CERT_FILES; struct cfg_cert_file *CERT_DEFAULT; char *CIPHER_SUITE; char *ENGINE; int BACKLOG; #ifdef USE_SHARED_CACHE int SHARED_CACHE; char *SHCUPD_IP; char *SHCUPD_PORT; shcupd_peer_opt SHCUPD_PEERS[MAX_SHCUPD_PEERS+1]; char *SHCUPD_MCASTIF; char *SHCUPD_MCASTTTL; #endif int QUIET; int SYSLOG; int SYSLOG_FACILITY; int TCP_KEEPALIVE_TIME; int DAEMONIZE; int PREFER_SERVER_CIPHERS; int BACKEND_CONNECT_TIMEOUT; int SSL_HANDSHAKE_TIMEOUT; int RECV_BUFSIZE; int SEND_BUFSIZE; char* LOG_FILENAME; int RING_SLOTS; int RING_DATA_LEN; char *PIDFILE; int SNI_NOMATCH_ABORT; int TEST; }; typedef struct __hitch_config hitch_config; char * config_error_get (void); hitch_config * config_new (void); void config_destroy (hitch_config *cfg); int config_file_parse (char *file, hitch_config *cfg); int config_parse_cli(int argc, char **argv, hitch_config *cfg, int *rv); hitch-1.1.1/src/tests/0000755000175000017500000000000012650155754011555 500000000000000hitch-1.1.1/src/tests/test09-wildcard-cert0000755000175000017500000000076712614235430015275 00000000000000#/bin/bash . common.sh set +o errexit $HITCH $HITCH_ARGS --backend=[hitch-tls.org]:80 "--frontend=[${LISTENADDR}]:$LISTENPORT" certs/wildcard.example.com certs/default.example.com test "$?" = "0" || die "Hitch did not start." echo | openssl s_client -servername foo.example.com -prexit -connect $LISTENADDR:$LISTENPORT 2>/dev/null > $DUMPFILE test "$?" = "0" || die "s_client failed" grep -q -c "/CN=\*.example.com" $DUMPFILE test "$?" = "0" || die "s_client got wrong certificate in listen port #2" hitch-1.1.1/src/tests/test04-listen-with-own-certs0000755000175000017500000000177112560105637016733 00000000000000#/bin/bash # # Test multiple listening sockets, each with their own certificate. # # This implements T3 in the original test plan. . common.sh set +o errexit PORT2=$(($RANDOM + 1024)) $HITCH $HITCH_ARGS --backend=[hitch-tls.org]:80 \ "--frontend=[${LISTENADDR}]:$LISTENPORT+certs/site1.example.com" \ "--frontend=[${LISTENADDR}]:$PORT2+certs/site2.example.com" \ certs/default.example.com test "$?" = "0" || die "Hitch did not start." echo -e "\n" | openssl s_client -prexit -connect $LISTENADDR:$LISTENPORT 2>/dev/null > $DUMPFILE || die "s_client failed" grep -q -c "subject=/CN=site1.example.com" $DUMPFILE test "$?" = "0" || die "s_client got wrong certificate on listen port #1" # Second listen port. echo -e "\n" | openssl s_client -prexit -connect $LISTENADDR:$PORT2 2>/dev/null > $DUMPFILE || die "s_client failed" grep -q -c "subject=/CN=site2.example.com" $DUMPFILE test "$?" = "0" || die "s_client got wrong certificate in listen port #2" runcurl $LISTENADDR $LISTENPORT runcurl $LISTENADDR $PORT2 hitch-1.1.1/src/tests/test02-simple-request0000755000175000017500000000105012560105637015510 00000000000000#/bin/bash # Test basic argument handling. # This implements T2 in the original test plan. . common.sh set +o errexit $HITCH $HITCH_ARGS --backend=[hitch-tls.org]:80 "--frontend=[${LISTENADDR}]:$LISTENPORT" certs/site1.example.com test "$?" = "0" || die "Hitch did not start." echo -e "\n" | openssl s_client -prexit -connect $LISTENADDR:$LISTENPORT 2>/dev/null > $DUMPFILE test "$?" = "0" || die "s_client failed" grep -q -c "subject=/CN=site1.example.com" $DUMPFILE test "$?" = "0" || die "Got wrong certificate." runcurl $LISTENADDR $LISTENPORT hitch-1.1.1/src/tests/test10-dflt-certs0000755000175000017500000000371712643231500014602 00000000000000#/bin/bash # # # . common.sh set +o errexit PORT1=$(($RANDOM + 1024)) PORT2=$(($RANDOM + 1024)) PORT3=$(($RANDOM + 1024)) PORT4=$(($RANDOM + 1024)) $HITCH $HITCH_ARGS --backend=[hitch-tls.org]:80 \ --frontend=[${LISTENADDR}]:$PORT1+certs/site1.example.com \ --frontend=[${LISTENADDR}]:$PORT2+certs/site2.example.com \ --frontend=[${LISTENADDR}]:$PORT3+certs/site3.example.com \ --frontend=[${LISTENADDR}]:$PORT4 \ certs/default.example.com test "$?" = "0" || die "Hitch did not start." # :PORT1 without SNI echo | openssl s_client -prexit -connect $LISTENADDR:$PORT1 2>/dev/null > $DUMPFILE test "$?" = "0" || die "s_client failed" grep -q -c "subject=/CN=site1.example.com" $DUMPFILE test "$?" = "0" || die "s_client got wrong certificate on listen port #1" # :PORT1 w/ SNI echo | openssl s_client -servername site1.example.com -prexit -connect $LISTENADDR:$PORT1 2>/dev/null > $DUMPFILE test "$?" = "0" || die "s_client failed" grep -q -c "subject=/CN=site1.example.com" $DUMPFILE test "$?" = "0" || die "s_client got wrong certificate in listen port #2" # :PORT1 w/ different matching SNI name echo | openssl s_client -servername site3.example.com -prexit -connect $LISTENADDR:$PORT1 2>/dev/null > $DUMPFILE test "$?" = "0" || die "s_client failed" grep -q -c "subject=/CN=site3.example.com" $DUMPFILE test "$?" = "0" || die "s_client got wrong certificate in listen port #2" # :PORT2 no SNI echo | openssl s_client -prexit -connect $LISTENADDR:$PORT2 > $DUMPFILE 2>&1 test "$?" = "0" || die "s_client failed" grep -q -c "subject=/CN=site2.example.com" $DUMPFILE test "$?" = "0" || die "s_client got wrong certificate in listen port #2" # :PORT4 SNI w/ unknown servername echo | openssl s_client -servername invalid.example.com -prexit -connect $LISTENADDR:$PORT4 > $DUMPFILE 2>&1 test "$?" = "0" || die "s_client failed" grep -q -c "subject=/CN=default.example.com" $DUMPFILE test "$?" = "0" || die "s_client got wrong certificate in listen port #2" hitch-1.1.1/src/tests/runtests0000755000175000017500000000030712560105637013305 00000000000000#!/bin/bash # (until we get automake/autoconf configured right.) set -o errexit for t in test*; do echo -n -e "$t\t" bash $t if [ "$?" != "0" ]; then echo "FAILED" else echo "OK" fi done hitch-1.1.1/src/tests/test01-start-and-stop0000755000175000017500000000046512605213103015405 00000000000000#/bin/bash # Test basic argument handling. . common.sh set +o errexit $HITCH --help 1>/dev/null test "$?" = "0" || die "--help does not work." $HITCH --OBVIOUSLY_BROKEN_ARG 2>/dev/null test "$?" = "1" || die "Wrong exit code." $HITCH --version 1>/dev/null test "$?" = "0" || die "--version does not work" hitch-1.1.1/src/tests/common.sh0000644000175000017500000000130312614235430013304 00000000000000# export LC_ALL=C set -o errexit LISTENADDR="localhost" LISTENPORT=$(($RANDOM + 1024)) PIDFILE="$(mktemp -u)" CONFFILE="$(mktemp -u)" DUMPFILE="$(mktemp -u)" HITCH=../hitch HITCH_ARGS="--pidfile=$PIDFILE --daemon --quiet" if [ "$USER" == "root" ]; then HITCH_ARGS="$HITCH_ARGS --user=nobody" fi cleanup() { test -s $PIDFILE && kill `cat "$PIDFILE"` rm -f "$PIDFILE" "$CONFFILE" "$DUMPFILE" 2>/dev/null } trap cleanup EXIT die() { echo "FAILED: $*" if [ -r "$DUMPFILE" ]; then cat $DUMPFILE; fi exit 255 } runcurl() { # Verify that we got a HTTP reply. BUF=$(curl $CURL_EXTRA --silent --insecure https://$1:$2/ 2>&1) test "$?" = "0" || die "Incorrect HTTP response code." } hitch-1.1.1/src/tests/test06-ticket-resume0000755000175000017500000000142012560105637015317 00000000000000#/bin/bash # # Test resuming a session via a session ticket . common.sh set +o errexit sessfile=$(mktemp) function rmsess { rm -f $sessfile cleanup } trap rmsess EXIT $HITCH $HITCH_ARGS --backend=[hitch-tls.org]:80 "--frontend=[${LISTENADDR}]:$LISTENPORT" certs/site1.example.com test "$?" = "0" || die "Hitch did not start." echo -e "\n" | openssl s_client -prexit -sess_out $sessfile -connect $LISTENADDR:$LISTENPORT >/dev/null 2>&1 test "$?" = "0" || die "s_client failed (1)" echo -e "\n" | openssl s_client -prexit -sess_in $sessfile -connect $LISTENADDR:$LISTENPORT 2>/dev/null > $DUMPFILE test "$?" = "0" || die "s_client failed (2)" grep -q -c "Reused, " $DUMPFILE test "$?" = "0" || die "Unable to resume session via session ticket." runcurl $LISTENADDR $LISTENPORT hitch-1.1.1/src/tests/test08-test-configs0000755000175000017500000000213312642464761015156 00000000000000#/bin/bash # Test configuration parser. . common.sh set +o errexit $HITCH --test --config=configs/default.cfg certs/default.example.com 2>/dev/null 1>&2 test "$?" = "0" || die "default.cfg is not testable." $HITCH --test --config=configs/test08a.cfg certs/default.example.com 2>/dev/null 1>&2 test "$?" = "1" || die "Invalid config test08a.cfg parsed correctly." $HITCH --test --config=configs/test08b.cfg certs/default.example.com 2>/dev/null test "$?" = "1" || die "Invalid config test08b.cfg parsed correctly." $HITCH --test --config=configs/test08c.cfg certs/default.example.com 2>/dev/null test "$?" = "0" || die "Valid config test08c.cfg unparseable?" $HITCH --test --config=configs/test08d.cfg certs/default.example.com 2>/dev/null 1>&2 test "$?" = "0" || die "Valid config test08d.cfg unparseable?" # Issue #52. $HITCH --config=configs/default.cfg --help 2>/dev/null 1>&2 test "$?" = "0" || die "--help after --config does not work as expected." # Works as expected. $HITCH --test --config=configs/default.cfg 2>/dev/null 1>&2 test "$?" = "1" || die "--help with --config does not work as expected." hitch-1.1.1/src/tests/test07-nomatch-abort0000755000175000017500000000254512560105637015306 00000000000000#/bin/bash # # Test --sni-nomatch-abort # . common.sh set +o errexit #PORT2=$(($RANDOM + 1024)) $HITCH $HITCH_ARGS --backend=[hitch-tls.org]:80 --frontend=[${LISTENADDR}]:$LISTENPORT \ certs/site1.example.com certs/site2.example.com certs/default.example.com \ --sni-nomatch-abort test "$?" = "0" || die "Hitch did not start." # No SNI - should not be affected. echo -e "\n" | openssl s_client -prexit -connect $LISTENADDR:$LISTENPORT 2>/dev/null > $DUMPFILE test "$?" = "0" || die "s_client failed" grep -q -c "subject=/CN=default.example.com" $DUMPFILE test "$?" = "0" || die "s_client got wrong certificate on listen port #1" # SNI request w/ valid servername echo -e "\n" | openssl s_client -servername site1.example.com -prexit -connect $LISTENADDR:$LISTENPORT 2>/dev/null > $DUMPFILE test "$?" = "0" || die "s_client failed" grep -q -c "subject=/CN=site1.example.com" $DUMPFILE test "$?" = "0" || die "s_client got wrong certificate in listen port #2" # SNI w/ unknown servername echo | openssl s_client -servername invalid.example.com -prexit -connect $LISTENADDR:$LISTENPORT > $DUMPFILE 2>&1 test "$?" != "0" || die "s_client did NOT fail when it should have. " grep -q -c "unrecognized name" $DUMPFILE test "$?" = "0" || die "Expected 'unrecognized name' error." CURL_EXTRA="--resolve site1.example.com:$LISTENPORT:127.0.0.1" runcurl site1.example.com $LISTENPORT hitch-1.1.1/src/tests/certs/0000755000175000017500000000000012650155673012675 500000000000000hitch-1.1.1/src/tests/certs/README0000644000175000017500000000115212560105637013467 00000000000000Test certificates ================= These are self-signed certificates (and keys) used for testing hitch. They are made to last until 2025. Plenty of time! Useful commands --------------- Show certificate information: openssl x509 -text -noout -in How to generate --------------- These files were generated on Debian jessie, using the following commands: apt-get install ssl-cert /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf OUTPUTFILE openssl dhparam -rand - 1024 >> OUTPUTFILE (default|siteN).example.com are basic 2048bit RSA certificates with a single commonName set. hitch-1.1.1/src/tests/certs/wildcard.example.com0000644000175000017500000000675712614235430016545 00000000000000-----BEGIN RSA PRIVATE KEY----- MIIEpAIBAAKCAQEAssAUoT3EVWitYWl1tEx+RmRquuT8sMMr2cS68xao/hysvWrn SaxM8NYVLEWA94MekjXspQ6pe8LT03j5q6+l8TBxdUdKcb/RCuOpWteuCwv11d53 mUqf4zNvevBJA/EnNcJ5OHD571lk684a/ozmbhlBAN7UaTgRFWkc5gTR6WaZk88E 51V9wOjC8JXs+NOuju9oGxjvztrLm/ryniUawBB41GTwxoUF2ZNIXr1uccnf5knA vA/6Q2YYWyvNVRuvt5VWv/j3ilollpOaIQQZQewAzCngpsDq0o0sfzt+MDcXuMSv XUPGkbZpzBgE8uR3dOxGwBBfEUgeIUawEhz4eQIDAQABAoIBADO2fkFnrTVIY2Cb MgJHXwDebEJFnRVGYZlO4QcStzFM+mySUPdvcZL7XITCVt1EgcOq9huKcl3rr3yu swyIdGmiqjBTv6XI6KFN2+D8JM3tV+HXyqH+hOMmLkpS2czaJ43WBVve02/7XMcb iZO7D68qfzPRQ4JtRgP7tPCW1GPBXwjcuQhcCsR7FRDU90Fw8IK3moDGkaIAc2ZK pBM3WaWR7HAv31PMIS6FmXW1AnT8ZgrnfuMfamTtkcZUSlnoBveYPgLhAprQ2DxV Zoi56OqIwylQvrLxiWsLleJ0kAZ6La3hnUFmQfkWC771PEBC7DqnuFkurb0z/qxn uF5k30ECgYEA47J7zuAmzDNQmB3k31XMbSSJSs6s1F2oM7vM1H+PuRtAJTenSdX3 yOGlkvm88jeESYBpfCz/xOz2t9KsfuZPU+X3mGs+xNDrbMu2li5HYmb+9cz6bFqG iAjRHoLAxmplqc9r5QyB71Rk4hqvohFATd878n59Yoxnkq4b6EuQcY8CgYEAyPgQ 3PQaWBuqZrgzNmF1n1dHQlfbjE/mefjVnrBAhcNVl6JoU0j4iiosQCbOCgbfCeCd 0DB2pFIBwelqIDnWgB4aUbtbSQg8/i1oGjmXGiuzLVFxBTTkq2voi4c/fboDtYah AuAn+q2MOdpw4FKjWH8q/ukfGU6hFiNdRI9/YXcCgYBnyQMF2MXWbc1eiMG5yrHT TcQGhQ3h/o6chg1nDn3EMdebHzLxRMYcmj2OMKcfAI8bsZxjLV+nsxsBztUxQmkG JNwmbTu/Gjs06+Xdrlp7T9cG0teSa/DGML6g2Zhk2DpenFzhmkHfhOg251MG3DYj SI1aiq08LiNHiHTP/SFpoQKBgQDGfcRiBzLR3RlTdREX3/CFnXWDQDVXAz+XLr8G ifxgYUpzhvPVdpgMFpU4E1ujKaA3KEOWcZdsupaDyJ+KDrYeOh0ypoMFwf5D6eMN K95i+dBxrSOcyd4ktWKsFLwP2J57NupmZbD29Vwvc+HSnaw55vg3Z1bQ7wlJTUp8 QeLFBwKBgQCZ00ar4cEdrTh1+cV8G04iN49X9saXB3YkT3rujVmtJ5n/mbXPRF7i 948rtomUuyqxelzjAuYSe7zE19K66ZlYqmo8IQrwi+gcCY3VxlMo/WA9tKt41e9p T0KoIiqg0BueH7pLdWp4+xEkZvyzD4W9/y9YOXmtQ0UmpDCBPTCKZg== -----END RSA PRIVATE KEY----- -----BEGIN CERTIFICATE----- MIIEDTCCAvWgAwIBAgIJAIH1UUxrC2oyMA0GCSqGSIb3DQEBCwUAMIGcMQswCQYD VQQGEwJOTzENMAsGA1UECAwET3NsbzEZMBcGA1UECgwQVmFybmlzaCBTb2Z0d2Fy ZTENMAsGA1UEBwwET3NsbzEWMBQGA1UEAwwNKi5leGFtcGxlLmNvbTEZMBcGA1UE CwwQVmFybmlzaCBTb2Z0d2FyZTEhMB8GCSqGSIb3DQEJARYSZm9vYmFyQGV4YW1w bGUuY29tMB4XDTE1MTAyNjE1NDg0NFoXDTE4MTAyNTE1NDg0NFowgZwxCzAJBgNV BAYTAk5PMQ0wCwYDVQQIDARPc2xvMRkwFwYDVQQKDBBWYXJuaXNoIFNvZnR3YXJl MQ0wCwYDVQQHDARPc2xvMRYwFAYDVQQDDA0qLmV4YW1wbGUuY29tMRkwFwYDVQQL DBBWYXJuaXNoIFNvZnR3YXJlMSEwHwYJKoZIhvcNAQkBFhJmb29iYXJAZXhhbXBs ZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCywBShPcRVaK1h aXW0TH5GZGq65PywwyvZxLrzFqj+HKy9audJrEzw1hUsRYD3gx6SNeylDql7wtPT ePmrr6XxMHF1R0pxv9EK46la164LC/XV3neZSp/jM2968EkD8Sc1wnk4cPnvWWTr zhr+jOZuGUEA3tRpOBEVaRzmBNHpZpmTzwTnVX3A6MLwlez4066O72gbGO/O2sub +vKeJRrAEHjUZPDGhQXZk0hevW5xyd/mScC8D/pDZhhbK81VG6+3lVa/+PeKWiWW k5ohBBlB7ADMKeCmwOrSjSx/O34wNxe4xK9dQ8aRtmnMGATy5Hd07EbAEF8RSB4h RrASHPh5AgMBAAGjUDBOMB0GA1UdDgQWBBRZIQHOrBLp1fDNAqAa+2AzzzBv1TAf BgNVHSMEGDAWgBRZIQHOrBLp1fDNAqAa+2AzzzBv1TAMBgNVHRMEBTADAQH/MA0G CSqGSIb3DQEBCwUAA4IBAQCM1M6uyF9cViP+0S1R6EAsfwn2LCh+YWwL+UYM+HCp 9gA9Z6sMlBH6v3NZwrUv7LpSkr0uB+Vp71KV6WALbWx6no0aPg2IXIg0hmZnUbPP IEPYs6sMkr/uKw26YdMql0xFX3dtbXLKzn/8R5wWiCKKNg7BVo+/zBBBEkm8acSA 7bHA5Rp/oovsWzrrR7L0RQ39327fXny52b9EqA67qBhsaalw7BPHNytn9BZlva21 h7U8wyjHNFeTEQAloPlp7xtfCFYLm8W1R8glcwO15PUggKOmanic47OJpkmGWRtM 767bKE1+ZT3OgIjMVYovNO/517MgPB9kGxYy0JUjggyf -----END CERTIFICATE----- -----BEGIN DH PARAMETERS----- MIIBCAKCAQEA8H12cT21ydklGJeyztjJtYmGcNmG+gtfqR0hY2GOu/ZWIozr61EE 9157BxAz3/I5oIGTvBZeR4vn+cKF25XHYdhjU6wPR5GQ7sbf6qtM+Vo/TDwryapm WSn+ALokL30ohuzntpCS//OASLuRdGipfJ3yMgMsJhzeu6nu+4Rdq3Vw1iBDJWuM FZMRR7Pe4cgj53eNQEYdDW0yjAbpguWkzyHHh8+ttkfkSyg7Bl3pSG9r6oJeQfEv PtTIwNyM3/YgW4TG4hQJ/bS/Q0d3Eq6EaJqqa8g7zUhiisUf2neNNqVcpcD4wEGp 1ZbJIbISu8VQ/gBqyyAeLt5GP+4cL+F9CwIBAg== -----END DH PARAMETERS----- hitch-1.1.1/src/tests/certs/default.example.com0000644000175000017500000000564212560105637016375 00000000000000-----BEGIN PRIVATE KEY----- MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDOCJ5SZvnsESOd 70ni86DzSOhYBs0mkS1iorxxNgDbLIoWPhFVfBTPTn9lnUgrJPNg5GhBSoqLDLSq WCr4G4VVk+2VdFxRrG3Qch/sYtLS9q6Uyxg3gdBPPi3GtyUGhJfKFodWwMt3+2KH gSu8FwWPwTuPb5kOUmO7Pp+5g9OL4q0oyo5GY8ai7c6+GqL7JazsnnVLNVuC8uD4 o25E9ZEyMl0ntP79ImzmZJCK43EYI9uUsWngv8LyR3lGslm8LSYTONtc41HFrj2T a78oEMHhOFESNq5g8qiSXkM5F8Hql2F9aY1HKIIUq+RfbpJFH01SMk/NZ4I7MK41 7Qd0foE5AgMBAAECggEBAJ4cJQtNdRuA55lKyaO9nNU2LP9ocMTZAkBAbGZgr/WC T5HUHc9BQmL4dXGQapKZb5/6iDsargkZPge/U3JFBGRw+hEIU9Rlg3xEKFVqXSmC HuWWmcX2+9nj+JMXdvVyiV2PPlsH5tzzcGBWcy6LaDwyaLehR46jEV/fJgnirVQZ xgj03AK3SBsL4WpK3C9D9dURvsDfd15v+D8mqOhxhNF/sMFiHLMB1m+HCYChbn3T 2lkUfS5NF1Cd0NwV+fglvHjytyT+ELGoGPez1uBKxigBYmOtuIEbo3xH+jjPJuAr ZgbyPtdO9flQpqRLcW5Ie6NZlZxfA1WcVULf/198FjUCgYEA8tO+XF6sFUvwo63S uqG/y8+wCSpwwzUxU+bNtqeM3WbkTgi0AuhAWAVqaGyysCVFJ0WLK+wFOpeFIwcL vmA6sWZ26dqF/IxmvC6+ytbKKmKvMv5p3IWky20Dz8123poBKM/E7afNBKrCa3BJ 151whywgLOQ429pERDqeWbfo/IsCgYEA2TXoEKiG0/dw/3CgUkufi5+ZIzASrplj okeg1H75AeHke4avrILrc0d+9DxJ+ZIJsJ/N0b69q433MNoFcljWp7nMMxpI5w2x eC5asbopF4nmMw8Hr8iu/x+LB2XcAb4A9Mn2oJTrH3fV5VRi9Ta3i3cIswtdWUEW Dq2erK43ncsCgYApRpzhDqapqBLrf6yGVOBJQLBnnnM0e2I7JMxq8+gZ6ld8fDY9 GEV3sNP5lCB7mJo8prGVcbUh1IepAJWacrkHVqd38NE9sI/2BOwhhoku0z98p4pP FdiBS7KOLBq8k+kGiuqqiw9qb6xEnv2uTPDHyVRezRxtIpjgECbCkWRlKQKBgDIT eHXmtHbHtBhf2cY/QwAIgmCXY6c3G7487zouL7AcaPWFfpix8iA4mm8qOw+7eFps 7SFu7QFREG0Fxn2vN4Whkw8w/x+ti32eijAxL+oKU7TvwSDojleo6P+Cny8To9rL eP1ad75gfUKKqunHfJc9kRbeBt5d3/zwUAWVgKLzAoGATMWtO/KkioQK2uQLMHNs ngsp/95qR3p0PkN7odN1fKyAZ9w+XzUS3ZZ2jWWq+3aoMRJVkX0hsl64pibFkKUK 0PjzgceoRhIlswZKmQKeRPTagX2Phy27lbMOxUZi3IftcZp3N6LuYkrMmhgrg4Ir JTGbKqwPUATa1PfjFys686I= -----END PRIVATE KEY----- -----BEGIN CERTIFICATE----- MIICzDCCAbSgAwIBAgIJAKVQRZn9OSoBMA0GCSqGSIb3DQEBCwUAMB4xHDAaBgNV BAMME2RlZmF1bHQuZXhhbXBsZS5jb20wHhcNMTUwNTE5MTA1MDIzWhcNMjUwNTE2 MTA1MDIzWjAeMRwwGgYDVQQDDBNkZWZhdWx0LmV4YW1wbGUuY29tMIIBIjANBgkq hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzgieUmb57BEjne9J4vOg80joWAbNJpEt YqK8cTYA2yyKFj4RVXwUz05/ZZ1IKyTzYORoQUqKiwy0qlgq+BuFVZPtlXRcUaxt 0HIf7GLS0vaulMsYN4HQTz4txrclBoSXyhaHVsDLd/tih4ErvBcFj8E7j2+ZDlJj uz6fuYPTi+KtKMqORmPGou3Ovhqi+yWs7J51SzVbgvLg+KNuRPWRMjJdJ7T+/SJs 5mSQiuNxGCPblLFp4L/C8kd5RrJZvC0mEzjbXONRxa49k2u/KBDB4ThREjauYPKo kl5DORfB6pdhfWmNRyiCFKvkX26SRR9NUjJPzWeCOzCuNe0HdH6BOQIDAQABow0w CzAJBgNVHRMEAjAAMA0GCSqGSIb3DQEBCwUAA4IBAQB5F8NU2VSucsSDYlWkY7hB cTlkshVZl5yssrWUG0qBA6/ApuwyIv8RmAiUCtKVDaTHuWCgLPWEM4N0hJmiRE7O 8ZzxHUjqsxbcFT3EUstgBynxpYCOAsF8nePlG/8xCLUJjmL4z4GAASbqiG1R6fET JRVwlvtx/mFQx7GvEHIhW102eb800LLDDX+yxxDDbswEJ45MaPkeQ67moVVNkdZ4 s5LWJOis+aNkcWwd5eA2PGZ8QAUhcPsnmwyeke/Pcg5P8Niheelbyc2h5kJOmixn fq1WK3KrvGcCXNhvpAvaQ1qwXYBGzt9Vd56sqyk+DtlvLQG8lPbW+VtfYeE3MSrH -----END CERTIFICATE----- -----BEGIN DH PARAMETERS----- MIGHAoGBANuocow40w4uZqh+qhuFa1VfTW0+DdGkUcCKOX74+ld7ObEXMo4WYENh IyFr8OQuScchDZQf27UFrRV3bgDcNvxB2davRtgZuZf75/P33Ue0uKcFTPgWqQK0 JPAUcJ0ZDabZ+iKZx1aGuZXVz6NECacqQQBJVdctcHfqB8Cod90TAgEC -----END DH PARAMETERS----- hitch-1.1.1/src/tests/certs/733bfb5f0000644000175000017500000000563612560105637013766 00000000000000-----BEGIN PRIVATE KEY----- MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC/i7Eng68ltewd bh0wyDtwCuW1zZrZyB2VuXpO6vMbC4ogynMK2dsPFUN8oOCzLcomlyypqfVIF5hC ILFLf2oE/vY0c7ZClFdro3TNnnH0PD/x9yQsm5Qo1BBWxMlq76kCMwdb769CGU1P U/AgW+T/+gJOzfUjEj0ivs4fsVkHa1N2IpA6s6HxcSswa5WcYKYUD13o1+X9T3SM Sgp3nzGXgzUsKoiLAa8RebqpHMHnzSUW3ctW7W5N/SbrBy17LlW0M4XS1ZmcI5wp 5lMmjJvgaYWs/NapfEfFgHnl5XB6RCLbNOqwMVWbLP4OTEQhlBnambW36Ye8FUjF A6B8oEzzAgMBAAECggEAPJZ5MOCMdEc5Ko38GcQcWPJ5eqpQgvaztPp4X6Idx748 sOaYwSPsELdPI4rXyJWBTfefnwMtnOIpvTEOI61n4bCsPCclzaWSiW+osKmfrfuo 1mawQJPtp4R8rpWMiJDKSvHNMB1+uE+8jo0kdXfb1cRFGpw3ICLSx7zHAmtcl+Wk pIdjiqy87tsf9DQGqm0JMjxqPpuc2HCaFPETRPiqPmjbeXzVoRr4J4m5Di2trtZS 0Svh3/RFlpACGPi5GNdIu9yYIEjUfBH5ZBPS/Ik4TxKUQW3IOkUmtmNueCXGC5X7 NFvEA3oudhn0eGQ/EzOk6JIbMivntHKUODMve+tWQQKBgQDrbsprn6NiD6+WKiGp dn4qWPI9fIi0IqRjlB3KAbfxmQTytZc7AhDcsTww7qpAf0kWESjrebbXsFpZaUSu 3sWovmUwSEvsyTEv2UpQWzLwYPE2ZsnG8w0eUcyB/uJmchSjIi/PFRgdg8JB7Flp ByOpnex020/Cw+zWgNRTyDCM0QKBgQDQR2luWstlG4Z39nUPXMsMkmpaWmeahpnx m6NSGD9VpDThvVUycQAeijRkaPuI1g27f4ke2On0XGmEzpyB5rjT2J7jcqrPnPNL USmYJEl7YbKB9JharATllg6NSL2ooQUB+nvUNjo3kb5VD7ysh1nJ3YA7GoGXUnoX ZBPwBbvegwKBgQCN+GFYRQvhNlRL2VwzNKEgKELrkQ1ekwVOhyLvjdm+dufk9Fwd 2UER1E7XsxQ3kIoiJHboiJ0Zs97HzBL+4JeRCj86vl4Ki8h9ciq+CkDNc6gBhjpn Hmnqvqj0Ox+LZ3/KX/M0jSPdqHacCkpga022GuVcEmQmrr9DGqzvWOjuAQKBgCS7 U2a48IIGVrK1bnOlI9I1yDfjFb502pV3o1gJGrJZ4VGmeG4K68B3E0JaGXJKfeWB WodsLeaAncNkRMnMDPCflXX7dRBkV6wCxlkknSj7U+YDYxMqnzp2Ol7EY15n92Af 8tK8NYwzUePigJ3UyQsG22SRCiXLz+hsJ+/+suFNAoGATq0eCfEL75Q7su+urcJ/ ELsH6Utjx541HbfosuPGhoQ7wjyeepY6kR0Rwm/h/SbIpSywc0wHy11mlv56M1Sf sJVVegNLeLyA2jDC5oUXacwzRNFdltdEVN6F3+CEOR6IAFtJIRObL+eGS7m0chLn L7oX0xwXs7JfXyjHRJpwZ/I= -----END PRIVATE KEY----- -----BEGIN CERTIFICATE----- MIICyDCCAbCgAwIBAgIJAMdM7eXgW+95MA0GCSqGSIb3DQEBCwUAMBwxGjAYBgNV BAMMEXNpdGUzLmV4YW1wbGUuY29tMB4XDTE1MDUxOTEwNTEwM1oXDTI1MDUxNjEw NTEwM1owHDEaMBgGA1UEAwwRc2l0ZTMuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3 DQEBAQUAA4IBDwAwggEKAoIBAQC/i7Eng68ltewdbh0wyDtwCuW1zZrZyB2VuXpO 6vMbC4ogynMK2dsPFUN8oOCzLcomlyypqfVIF5hCILFLf2oE/vY0c7ZClFdro3TN nnH0PD/x9yQsm5Qo1BBWxMlq76kCMwdb769CGU1PU/AgW+T/+gJOzfUjEj0ivs4f sVkHa1N2IpA6s6HxcSswa5WcYKYUD13o1+X9T3SMSgp3nzGXgzUsKoiLAa8Rebqp HMHnzSUW3ctW7W5N/SbrBy17LlW0M4XS1ZmcI5wp5lMmjJvgaYWs/NapfEfFgHnl 5XB6RCLbNOqwMVWbLP4OTEQhlBnambW36Ye8FUjFA6B8oEzzAgMBAAGjDTALMAkG A1UdEwQCMAAwDQYJKoZIhvcNAQELBQADggEBAKvV1N5yiGDbj/j2tYTXtm/GyIGk WISB7zYL3x7L92CW8ECx1IhAx/YY3VnmRHIVKMyA6pFV2tfTdwJMrwSybbEfi88e q/xnJXPw6niUgHgMq4o7UCt2jVnkVncHj21zdUydq+KWVYodk2utVECeVI8uy//V 8Jif+z9E/CZsG84tbtHfq8ohLnosBIEbm9e6uqhivPbB+YN7uSEY/Z5ikYGU7hlN QCPSefot21XqHd/6dBYKs5mJu6VeuIwY2UkZtXfABrHzc3AfzbD9fj6kivWzqvNu erkJIZsV/I3vAwiiFM8K4hwYYxYWGMY9YCL1zkqqK8jJcVWdsUh9BkXJj7w= -----END CERTIFICATE----- -----BEGIN DH PARAMETERS----- MIGHAoGBAPbJOe3yBytYY3hjJ3ScHJx7R3vpn8MFq2N00RYYMCSraytAG596QvEo 9X/ETnzBU06nfVbJo0gKlsJfciDQbuorUGC/0LvVB9t6Nt1c4Xa5QGI7LeErfnNj CbsNgRirkh/lmn2e0HhQXaVk/vb6i8Cci927nWPWdl+M8GdnvjIjAgEC -----END DH PARAMETERS----- hitch-1.1.1/src/tests/certs/site1.example.com0000644000175000017500000000563612560105637016001 00000000000000-----BEGIN PRIVATE KEY----- MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCx17z55j38mGHB +kAcRH9l/JlGkArB7HsoeFJ5ZMT+W4IW+QTrw21tL3+iJoavnE9kURV8pQ/2C8mB lbTCY4d+7j1Jq8pnIZs9YqgwqXUizEXgqTGtxWs4I/v2QkD0DXI6y1S9DWTKKflM HNjPWaWPNIwrnQAi0bNq3PjS5x8p885+64aDQmMiMJRu7btjtuXPa4icfn7/2twq 0BVKARio15IcKgXHJCcjvVpYK4brK8E+OrzUQ6wNDMwGcckrNylIJafYAHv5wKfu 6TJLCD3RUn20PRFmBR66qap68SJAuSBJXMrtWZYXoF0qLz1QvAwmxzFq2oxpKyzQ 2R2TTKwnAgMBAAECggEASLCYckA0h+E029dQiv1IYUQs1hWcAAWLlVAQzcNtbVWz x3YDF+Zp/J3Uek9q765hGOy3bpn8+yF4PHoXRvjtcekorcsE0MCAtkdz3Wf2E8IQ sbIWNyOhHnI+0znjWJ2CWhuvyBIIZ0Veu0hzKdVHgVAGFvF2E8VIo14sae/D4h4x FMYp8Od6zyb4pEigIELQeunxQuev8SGBYzI+3EYrs9+Vl1I4TUwfjxK24gXmjyc/ pmRIsGChD5lVZHWh5WIyGaaSKISM3ZmmXz15g4eammDVwA17poKMudUZRSx16M91 w04SoQdvikk8/eoqx+7ATzZj0YSHADXMRq9/tENbaQKBgQDmJWL9QlBBqsXvtMq7 EAfqBa4JYDKz8VKcBQULA0G030MQgGws2QixzbuxJ/FaEc97qLVCzpJjL5aeAgGO UoUsrSbEycOxUaGCnY2ie8CGU2w0DqfKLuHJjOqlJMY4KNaSEWNqzQCfEi5Tn8uX 1tlWnd8rL3P5ObgS/avnjXkwXQKBgQDF0jIzuoPKL+KuBgQIeG4m9YQncpHuu/w3 4j+nD7zqL3Gvp3+UEWCrrKplwfFnUUgs8yt6kfmPIAMOxyPvFsadi3CxKIf9stR6 acvKXVeKq5PFu/3j/IYXWgPqVfgx/yOCFWsEVOP+Lpl3XeGgxe8heHFWVD7I40/Z uOqdcKIWUwKBgBf3osRvKH5+M1jQQiCS/dAAQWyWiRE2O30mBK1t7GTSr2BDj4Bo JcCmhTpgx4CyxCHDowTPEG2l4hCYcuMIcvgBHD14KZoIv0Ij+EEIlDco7ubI8+5Z TYg41aLXHpFwp0/U4b6YlMz8DrkEtiYc6Mtda4VKztAQk7vekQ1vLUS9AoGBAKat +UbEvQ67UlA3GWbZslZ5QCTM0FFLa7Tama91/0ODPlM22rQ0ADQmhFzBEVpwjlPx gI0COjhyTKFDAfAOTMOqHgXnlM4axBVw1xlnlL9u2lAdmktjFsjOO8ZTMZFO3Oha i5VWwdQGB6EgJWCF5ntZNIX87fnuLfXRbT3DDY+pAoGBAKMI3B1YIqIjR13AEKnb e5zi/oTvMszGfOtlPlNLNTVFOmQ40ZtCLxFPTVro2rSR40fNmA8BuBmVdb2jM860 N6opPVlWDROrz1/FNXZVoEvk94Ip50eNXC0OCJr5pRGshTYTjle0kXU40RJquj+d /2NZsggs386IXfST4tsTOgbJ -----END PRIVATE KEY----- -----BEGIN CERTIFICATE----- MIICyDCCAbCgAwIBAgIJAJEPAZDkTVHzMA0GCSqGSIb3DQEBCwUAMBwxGjAYBgNV BAMMEXNpdGUxLmV4YW1wbGUuY29tMB4XDTE1MDUxOTEwNTA0MloXDTI1MDUxNjEw NTA0MlowHDEaMBgGA1UEAwwRc2l0ZTEuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3 DQEBAQUAA4IBDwAwggEKAoIBAQCx17z55j38mGHB+kAcRH9l/JlGkArB7HsoeFJ5 ZMT+W4IW+QTrw21tL3+iJoavnE9kURV8pQ/2C8mBlbTCY4d+7j1Jq8pnIZs9Yqgw qXUizEXgqTGtxWs4I/v2QkD0DXI6y1S9DWTKKflMHNjPWaWPNIwrnQAi0bNq3PjS 5x8p885+64aDQmMiMJRu7btjtuXPa4icfn7/2twq0BVKARio15IcKgXHJCcjvVpY K4brK8E+OrzUQ6wNDMwGcckrNylIJafYAHv5wKfu6TJLCD3RUn20PRFmBR66qap6 8SJAuSBJXMrtWZYXoF0qLz1QvAwmxzFq2oxpKyzQ2R2TTKwnAgMBAAGjDTALMAkG A1UdEwQCMAAwDQYJKoZIhvcNAQELBQADggEBAI/nbQA9Jcx0Yvzug1I59/9DHXL2 DRcnhcnRP1OjL08TH79Wnsm11FtKXHcu00vYjEDbpjDroFWcQbQhTXy+5Bn9qTXU 2dFIPYU3NaMzifxcN5GgbhkEWD6F/QQG7pu0rvAQyanrMvyBV7qYO/0X6GfL9VLo qcqaUU2fA/7Po10iHeiphgxD+NhyM0OuBNvXJZyqx7wWqJLgTUJKfBxjHgvSqFwO 3qg3TqMlIpDqWy3WBY0NK0AlcD6K/Nvww/QBd2bl+8K2tvBGie2qTS2nVcBc9YVY 0c3v+VMUmvPTJqRvCicyOTfoR4yL5Nqj0bo9+RsdvziNyrhcPHUB7ssxRyo= -----END CERTIFICATE----- -----BEGIN DH PARAMETERS----- MIGHAoGBAObzCZWZ2QBmxGYQ/9yyX4IHjfKpnVIN9n6xV4rksZpzYAQB078GgfPZ KeE2mDwEsmj8gXwg5GZM6RB4nBDpuGIJb1ZEfzLij5Erj5rTvifgn/h7pZPdvJjt YeKgzBih3GhD6CEUrfqV6CktkwqFH+gfEghZbCUVoSaB4tw4zawTAgEC -----END DH PARAMETERS----- hitch-1.1.1/src/tests/certs/site2.example.com0000644000175000017500000000563612560105637016002 00000000000000-----BEGIN PRIVATE KEY----- MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCgwATitq8V+zkN tlxZYtzA/LEyOkWszPTR4sCQRZihZx/YuMGX7/TcyEl3X/r4c/nlMTnU5U3nUUZv 5JKZdMyMVD6cd2GOdWTI17tTrvMrxBgRa538jnKL0SPcXFiSzzUacoRqDdA/WnJm Vbn7F9L8mbThwYumKnYOK54PisixLel8fhGypiKyeKQ3zP8SecRk8jvkdIltvHXw oI+YDZXy1qqXsDuDoE6PGh+1rKEQdyGjDzCFwUcUGLURcHKu3elESEi7QE03hQsj nJXTMc0xg2v3dxEnhkUaV3KKMFrDz7OVa9prkqPUI7+hOK9J6bWXGc7PWRzsMQbO LGeTxn4ZAgMBAAECggEBAIJzUYOqPOvZs7MtCkR/tiXm6uWX5HMW4JZzLVHnKLXS ukVlqbVjRZLl9ripa0G03FbiW8wpSc8uZbroAxAFePloZGcVelXhbqiOaba/gxdB S0bXzp3l+477ad6qEjcRcEbGKC7ohtbiz3O8nfDmpJHZKrEKIAn461UUkHCMb9FX 527BejW8Yu4DiKxBHo+WW6ukezS8BQP1e1L2MUXvEr5EnWK+0ADVh9NDPh8RgvZf p8Im/iaBH+8ptyFEMkV8Paacow19cSBoN0BVh5KP+5b+H3xuXYEvUVtEKVcCmUyD slr++fWJuN3ugnCT+lzs/cWHyTzLWSb7kP3Z3C/J5wECgYEA0hu2ShOxqYRvbyIO VoEC2DxHPP3Sm6d9Gx+/jS+tOXjG37BM0Rc+E3HZmj2ZGXuKUcH3QPO12nVKjFjE GKpUVexJAhoAn3NzpJizGhA/uu4GjGQjY8aDoX7Fvp6aWYDGFbScbl9saIDODwhD vEAupB8dKaIPo0dOBcUOAatAYbMCgYEAw9xstEFZZi8VREIPAsAJC0N3+nd21INs pLXW0q06Cu4WvrMwpjBwXDBMc76MIFfDFBs/Du2K7mPrPZ3k8Ov6ANikCviVBM3N 0itZ42K3eKktv0FQx6S47EJvfFaUikbnHoAmMeEAu5jEb8E0gvnUgkjTmhCJwS4u 03la9gj+wwMCgYBzwQS65wK4S9hAt9iCW+0/SGZO+d/wFWRdby5PEHc09I9MaYrI ny958v1ZdppEacWYqW4ZAKutwXTiwXy3wg9Yjybh24WAU1Dg26fAsjcKO1ysN/cv XwziCj/Tdvm+Wa3IA4szW6sUH/JmYb0/l3SawvGEIF7RK9WWZCwFS13a9QKBgHfv CzWZ6qdy31/r34s8ko0uJFLgQojBbY6ytrhNUQSOZKkjyv+JG9Sn0rjxjpbjhtZS FNwMQ43U66DQhfetWGqaPmFldML7TzSKTUG7GkQtvJCn61JFIOOzjtchoVXHMxFv QXQ7ppo5YthYA9LMLwAUnlZyGBiOMihW4IdWXMKHAoGAGRRg8fL/U+w3UaXAEuMY dg5fTOp006lFy4M/9nuxbYoARKS16VK14ai1PNQicJJ8iVWmzULJvzhe9NRuuOLp ZMJj0y2DHkNrZVwmCZp2dyKPAoaOu2wt1XIEAnh0mZWFs+pGi0R+rt9qaoPkOEdd f1dua1DbcN79MyX5scrBkjs= -----END PRIVATE KEY----- -----BEGIN CERTIFICATE----- MIICyDCCAbCgAwIBAgIJAJz3jnCmy88MMA0GCSqGSIb3DQEBCwUAMBwxGjAYBgNV BAMMEXNpdGUyLmV4YW1wbGUuY29tMB4XDTE1MDUxOTEwNTA1MloXDTI1MDUxNjEw NTA1MlowHDEaMBgGA1UEAwwRc2l0ZTIuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3 DQEBAQUAA4IBDwAwggEKAoIBAQCgwATitq8V+zkNtlxZYtzA/LEyOkWszPTR4sCQ RZihZx/YuMGX7/TcyEl3X/r4c/nlMTnU5U3nUUZv5JKZdMyMVD6cd2GOdWTI17tT rvMrxBgRa538jnKL0SPcXFiSzzUacoRqDdA/WnJmVbn7F9L8mbThwYumKnYOK54P isixLel8fhGypiKyeKQ3zP8SecRk8jvkdIltvHXwoI+YDZXy1qqXsDuDoE6PGh+1 rKEQdyGjDzCFwUcUGLURcHKu3elESEi7QE03hQsjnJXTMc0xg2v3dxEnhkUaV3KK MFrDz7OVa9prkqPUI7+hOK9J6bWXGc7PWRzsMQbOLGeTxn4ZAgMBAAGjDTALMAkG A1UdEwQCMAAwDQYJKoZIhvcNAQELBQADggEBAGnB1SB16rtHwQlPwA9KnhzD6Vmr Vx4q+L3hm9FAaTnc0fsKiavfH0DowmaAnD4RFlp/TmVwrb0LyFee8H+IXtDlrWY+ OTG13AaulXeGf+7l3BjvzNXkyg8LcsarQa4AF0cpVBCyZvWGDl/K5nuBTHu8J9Hi Uq+Yiq33nqU9/bWBC5SW7tHRICVeI2jQ2x5O/jT08JHkwf84klurTcNBRJ1LIb0+ 97v5FT2Fzb9W0cSdfopqzRhXqsJr3kA3+y9XPIXY0NdYwS1NCfgEfdvFXh7Soyce G2Wc0zMCp+JwCihvWRnAqwcxB1hWj2NdSopYIdvNYqa5FMI2HTJ/Aml5iAI= -----END CERTIFICATE----- -----BEGIN DH PARAMETERS----- MIGHAoGBALvVNh6W7TE1y0sVBgLsoJWgH+bJ3FIUqXnGzbKWfY3u0DD5NAlFACxd HLUcuLHYdExSOOipZLJgijy88u9LiIf1V2mEBbHQvIIF+uOPvedIGgJyrKX6UJRS HqwmuL+wv1Z7Ulrln+Sa5yXziBthKBwHIvYVnmmnsWMTi2w+Vl5rAgEC -----END DH PARAMETERS----- hitch-1.1.1/src/tests/certs/site3.example.com0000644000175000017500000000000012560105637024006 1hitch-1.1.1/src/tests/certs/733bfb5f00000000000000hitch-1.1.1/src/tests/certs/47b804e60000644000175000017500000000000012560105637023647 1hitch-1.1.1/src/tests/certs/site2.example.com00000000000000hitch-1.1.1/src/tests/certs/19b579440000644000175000017500000000000012560105637023573 1hitch-1.1.1/src/tests/certs/site1.example.com00000000000000hitch-1.1.1/src/tests/certs/e690c8b80000644000175000017500000000000012560105637024332 1hitch-1.1.1/src/tests/certs/default.example.com00000000000000hitch-1.1.1/src/tests/test05-multiple-listen-SNI0000755000175000017500000000175512650155660016327 00000000000000#/bin/bash # # Test multiple certificates (SNI) on a listening socket. # # This implements T4 in the original test plan. . common.sh set +o errexit #PORT2=$(($RANDOM + 1024)) $HITCH $HITCH_ARGS --backend=[hitch-tls.org]:80 --frontend=[${LISTENADDR}]:$LISTENPORT \ certs/site1.example.com certs/site2.example.com certs/default.example.com test "$?" = "0" || die "Hitch did not start." echo -e "\n" | openssl s_client -prexit -connect $LISTENADDR:$LISTENPORT 2>/dev/null > $DUMPFILE test "$?" = "0" || die "s_client failed" grep -q -c "subject=/CN=default.example.com" $DUMPFILE test "$?" = "0" || die "s_client got wrong certificate on listen port #1" # send a SNI request echo -e "\n" | openssl s_client -servername site1.example.com -prexit -connect $LISTENADDR:$LISTENPORT 2>/dev/null > $DUMPFILE test "$?" = "0" || die "s_client failed" grep -q -c "subject=/CN=site1.example.com" $DUMPFILE test "$?" = "0" || die "s_client got wrong certificate in listen port #2" runcurl $LISTENADDR $LISTENPORT hitch-1.1.1/src/tests/configs/0000755000175000017500000000000012560105637013200 500000000000000hitch-1.1.1/src/tests/configs/test08b.cfg0000644000175000017500000000044512560105637015075 00000000000000frontend = "[*]:8443" backend = "[127.0.0.1]:6086" ciphers = "HIGH" prefer-server-ciphers = off ssl-engine = "" workers = -1 backlog = 50 keepalive = 3600 chroot = "" user = "nobody" group = "nogroup" quiet = on syslog = on syslog-facility = "info" daemon = on write-ip = off write-proxy = on hitch-1.1.1/src/tests/configs/test08d.cfg0000644000175000017500000000052112560105637015072 00000000000000# Test extra whitespace. frontend = "[*]:8443" backend = "[127.0.0.1]:6086" ciphers = "HIGH" prefer-server-ciphers = off ssl-engine = "" workers = 4 backlog = 50 keepalive = 3600 chroot = "" user = "nobody" group = "nogroup" quiet = on syslog = on syslog-facility = "daemon" daemon = "on" write-ip = off write-proxy = on hitch-1.1.1/src/tests/configs/default.cfg0000644000175000017500000000506012560105637015226 00000000000000# # hitch(8), The Scalable TLS Unwrapping Daemon's configuration # # NOTE: all config file parameters can be overriden # from command line! # Listening address. REQUIRED. # Can be specified multiple times for multiple listen endpoints. # type: string # syntax: [HOST]:PORT[+CERT] frontend = "[*]:8443" # Upstream server address. REQUIRED. # # type: string # syntax: [HOST]:PORT. backend = "[127.0.0.1]:8000" # SSL x509 certificate file. REQUIRED. # List multiple certs to use SNI. Certs are used in the order they # are listed; the last cert listed will be used if none of the others match # # type: string pem-file = "" # SSL protocol. # # tls = on # ssl = off # List of allowed SSL ciphers. # # Run openssl ciphers for list of available ciphers. # type: string ciphers = "" # Enforce server cipher list order # # type: boolean prefer-server-ciphers = off # Use specified SSL engine # # type: string ssl-engine = "" # Number of worker processes # # type: integer workers = 1 # Listen backlog size # # type: integer backlog = 100 # TCP socket keepalive interval in seconds # # type: integer keepalive = 3600 # Chroot directory # # type: string chroot = "" # Set uid after binding a socket # # type: string user = "" # Set gid after binding a socket # # type: string group = "" # Quiet execution, report only error messages # # type: boolean quiet = off # Use syslog for logging # # type: boolean syslog = off # Syslog facility to use # # type: string syslog-facility = "daemon" # Run as daemon # # type: boolean daemon = off # Report client address by writing IP before sending data # # NOTE: This option is mutually exclusive with option write-proxy-v2, write-proxy and proxy-proxy. # # type: boolean write-ip = off # Report client address using SENDPROXY protocol, see # http://haproxy.1wt.eu/download/1.5/doc/proxy-protocol.txt # for details. # # NOTE: This option is mutually exclusive with option write-proxy-v2, write-ip and proxy-proxy. # # type: boolean write-proxy = off # Report client address using SENDPROXY v2 binary protocol, see # http://haproxy.1wt.eu/download/1.5/doc/proxy-protocol.txt # for details. # # NOTE: This option is mutually exclusive with option write-ip, write-proxy and proxy-proxy. # # type: boolean write-proxy-v2 = off # Proxy an existing SENDPROXY protocol header through this request. # # NOTE: This option is mutually exclusive with option write-proxy-v2, write-ip and write-proxy. # # type: boolean proxy-proxy = off # Abort handshake when the client submits an unrecognized SNI server name. # # type: boolean sni-nomatch-abort = off # EOF hitch-1.1.1/src/tests/configs/test08c.cfg0000644000175000017500000000044612560105637015077 00000000000000frontend = "[*]:8443" backend = "[127.0.0.1]:6086" ciphers = "HIGH" prefer-server-ciphers = off ssl-engine = "" workers = 4 backlog = 50 keepalive = 3600 chroot = "" user = "nobody" group = "nogroup" quiet = on syslog = on syslog-facility = "daemon" daemon = on write-ip = off write-proxy = on hitch-1.1.1/src/tests/configs/test08a.cfg0000644000175000017500000000045412560105637015074 00000000000000frontend = "[*]:8443" backend = "[127.0.0-1]:6086" ciphers = "chrooert.pem" ciphers = "chrootprefe[-server-ciphers = off ssl-engine = "" workers = 4 backlog =a50 keepalive = 3600 chroot = "" user = "nobody" group = "nogroup" quiet = on syslog = on quiet = on aemon = onwrite-ip =oxy = on syslog = on hitch-1.1.1/src/tests/test03-multiple-listen0000755000175000017500000000150112560105637015662 00000000000000#/bin/bash # # Test multiple listening sockets. # # This implements T3 in the original test plan. . common.sh PORT2=$(($RANDOM + 1024)) $HITCH $HITCH_ARGS --backend=[hitch-tls.org]:80 \ "--frontend=[${LISTENADDR}]:$LISTENPORT" \ "--frontend=[${LISTENADDR}]:$PORT2" \ certs/site1.example.com test "$?" = "0" || die "Hitch did not start." echo -e "\n" | openssl s_client -prexit -connect $LISTENADDR:$LISTENPORT 2>/dev/null > $DUMPFILE test "$?" = "0" || die "s_client failed" #cat $DUMPFILE grep -q -c "subject=/CN=site1.example.com" $DUMPFILE # Second listen port. echo -e "\n" | openssl s_client -prexit -connect $LISTENADDR:$PORT2 2>/dev/null > $DUMPFILE test "$?" = "0" || die "s_client failed" #cat $DUMPFILE grep -q -c "subject=/CN=site1.example.com" $DUMPFILE runcurl $LISTENADDR $LISTENPORT runcurl $LISTENADDR $PORT2 hitch-1.1.1/src/vas.c0000644000175000017500000000476112644742347011303 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2016 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * This is the default backend function for libvarnish' assert facilities. */ #include "config.h" #include #include #include #include #include "vas.h" static void __attribute__((__noreturn__)) VAS_Fail_default(const char *func, const char *file, int line, const char *cond, enum vas_e kind) { int err = errno; if (kind == VAS_MISSING) { fprintf(stderr, "Missing error handling code in %s(), %s line %d:\n" " Condition(%s) not true.\n", func, file, line, cond); } else if (kind == VAS_INCOMPLETE) { fprintf(stderr, "Incomplete code in %s(), %s line %d:\n", func, file, line); } else if (kind == VAS_WRONG) { fprintf(stderr, "Wrong turn in %s(), %s line %d: %s\n", func, file, line, cond); } else { fprintf(stderr, "Assert error in %s(), %s line %d:\n" " Condition(%s) not true.\n", func, file, line, cond); } if (err) fprintf(stderr, " errno = %d (%s)\n", err, strerror(err)); abort(); } vas_f *VAS_Fail __attribute__((__noreturn__)) = VAS_Fail_default; hitch-1.1.1/src/miniobj.h0000644000175000017500000000311012546560025012121 00000000000000/* * Written by Poul-Henning Kamp * * This file is in the public domain. * */ #define INIT_OBJ(to, type_magic) \ do { \ (void)memset(to, 0, sizeof *to); \ (to)->magic = (type_magic); \ } while (0) #define ALLOC_OBJ(to, type_magic) \ do { \ (to) = calloc(sizeof *(to), 1); \ if ((to) != NULL) \ (to)->magic = (type_magic); \ } while (0) #define FREE_OBJ(to) \ do { \ (to)->magic = (0); \ free(to); \ to = NULL; \ } while (0) #define VALID_OBJ(ptr, type_magic) \ ((ptr) != NULL && (ptr)->magic == (type_magic)) #define CHECK_OBJ(ptr, type_magic) \ do { \ assert((ptr)->magic == type_magic); \ } while (0) #define CHECK_OBJ_NOTNULL(ptr, type_magic) \ do { \ assert((ptr) != NULL); \ assert((ptr)->magic == type_magic); \ } while (0) #define CHECK_OBJ_ORNULL(ptr, type_magic) \ do { \ if ((ptr) != NULL) \ assert((ptr)->magic == type_magic); \ } while (0) #define CAST_OBJ(to, from, type_magic) \ do { \ (to) = (from); \ if ((to) != NULL) \ CHECK_OBJ((to), (type_magic)); \ } while (0) #define CAST_OBJ_NOTNULL(to, from, type_magic) \ do { \ (to) = (from); \ assert((to) != NULL); \ CHECK_OBJ((to), (type_magic)); \ } while (0) #define REPLACE(ptr, val) \ do { \ if ((ptr) != NULL) \ free(ptr); \ if ((val) != NULL) { \ ptr = strdup(val); \ AN((ptr)); \ } else { \ ptr = NULL; \ } \ } while (0) hitch-1.1.1/src/vas.h0000644000175000017500000000576412644705273011311 00000000000000/*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2006-2011 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * assert(), AN() and AZ() are static checks that should not happen. * In general asserts should be cheap, such as checking return * values and similar. * diagnostic() are asserts which are so expensive that we may want * to compile them out for performance at a later date. * xxxassert(), XXXAN() and XXXAZ() marks conditions we ought to * handle gracefully, such as malloc failure. */ #ifndef VAS_H_INCLUDED #define VAS_H_INCLUDED enum vas_e { VAS_WRONG, VAS_MISSING, VAS_ASSERT, VAS_INCOMPLETE, }; typedef void vas_f(const char *, const char *, int, const char *, enum vas_e); extern vas_f *VAS_Fail __attribute__((__noreturn__)); #ifdef WITHOUT_ASSERTS #define assert(e) ((void)(e)) #else /* WITH_ASSERTS */ #define assert(e) \ do { \ if (!(e)) { \ VAS_Fail(__func__, __FILE__, __LINE__, \ #e, VAS_ASSERT); \ } \ } while (0) #endif #define xxxassert(e) \ do { \ if (!(e)) { \ VAS_Fail(__func__, __FILE__, __LINE__, \ #e, VAS_MISSING); \ } \ } while (0) /* Assert zero return value */ #define AZ(foo) do { assert((foo) == 0); } while (0) #define AN(foo) do { assert((foo) != 0); } while (0) #define XXXAZ(foo) do { xxxassert((foo) == 0); } while (0) #define XXXAN(foo) do { xxxassert((foo) != 0); } while (0) #define diagnostic(foo) assert(foo) #define WRONG(expl) \ do { \ VAS_Fail(__func__, __FILE__, __LINE__, expl, VAS_WRONG); \ } while (0) #define INCOMPL() \ do { \ VAS_Fail(__func__, __FILE__, __LINE__, \ "", VAS_INCOMPLETE); \ } while (0) #endif hitch-1.1.1/src/shctx.c0000644000175000017500000002425212546560025011630 00000000000000/* * shctx.c * * Copyright (C) 2011 EXCELIANCE * * Author: Emeric Brun - emeric@exceliance.fr * */ #include #ifdef USE_SYSCALL_FUTEX #include #include #include #else /* USE_SYSCALL_FUTEX */ #include #endif /* USE_SYSCALL_FUTEX */ #include "ebtree/ebmbtree.h" #include "shctx.h" struct shared_session { struct ebmb_node key; unsigned char key_data[SSL_MAX_SSL_SESSION_ID_LENGTH]; long c_date; int data_len; unsigned char data[SHSESS_MAX_DATA_LEN]; struct shared_session *p; struct shared_session *n; }; struct shared_context { #ifdef USE_SYSCALL_FUTEX unsigned int waiters; #else /* USE_SYSCALL_FUTEX */ pthread_mutex_t mutex; #endif struct shared_session active; struct shared_session free; }; /* Static shared context */ static struct shared_context *shctx = NULL; /* Callbacks */ static void (*shared_session_new_cbk)(unsigned char *session, unsigned int session_len, long cdate); /* Lock functions */ #ifdef USE_SYSCALL_FUTEX static inline unsigned int xchg(unsigned int *ptr, unsigned int x) { __asm volatile("lock xchgl %0,%1" : "=r" (x), "+m" (*ptr) : "0" (x) : "memory"); return x; } static inline unsigned int cmpxchg(unsigned int *ptr, unsigned int old, unsigned int new) { unsigned int ret; __asm volatile("lock cmpxchgl %2,%1" : "=a" (ret), "+m" (*ptr) : "r" (new), "0" (old) : "memory"); return ret; } static inline unsigned char atomic_inc(unsigned int *ptr) { unsigned char ret; __asm volatile("lock incl %0\n" "setne %1\n" : "+m" (*ptr), "=qm" (ret) : : "memory"); return ret; } static inline unsigned char atomic_dec(unsigned int *ptr) { unsigned char ret; __asm volatile("lock decl %0\n" "setne %1\n" : "+m" (*ptr), "=qm" (ret) : : "memory"); return ret; } static inline void shared_context_lock(void) { unsigned int x; x = cmpxchg(&shctx->waiters, 0, 1); if (x) { if (x != 2) x = xchg(&shctx->waiters, 2); while (x) { syscall(SYS_futex, &shctx->waiters, FUTEX_WAIT, 2, NULL, 0, 0); x = xchg(&shctx->waiters, 2); } } } static inline void shared_context_unlock(void) { if (atomic_dec(&shctx->waiters)) { shctx->waiters = 0; syscall(SYS_futex, &shctx->waiters, FUTEX_WAKE, 1, NULL, 0, 0); } } #else /* USE_SYSCALL_FUTEX */ #define shared_context_lock(v) pthread_mutex_lock(&shctx->mutex) #define shared_context_unlock(v) pthread_mutex_unlock(&shctx->mutex) #endif /* List Macros */ #define shsess_unset(s) (s)->n->p = (s)->p; \ (s)->p->n = (s)->n; #define shsess_set_free(s) shsess_unset(s) \ (s)->p = &shctx->free; \ (s)->n = shctx->free.n; \ shctx->free.n->p = s; \ shctx->free.n = s; #define shsess_set_active(s) shsess_unset(s) \ (s)->p = &shctx->active; \ (s)->n = shctx->active.n; \ shctx->active.n->p = s; \ shctx->active.n = s; #define shsess_get_next() (shctx->free.p == shctx->free.n) ? \ shctx->active.p : shctx->free.p; /* Tree Macros */ #define shsess_tree_delete(s) ebmb_delete(&(s)->key); #define shsess_tree_insert(s) (struct shared_session *)ebmb_insert(&shctx->active.key.node.branches, \ &(s)->key, SSL_MAX_SSL_SESSION_ID_LENGTH); #define shsess_tree_lookup(k) (struct shared_session *)ebmb_lookup(&shctx->active.key.node.branches, \ (k), SSL_MAX_SSL_SESSION_ID_LENGTH); /* Other Macros */ #define shsess_set_key(s,k,l) { memcpy((s)->key_data, (k), (l)); \ if ((l) < SSL_MAX_SSL_SESSION_ID_LENGTH) \ memset((s)->key_data+(l), 0, SSL_MAX_SSL_SESSION_ID_LENGTH-(l)); }; /* SSL context callbacks */ /* SSL callback used on new session creation */ int shctx_new_cb(SSL *ssl, SSL_SESSION *sess) { (void)ssl; struct shared_session *shsess; unsigned char *data,*p; unsigned int data_len; unsigned char encsess[SHSESS_MAX_ENCODED_LEN]; /* check if session reserved size in aligned buffer is large enougth for the ASN1 encode session */ data_len=i2d_SSL_SESSION(sess, NULL); if(data_len > SHSESS_MAX_DATA_LEN) return 1; /* process ASN1 session encoding before the lock: lower cost */ p = data = encsess+SSL_MAX_SSL_SESSION_ID_LENGTH; i2d_SSL_SESSION(sess, &p); shared_context_lock(); shsess = shsess_get_next(); shsess_tree_delete(shsess); shsess_set_key(shsess, sess->session_id, sess->session_id_length); /* it returns the already existing node or current node if none, never returns null */ shsess = shsess_tree_insert(shsess); /* store ASN1 encoded session into cache */ shsess->data_len = data_len; memcpy(shsess->data, data, data_len); /* store creation date */ shsess->c_date = SSL_SESSION_get_time(sess); shsess_set_active(shsess); shared_context_unlock(); if (shared_session_new_cbk) { /* if user level callback is set */ /* copy sessionid padded with 0 into the sessionid + data aligned buffer */ memcpy(encsess, sess->session_id, sess->session_id_length); if (sess->session_id_length < SSL_MAX_SSL_SESSION_ID_LENGTH) memset(encsess+sess->session_id_length, 0, SSL_MAX_SSL_SESSION_ID_LENGTH-sess->session_id_length); shared_session_new_cbk(encsess, SSL_MAX_SSL_SESSION_ID_LENGTH+data_len, SSL_SESSION_get_time(sess)); } return 0; /* do not increment session reference count */ } /* SSL callback used on lookup an existing session cause none found in internal cache */ SSL_SESSION *shctx_get_cb(SSL *ssl, unsigned char *key, int key_len, int *do_copy) { (void)ssl; struct shared_session *shsess; unsigned char data[SHSESS_MAX_DATA_LEN], *p; unsigned char tmpkey[SSL_MAX_SSL_SESSION_ID_LENGTH]; unsigned int data_len; long cdate; SSL_SESSION *sess; /* allow the session to be freed automatically by openssl */ *do_copy = 0; /* tree key is zeros padded sessionid */ if ( key_len < SSL_MAX_SSL_SESSION_ID_LENGTH ) { memcpy(tmpkey, key, key_len); memset(tmpkey+key_len, 0, SSL_MAX_SSL_SESSION_ID_LENGTH-key_len); key = tmpkey; } /* lock cache */ shared_context_lock(); /* lookup for session */ shsess = shsess_tree_lookup(key); if(!shsess) { /* no session found: unlock cache and exit */ shared_context_unlock(); return NULL; } /* backup creation date to reset in session after ASN1 decode */ cdate = shsess->c_date; /* copy ASN1 session data to decode outside the lock */ data_len = shsess->data_len; memcpy(data, shsess->data, shsess->data_len); shsess_set_active(shsess); shared_context_unlock(); /* decode ASN1 session */ p = data; sess = d2i_SSL_SESSION(NULL, (const unsigned char **)&p, data_len); /* reset creation date */ if (sess) SSL_SESSION_set_time(sess, cdate); return sess; } /* SSL callback used to signal session is no more used in internal cache */ void shctx_remove_cb(SSL_CTX *ctx, SSL_SESSION *sess) { (void)ctx; struct shared_session *shsess; unsigned char tmpkey[SSL_MAX_SSL_SESSION_ID_LENGTH]; unsigned char *key = sess->session_id; /* tree key is zeros padded sessionid */ if ( sess->session_id_length < SSL_MAX_SSL_SESSION_ID_LENGTH ) { memcpy(tmpkey, sess->session_id, sess->session_id_length); memset(tmpkey+sess->session_id_length, 0, SSL_MAX_SSL_SESSION_ID_LENGTH-sess->session_id_length); key = tmpkey; } shared_context_lock(); /* lookup for session */ shsess = shsess_tree_lookup(key); if ( shsess ) { shsess_set_free(shsess); } /* unlock cache */ shared_context_unlock(); } /* User level function called to add a session to the cache (remote updates) */ void shctx_sess_add(const unsigned char *encsess, unsigned int len, long cdate) { struct shared_session *shsess; /* check buffer is at least padded key long + 1 byte and data_len not too long */ if ( (len <= SSL_MAX_SSL_SESSION_ID_LENGTH) || (len > SHSESS_MAX_DATA_LEN+SSL_MAX_SSL_SESSION_ID_LENGTH) ) return; shared_context_lock(); shsess = shsess_get_next(); shsess_tree_delete(shsess); shsess_set_key(shsess, encsess, SSL_MAX_SSL_SESSION_ID_LENGTH); /* it returns the already existing node or current node if none, never returns null */ shsess = shsess_tree_insert(shsess); /* store into cache and update earlier on session get events */ if (cdate) shsess->c_date = (long)cdate; /* copy ASN1 session data into cache */ shsess->data_len = len-SSL_MAX_SSL_SESSION_ID_LENGTH; memcpy(shsess->data, encsess+SSL_MAX_SSL_SESSION_ID_LENGTH, shsess->data_len); shsess_set_active(shsess); shared_context_unlock(); } /* Function used to set a callback on new session creation */ void shsess_set_new_cbk(void (*func)(unsigned char *, unsigned int, long)) { shared_session_new_cbk = func; } /* Init shared memory context if not allocated and set SSL context callbacks * size is the max number of stored session * Returns: -1 on alloc failure, size if performs context alloc, and 0 if just perform * callbacks registration */ int shared_context_init(SSL_CTX *ctx, int size) { int ret = 0; if (!shctx) { int i; #ifndef USE_SYSCALL_FUTEX pthread_mutexattr_t attr; #endif /* USE_SYSCALL_FUTEX */ struct shared_session *prev,*cur; shctx = (struct shared_context *)mmap(NULL, sizeof(struct shared_context)+(size*sizeof(struct shared_session)), PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0); if (!shctx || shctx == MAP_FAILED) return -1; #ifdef USE_SYSCALL_FUTEX shctx->waiters = 0; #else pthread_mutexattr_init(&attr); pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); pthread_mutex_init(&shctx->mutex, &attr); #endif memset(&shctx->active.key, 0, sizeof(struct ebmb_node)); memset(&shctx->free.key, 0, sizeof(struct ebmb_node)); /* No duplicate authorized in tree: */ shctx->active.key.node.branches.b[1] = (void *)1; cur = &shctx->active; cur->n = cur->p = cur; cur = &shctx->free; for ( i = 0 ; i < size ; i++) { prev = cur; cur = (struct shared_session *)((char *)prev + sizeof(struct shared_session)); prev->n = cur; cur->p = prev; } cur->n = &shctx->free; shctx->free.p = cur; ret = size; } /* set SSL internal cache size to external cache / 8 + 123 */ SSL_CTX_sess_set_cache_size(ctx, size >> 3 | 0x3ff); /* Set callbacks */ SSL_CTX_sess_set_new_cb(ctx, shctx_new_cb); SSL_CTX_sess_set_get_cb(ctx, shctx_get_cb); SSL_CTX_sess_set_remove_cb(ctx, shctx_remove_cb); return ret; } hitch-1.1.1/CHANGES.rst0000644000175000017500000001065012651710315011337 00000000000000List of changes =============== This file contains the running log of changes applied to each released hitch version. hitch-1.1.1 (2016-01-26) ------------------------ * Remove compiler warning on FreeBSD. * Fix fatal build error for manpage on FreeBSD. * #55: Fix a bug which caused the Hitch worker threads to sometimes hit an assert after a configuration reload. * #57: Slightly reorganize assertion handling. * #52: Fix a bug where we would crash on --help. * Various minor documentation changes. hitch-1.1.0 (2015-11-20) ------------------------ * Avoid leaking memory if failing to create an ssl context. (coverity) * Fix possible memory leak in create_listen_sock(). (coverity) hitch-1.1.0-beta1 (2015-11-06) ------------------------------ * [dist] init.hitch file has been removed, CHANGES.rst is now distributed. * [configure] session cache support can now be enabled. (default off) * Fixes an off-by-one bug that broke wildcard certificate matching. * Set the IPV6_V6ONLY socket option for IPv6 listen sockets in order to avoid conflicts between INADDR_ANY and IN6ADDR_ANY. * Uninterrupted configuration reload of PEM files and frontend listen endpoints. * Priv-sep: To permit configuration reloads, privileges are now dropped in the child processes, and elevated privileges are retained in the management process. * Various error messages are now rewritten to be more specific about what went wrong. * A warning is issued if multiple certificates contain identical server name entries. * Initialize ECDH also for certificates without DH parameters (patch from Fedor Indutny). hitch-1.0.1 (2015-10-15) ------------------------ * Fix configuration parsing bug skipping short values, typically "workers = 1". * Tarball now contains an example configuration file. hitch-1.0.0 (2015-10-07) ------------------------ * A hash table is now used for faster SNI lookups. * Hitch binary has been renamed back to `hitch`, previously `hitch-openssl`. * Man page is updated. hitch-1.0.0-beta5 (2015-08-17) ------------------------------ * #37: Fixes a bug related to a varargs buffer that was consumed twice with syslog logging enabled. * --default-config retired and replaced by shipping a sample configuration file. * Use accept4() where supported. * --write-proxy now defaults to PROXY v2. This is a BREAKING CHANGE if PROXY1 is used. For PROXY v1, use --write-proxy-v1 explicitly. * Various minor error handling fixes. hitch 1.0.0-beta4 (2015-07-08) ------------------------------ In general beta4 contains fixes to problems found with Coverity. These were all of minor character, but were fixed for completeness. Source code has been reindented from 3-4 different formatting styles to FreeBSD style. hitch 1.0.0-beta3 (2015-06-18) ------------------------------ * Drop supplementary groups when doing setgid(). (github issue #31) * Add --sni-nomatch-abort which abort connections on unknown SNI server name. (useful for avoiding certificate warnings in clients attempting probabilistic TLS upgrades) * Remove cosmetic NULL-check before free(). (github issue #26) * Avoid segfault when testing configuration with -t. (github issue #22) * Minor helptext changes. hitch 1.0.0-beta2 (2015-05-22) ------------------------------ * New --pidfile argument. * Fixed bug in certificate ordering, avoiding wrong cert being provided when running on dualstack servers. (found by test framework!) * Rudimentary test framework implemented. * Init script updates provided by Denis Brækhus. * FreeBSD installation instructions added. (contributed by Ryan Steinmetz) * autoconf configuration updated to work on EL6. * Some forgotten references to stud were updated. hitch 1.0.0-beta1 (2015-05-13) ------------------------------ Hitch 1.0.0-beta1 is based on stud 0.3.2. A selected set of public patches from github forks were applied. Notable changes: * TLS v1.0, TLS v1.1 and TLS v1.2 support. * Support for SNI added. * Support PROXYv1 and PROXYv2 protocol to origin. * Multiple listening sockets with possibly different default key/certificate. * Wildcard certificates are supported. (with and without SNI.) * SSL3.0 must now be enabled explicitly. Various minor and stylistic fixed issues: * Properly clean SSL error queue. * Do not segfault if backend is not ready. * Logging now knows about IPv6. * IPv6 adresses should now use bracketed notation. * Additional timeouts for backend connect and SSL handshake added. * autoconf/automake is now used for building hitch. hitch-1.1.1/hitch.man.rst0000644000175000017500000000730612644742202012146 00000000000000 .. _hitch(8): ===== Hitch ===== -------------------------- high performance TLS proxy -------------------------- :Manual section: 8 Synopsis ======== hitch [OPTIONS] [PEM] Description =========== Hitch is a network proxy that terminates TLS/SSL connections and forwards the unencrypted traffic to some backend. It's designed to handle 10s of thousands of connections efficiently on multicore machines. Hitch has very few features -- it's designed to be paired with an intelligent backend like Varnish Cache. It maintains a strict 1:1 connection pattern with this backend handler so that the backend can dictate throttling behavior, maximum connection behavior, availability of service, etc. The only required argument is a path to a PEM file that contains the certificate (or a chain of certificates) and private key. It should also contain DH parameter if you wish to use Diffie-Hellman cipher suites. Command line arguments ====================== --config=FILE Load configuration from specified file. --tls TLSv1 (default. No SSLv3) --ssl SSLv3 (enables SSLv3) -c --ciphers=SUITE Sets allowed ciphers (Default: "") -e --ssl-engine=NAME Sets OpenSSL engine (Default: "") -O --prefer-server-ciphers Prefer server list order --client Enable client proxy mode -b --backend=[HOST]:PORT Backend [connect] (default is "[127.0.0.1]:8000") -f --frontend=[HOST]:PORT[+CERT] Frontend [bind] (default is "[*]:8443") (Note: brackets are mandatory in endpoint specifiers.) -n --workers=NUM Number of worker processes (Default: 1) -B --backlog=NUM Set listen backlog size (Default: 100) -k --keepalive=SECS TCP keepalive on client socket (Default: 3600) -r --chroot=DIR Sets chroot directory (Default: "") -u --user=USER Set uid/gid after binding the socket (Default: "") -g --group=GROUP Set gid after binding the socket (Default: "") -q --quiet Be quiet; emit only error messages -s --syslog Send log message to syslog in addition to stderr/stdout --syslog-facility=FACILITY Syslog facility to use (Default: "daemon") --daemon Fork into background and become a daemon; this also sets the --quiet option (Default: off) --write-ip Write 1 octet with the IP family followed by the IP address in 4 (IPv4) or 16 (IPv6) octets little-endian to backend before the actual data (Default: off) --write-proxy-v1 Write HaProxy's PROXY v1 (IPv4 or IPv6) protocol line before actual data (Default: off) --write-proxy-v2 Write HaProxy's PROXY v2 binary (IPv4 or IPv6) protocol line before actual data (Default: off) --write-proxy Equivalent to --write-proxy-v2. For PROXY version 1 use --write-proxy-v1 explicitly --proxy-proxy Proxy HaProxy's PROXY (IPv4 or IPv6) protocol line before actual data (PROXY v1 only) (Default: off) --sni-nomatch-abort Abort handshake when client submits an unrecognized SNI server name (Default: off) -t --test Test configuration and exit -p --pidfile=FILE PID file -V --version Print program version and exit -h --help This help message History ======= Hitch was originally called stud and was written by Jamie Turner at Bump.com. hitch-1.1.1/missing0000755000175000017500000001533012563613157011144 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2013-10-28.13; # UTC # Copyright (C) 1996-2014 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: hitch-1.1.1/README.md0000644000175000017500000000104012620343345011006 00000000000000hitch TLS proxy =============== [![Build Status](https://travis-ci.org/varnish/hitch.svg?branch=master)](https://travis-ci.org/varnish/hitch) [![Coverity Scan Build Status](https://scan.coverity.com/projects/5137/badge.svg)](https://scan.coverity.com/projects/hitch) `hitch` is a network proxy that terminates TLS/SSL connections and forwards the unencrypted traffic to some backend. It's designed to handle 10s of thousands of connections efficiently on multicore machines. See the [web page](https://hitch-tls.org) for more information. hitch-1.1.1/aclocal.m40000644000175000017500000012542612651707277011422 00000000000000# generated automatically by aclocal 1.15 -*- Autoconf -*- # Copyright (C) 1996-2014 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'.])]) # Copyright (C) 2002-2014 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.15' 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.15], [], [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.15])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-2014 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], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2014 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-2014 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-2014 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-2014 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 (and possibly the TAP driver). 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 The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) 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-2014 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+set}" != 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-2014 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-2014 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-2014 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-2014 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 ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2014 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-2014 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-2014 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-2014 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-2014 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-2014 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-2014 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-2014 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 hitch-1.1.1/COPYING0000644000175000017500000000303412546560025010572 00000000000000Copyright 2015 Varnish Software AB. Copyright 2012 Bump Technologies, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY BUMP TECHNOLOGIES, INC. ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BUMP TECHNOLOGIES, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of Bump Technologies, Inc. hitch-1.1.1/docs/0000755000175000017500000000000012650436745010556 500000000000000hitch-1.1.1/docs/installation.md0000644000175000017500000000137712560105637013522 00000000000000# Installing hitch hitch` requires: libev >= 4 openssl (recent, >=1.0.0 recommended) hitch currently works on Linux, OpenBSD, FreeBSD, and MacOSX. It has been tested the most heavily on Linux/x86_64. ## Installing from source To install `hitch`: $ ./bootstrap # if running from git $ ./configure $ make $ sudo make install This will install Hitch to /usr/local/, unless you override the destination with ./configure --prefix=/foo (as usual) ## Installing from packages ``FreeBSD`` From packages: $ pkg install hitch From ports: $ cd /usr/ports/security/hitch && make install clean ## Init scripts Initialization scripts to start hitch automatically can be found in the [wiki](https://github.com/varnish/hitch/wiki). hitch-1.1.1/docs/proxy-protocol.md0000644000175000017500000000241712560105637014035 00000000000000# PROXY protocol PROXY protocol allows hitch to send a short header/message just before the main connection data on the backend connection. The short header describes which IP address and port was used to connect to the proxy (Hitch), and which IP address and port was connected to. The last one is useful if Hitch is listening to more than one IP or port. PROXY exists in two different versions; PROXY1 with is a simple text header, and PROXY2 which is a binary representation. Hitch supports both through the global `--write-proxy-v1` and `--write-proxy-v2` configuration keys. Backend servers that support PROXY will read this first and most likely use it instead of the Hitch IP/port for when writing access logs. If Hitch is running on the same machine, the logs would otherwise use "127.0.0.1" which isn't very useful. The upside of using PROXY is that we don't need to know the protocol we're proxying. For HTTP the alternative is to add to X-Forwarded-For, which means we need to understand what HTTP headers are, how they are formatted, how to move the remaining bytes around when adding our content, and so on. By using PROXY we don't have to program that logic into Hitch, and we don't take the performance penalty of doing string search and replace in the bytes we proxy. hitch-1.1.1/docs/configuration.md0000644000175000017500000000475612644742202013672 00000000000000# Configuring Hitch Hitch can be configured either from command line arguments or from a configuration file on disk. You can extract the usage description by invoking Hitch with the "--help" argument. An example configuration file is included in the distribution. In general Hitch is a protocol agnostic proxy and does not need much configuration. List of configuration items to consider: - PEM files with key and certificate. - Listening addresses and ports. Note the semi-odd square brackets for IPv4 addresses. - Which backend servers to proxy towards, and if PROXY protocol should be used. - Number of workers, usually 1. For larger setups, use one worker per core. If you need to support legacy clients, you can consider: - Enable SSLv3 with "--ssl" (despite RFC7568.) - Use weaker ciphers. ## Specifying ciphers The recommended default is: "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH" If you need to support legacy clients, consider the "HIGH" cipher group. Normally you do not have to change this. ## Run environment If you're handling a large number of connections, you'll probably want to raise `ulimit -n` before running Hitch. If you are listening to ports under 1024 (443 comes to mind), you need to start Hitch as root. In those cases you *must* use --user/-u to set a non-privileged user `hitch` can setuid() to. ## Preparing PEM files PEM files should contain the key file, the certificate from the CA and any intermediate CAs needed. $ cat example.com.key intermediate.pem example.com.crt > example.com.pem If you want to use Diffie-Hellman based ciphers for Perfect Forward Secrecy (PFS), you need to add some parameters for that as well: $ openssl dhparam -rand - 2048 >> example.com.pem Hitch will complain and disable DH unless these parameters are available. ## Uninterrupted configuration reload Issuing a SIGHUP signal to the main Hitch process will initiate a reload of Hitch's configuration file. Adding, updating and removing PEM files (``pem-file``) and frontend listen endpoints (``frontend``) is currently supported. Hitch will load the new configuration in its main process, and spawn a new set of child processes with the new configuration in place if successful. The previous set of child processes will finish their handling of any live connections, and exit after they are done. If the new configuration fails to load, an error message will be written to syslog. Operation will continue without interruption with the current set of worker processes. hitch-1.1.1/docs/certificates.md0000644000175000017500000000251512614235430013454 00000000000000# Creating a SSL/TLS key and certificate To work hitch minimum requires a PEM file with: - an RSA key - a certificate - (if you are doing DH ciphers: diffie-hellman parameters) For production use, you probably want to buy one from a friendly Certificate Authority (CA) nearby. For testing/playing around with hitch, you can create one using openssl: $ openssl req -newkey rsa:2048 -sha256 -keyout example.com.key -nodes -x509 -days 365 -out example.crt This will write a key file and the self-signed certificate for it. The normal steps of writing a Certificate Signing Request and so on isn't necessary for self-signed certificates. To complete this chain you merge the files into a single PEM file that you give hitch: $ cat example.com.key example.crt > example.pem And then start Hitch: $ hitch --backend=[127.0.0.1:80] example.pem and you're done! If you are running on a Debian system, there is a shell script availble to simplify this in the _ssl-cert_ package: `make-ssl-cert /usr/share/ssl-cert/ssleay.cnf`/etc/hitch/testcert.pem` On Redhat systems the OpenSSL package has `/etc/pki/tls/certs/make-dummy-cert` that can be used. If you want to use Diffie-Hellman ciphers for Forward Secrecy, you need to add a bit of randomness to your PEM file as well. How you do this is described in [configuration](configuration.md). hitch-1.1.1/docs/architecture.md0000644000175000017500000000135212560105637013474 00000000000000# Hitch architeture Hitch uses a process-per-core model; a parent process spawns N children who each `accept()` on a common socket to distribute connected clients among them. Within each child, asynchronous socket I/O is conducted across the local connections using `libev` and `OpenSSL`'s nonblocking API. By default, `hitch` has an overhead of ~200KB per connection--it preallocates some buffer space for data in flight between frontend and backend. `hitch` has very few features--it's designed to be paired with an intelligent backend like Varnish Cache. It maintains a strict 1:1 connection pattern with this backend handler so that the backend can dictate throttling behavior, maximum connection behavior, availability of service, etc. hitch-1.1.1/docs/vhosts.md0000644000175000017500000000343312614235430012335 00000000000000# Virtual hosts Running a virtual host setup behind Hitch works fine. If you have reasonable clients (no XP/IE6, no older mobile), you can most likely use a single `--frontend=` stance, and let the Server Name Indication (SNI) sent in the handshake decide which certificate to present to the client. *SNI example*: $ ./hitch --backend=example.com:80 \ --frontend=[*]:443 \ site1.example.com.pem site2.example.com.pem site3.example.com.pem Hitch will automatically try to find the best matching certificate to give to the client. The last PEM file provided will serve as the default if none of them matched. Wildcard certificates work fine, any more specific certificate will be preferred over a wildcard match. If you would rather close the connection than serve a certificate that will yield a warning on the client, you can add the `--sni-nomatch-abort` argument. To avoid the messy long command line with many certificates, you can use multiple "pem-file = cert.pem" stances in a configuration file instead. ## Legacy clients To support older clients, you need to add multiple `--frontend=` stances to your configuration file (or command line) and a separate PEM file for each of them. Usually this means that you need many IP adresses assigned to the hitch server as well. *Legacy client example:* $ ./hitch --ssl --backend=example.com:80 \ "--frontend=[192.0.2.10]:443+certs/site1.example.com" \ "--frontend=[192.0.2.11]:443+certs/site2.example.com" \ certs/default.example.com Remember that hitch is protocol agnostic. It does not know about HTTP, it only passes bytes back and forth. In other words it will not set `X-Forwarded-Proto` or `X-Forwarded-For` on requests seen by the backend server. The PROXY protocol support exists for signalling the real client IP to the backend.