sbsigntool-0.6/0000775000175000017500000000000012035660722010550 500000000000000sbsigntool-0.6/INSTALL0000644000175000017500000003660011775441673011540 00000000000000Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. Some packages provide this `INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. Running `configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type `make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the `make install' phase executed with root privileges. 5. Optionally, type `make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior `make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type `make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide `make distcheck', which can by used by developers to test that all other targets like `make install' and `make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. This is known as a "VPATH" build. With a non-GNU `make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple `-arch' options to the compiler but only a single `-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the `lipo' tool if you have problems. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of `${prefix}', so that specifying just `--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to `configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the `make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, `make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of `${prefix}'. Any directories that were specified during `configure', but not in terms of `${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the `DESTDIR' variable. For example, `make install DESTDIR=/alternate/directory' will prepend `/alternate/directory' before all installation names. The approach of `DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of `${prefix}' at `configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of `make' will be. For these packages, running `./configure --enable-silent-rules' sets the default to minimal output, which can be overridden with `make V=1'; while running `./configure --disable-silent-rules' sets the default to verbose, which can be overridden with `make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX `make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as `configure' are involved. Use GNU `make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its `' header file. The option `-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put `/usr/ucb' early in your `PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in `/usr/bin'. So, if you need `/usr/ucb' in your `PATH', put it _after_ `/usr/bin'. On Haiku, software installed for all users goes in `/boot/common', not `/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for `CONFIG_SHELL' due to an Autoconf bug. Until the bug is fixed you can use this workaround: CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of all of the options to `configure', and exit. `--help=short' `--help=recursive' Print a summary of the options unique to this package's `configure', and exit. The `short' variant lists options used only in the top level, while the `recursive' variant lists options also present in any nested packages. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. `--no-create' `-n' Run the configure checks, but stop before creating any output files. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. sbsigntool-0.6/install-sh0000755000175000017500000003325611775441672012516 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-01-19.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for `test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: sbsigntool-0.6/README0000664000175000017500000000076311774125032011355 00000000000000sbsigntool - Signing utility for UEFI secure boot Copyright (C) 2102 Jeremy Kerr Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. See file ./INSTALL for building and installation instructions. Main git repository: git://kernel.ubuntu.com/jk/sbsigntool.git sbsigntool is free software. See the file COPYING for copying conditions. sbsigntool-0.6/missing0000755000175000017500000002415211775441672012104 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2012-01-06.13; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, 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 run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file yacc create \`y.tab.[ch]', if possible, from existing .[ch] 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 # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG=\${$#} case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG=\${$#} case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # 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: sbsigntool-0.6/configure0000775000175000017500000062265412035660543012417 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for sbsigntool 0.6. # # 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: jeremy.kerr@canonical.com about your system, including $0: any error possibly output before this message. Then $0: install a modern shell, or manually run the script $0: 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='sbsigntool' PACKAGE_TARNAME='sbsigntool' PACKAGE_VERSION='0.6' PACKAGE_STRING='sbsigntool 0.6' PACKAGE_BUGREPORT='jeremy.kerr@canonical.com' PACKAGE_URL='' ac_unique_file="src/sbsign.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS EFI_CPPFLAGS uuid_LIBS uuid_CFLAGS libcrypto_LIBS libcrypto_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG HELP2MAN EGREP GREP OBJCOPY RANLIB CPP am__fastdepCCAS_FALSE am__fastdepCCAS_TRUE CCASDEPMODE CCASFLAGS CCAS 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__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 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_dependency_tracking ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CCAS CCASFLAGS CPP PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR libcrypto_CFLAGS libcrypto_LIBS uuid_CFLAGS uuid_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures sbsigntool 0.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/sbsigntool] --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 sbsigntool 0.6:";; 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] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors 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 CCAS assembler compiler command (defaults to CC) CCASFLAGS assembler compiler flags (defaults to CFLAGS) CPP C preprocessor PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path libcrypto_CFLAGS C compiler flags for libcrypto, overriding pkg-config libcrypto_LIBS linker flags for libcrypto, overriding pkg-config uuid_CFLAGS C compiler flags for uuid, overriding pkg-config uuid_LIBS linker flags for uuid, overriding pkg-config 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 sbsigntool configure 0.6 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_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 jeremy.kerr@canonical.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 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 sbsigntool $as_me 0.6, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.11' 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; } # Just in case sleep 1 echo timestamp > conftest.file # 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 ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi 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; } 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 --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac 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 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='sbsigntool' VERSION='0.6' 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"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' ac_config_headers="$ac_config_headers config.h" 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 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 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 8's {/usr,}/bin/sh. touch 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 # By default we simply use the C compiler to build assembly code. test "${CCAS+set}" = set || CCAS=$CC test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS depcc="$CCAS" 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_CCAS_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_CCAS_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 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 8's {/usr,}/bin/sh. touch 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_CCAS_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CCAS_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CCAS_dependencies_compiler_type" >&5 $as_echo "$am_cv_CCAS_dependencies_compiler_type" >&6; } CCASDEPMODE=depmode=$am_cv_CCAS_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CCAS_dependencies_compiler_type" = gcc3; then am__fastdepCCAS_TRUE= am__fastdepCCAS_FALSE='#' else am__fastdepCCAS_TRUE='#' am__fastdepCCAS_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $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 { $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 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 8's {/usr,}/bin/sh. touch 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 if test "x$CC" != xcc; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 $as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } else { $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; } fi set dummy $CC; ac_cc=`$as_echo "$2" | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` if eval \${ac_cv_prog_cc_${ac_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. # We do the test twice because some compilers refuse to overwrite an # existing .o file with -o, though they will create one. ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { 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; } && test -f conftest2.$ac_objext && { { 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 eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. if { ac_try='cc -c conftest.$ac_ext >&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_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* if { { 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; } && test -f conftest2.$ac_objext && { { 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 # cc works too. : else # cc exists but doesn't like -o. eval ac_cv_prog_cc_${ac_cc}_c_o=no fi fi fi else eval ac_cv_prog_cc_${ac_cc}_c_o=no fi rm -f core conftest* fi if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h fi # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != 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 { $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 if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objcopy", so it can be a program name with args. set dummy ${ac_tool_prefix}objcopy; 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_OBJCOPY+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJCOPY"; then ac_cv_prog_OBJCOPY="$OBJCOPY" # 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_OBJCOPY="${ac_tool_prefix}objcopy" $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 OBJCOPY=$ac_cv_prog_OBJCOPY if test -n "$OBJCOPY"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJCOPY" >&5 $as_echo "$OBJCOPY" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJCOPY"; then ac_ct_OBJCOPY=$OBJCOPY # Extract the first word of "objcopy", so it can be a program name with args. set dummy objcopy; 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_OBJCOPY+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJCOPY"; then ac_cv_prog_ac_ct_OBJCOPY="$ac_ct_OBJCOPY" # 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_OBJCOPY="objcopy" $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_OBJCOPY=$ac_cv_prog_ac_ct_OBJCOPY if test -n "$ac_ct_OBJCOPY"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJCOPY" >&5 $as_echo "$ac_ct_OBJCOPY" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJCOPY" = x; then OBJCOPY="" 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 OBJCOPY=$ac_ct_OBJCOPY fi else OBJCOPY="$ac_cv_prog_OBJCOPY" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi { $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 ac_fn_c_check_header_mongrel "$LINENO" "bfd.h" "ac_cv_header_bfd_h" "$ac_includes_default" if test "x$ac_cv_header_bfd_h" = xyes; then : else as_fn_error $? "bfd.h not found. bfd.h is usually distributed in a binutils development package." "$LINENO" 5 fi if test $cross_compiling = no; then HELP2MAN=${HELP2MAN-"${am_missing_run}help2man"} else HELP2MAN=: fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system endianness" >&5 $as_echo_n "checking build system endianness... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if __BYTE_ORDER != __LITTLE_ENDIAN #error #endif ; return 0; } _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : endian=little little_endian=1 big_endian=0 fi rm -f conftest.err conftest.i conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if __BYTE_ORDER != __BIG_ENDIAN #error #endif ; return 0; } _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : endian=big little_endian=0 big_endian=1 fi rm -f conftest.err conftest.i conftest.$ac_ext if test x"$endian" != "xbig" -a x"$endian" != "xlittle"; then as_fn_error $? "Can't determine endianness; is endian.h present?" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $endian" >&5 $as_echo "$endian" >&6; } cat >>confdefs.h <<_ACEOF #define HAVE_LITTLE_ENDIAN $little_endian _ACEOF cat >>confdefs.h <<_ACEOF #define HAVE_BIG_ENDIAN $big_endian _ACEOF if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; 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_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $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 ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; 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_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $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 ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" 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 PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcrypto" >&5 $as_echo_n "checking for libcrypto... " >&6; } if test -n "$libcrypto_CFLAGS"; then pkg_cv_libcrypto_CFLAGS="$libcrypto_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcrypto\""; } >&5 ($PKG_CONFIG --exists --print-errors "libcrypto") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_libcrypto_CFLAGS=`$PKG_CONFIG --cflags "libcrypto" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$libcrypto_LIBS"; then pkg_cv_libcrypto_LIBS="$libcrypto_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcrypto\""; } >&5 ($PKG_CONFIG --exists --print-errors "libcrypto") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_libcrypto_LIBS=`$PKG_CONFIG --libs "libcrypto" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then libcrypto_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libcrypto" 2>&1` else libcrypto_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libcrypto" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$libcrypto_PKG_ERRORS" >&5 as_fn_error $? "libcrypto (from the OpenSSL package) is required" "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "libcrypto (from the OpenSSL package) is required" "$LINENO" 5 else libcrypto_CFLAGS=$pkg_cv_libcrypto_CFLAGS libcrypto_LIBS=$pkg_cv_libcrypto_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid" >&5 $as_echo_n "checking for uuid... " >&6; } if test -n "$uuid_CFLAGS"; then pkg_cv_uuid_CFLAGS="$uuid_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"uuid\""; } >&5 ($PKG_CONFIG --exists --print-errors "uuid") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_uuid_CFLAGS=`$PKG_CONFIG --cflags "uuid" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$uuid_LIBS"; then pkg_cv_uuid_LIBS="$uuid_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"uuid\""; } >&5 ($PKG_CONFIG --exists --print-errors "uuid") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_uuid_LIBS=`$PKG_CONFIG --libs "uuid" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then uuid_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "uuid" 2>&1` else uuid_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "uuid" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$uuid_PKG_ERRORS" >&5 as_fn_error $? "libuuid (from the uuid package) is required" "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "libuuid (from the uuid package) is required" "$LINENO" 5 else uuid_CFLAGS=$pkg_cv_uuid_CFLAGS uuid_LIBS=$pkg_cv_uuid_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi EFI_ARCH=$(uname -m) EFI_CPPFLAGS="-I/usr/include/efi -I/usr/include/efi/$EFI_ARCH \ -DEFI_FUNCTION_WRAPPER" CPPFLAGS_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $EFI_CPPFLAGS" for ac_header in efi.h do : ac_fn_c_check_header_compile "$LINENO" "efi.h" "ac_cv_header_efi_h" "$EFI_INCLUDES " if test "x$ac_cv_header_efi_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_EFI_H 1 _ACEOF fi done CPPFLAGS="$CPPFLAGS_save" EFI_CPPFLAGS=$EFI_CPPFLAGS ac_config_files="$ac_config_files Makefile src/Makefile lib/ccan/Makefile docs/Makefile tests/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 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 "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCCAS\" 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 : "${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 sbsigntool $as_me 0.6, 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="\\ sbsigntool config.status 0.6 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" ;; "lib/ccan/Makefile") CONFIG_FILES="$CONFIG_FILES lib/ccan/Makefile" ;; "docs/Makefile") CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/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"" || { # Autoconf 2.62 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"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //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' -e 's/\$U/'"$U"'/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 sbsigntool-0.6/configure.ac0000664000175000017500000000362512035660417012765 00000000000000AC_INIT([sbsigntool], [0.6], [jeremy.kerr@canonical.com]) AM_INIT_AUTOMAKE() AC_PREREQ(2.60) AC_CONFIG_HEADERS(config.h) AC_CONFIG_SRCDIR(src/sbsign.c) AM_PROG_AS AC_PROG_CC AM_PROG_CC_C_O AC_PROG_CPP AC_PROG_RANLIB AC_PROG_MKDIR_P AC_CHECK_TOOL(OBJCOPY, [objcopy]) AC_CHECK_TOOL(STRIP, [strip]) AC_CHECK_HEADER([bfd.h], [], AC_MSG_ERROR([bfd.h not found.] [bfd.h is usually distributed in a binutils development package.])) if test $cross_compiling = no; then AM_MISSING_PROG(HELP2MAN, help2man) else HELP2MAN=: fi AC_MSG_CHECKING([build system endianness]) AC_PREPROC_IFELSE( [AC_LANG_PROGRAM([[#include ]], [[#if __BYTE_ORDER != __LITTLE_ENDIAN]] [[#error]] [[#endif]])], endian=little little_endian=1 big_endian=0) AC_PREPROC_IFELSE( [AC_LANG_PROGRAM([[#include ]], [[#if __BYTE_ORDER != __BIG_ENDIAN]] [[#error]] [[#endif]])], endian=big little_endian=0 big_endian=1) if test x"$endian" != "xbig" -a x"$endian" != "xlittle"; then AC_MSG_ERROR([Can't determine endianness; is endian.h present?]) fi AC_MSG_RESULT($endian) AC_DEFINE_UNQUOTED(HAVE_LITTLE_ENDIAN, $little_endian, [Little-endian system]) AC_DEFINE_UNQUOTED(HAVE_BIG_ENDIAN, $big_endian, [Big-endian system]) PKG_PROG_PKG_CONFIG() PKG_CHECK_MODULES(libcrypto, libcrypto, [], AC_MSG_ERROR([libcrypto (from the OpenSSL package) is required])) PKG_CHECK_MODULES(uuid, uuid, [], AC_MSG_ERROR([libuuid (from the uuid package) is required])) dnl gnu-efi headers require extra include dirs EFI_ARCH=$(uname -m) EFI_CPPFLAGS="-I/usr/include/efi -I/usr/include/efi/$EFI_ARCH \ -DEFI_FUNCTION_WRAPPER" CPPFLAGS_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $EFI_CPPFLAGS" AC_CHECK_HEADERS([efi.h], [], [], $EFI_INCLUDES) CPPFLAGS="$CPPFLAGS_save" AC_SUBST(EFI_CPPFLAGS, $EFI_CPPFLAGS) AC_CONFIG_FILES([Makefile src/Makefile lib/ccan/Makefile] [docs/Makefile tests/Makefile]) AC_OUTPUT sbsigntool-0.6/docs/0000775000175000017500000000000012035660722011500 500000000000000sbsigntool-0.6/docs/sbsiglist.1.in0000664000175000017500000000010112032331270014070 00000000000000[name] sbsiglist - Create EFI_SIGNATURE_LIST signature databases sbsigntool-0.6/docs/sbattach.1.in0000664000175000017500000000007311774125032013677 00000000000000[name] sbattach - UEFI secure boot detached signature tool sbsigntool-0.6/docs/sbsign.1.in0000664000175000017500000000005611774125032013374 00000000000000[name] sbsign - UEFI secure boot signing tool sbsigntool-0.6/docs/sbvarsign.1.in0000664000175000017500000000007412032331270014074 00000000000000[name] sbvarsign - UEFI authenticated variable signing tool sbsigntool-0.6/docs/Makefile.am0000664000175000017500000000047412032331270013447 00000000000000 man1_MANS = sbsign.1 sbverify.1 sbattach.1 sbvarsign.1 sbsiglist.1 EXTRA_DIST = sbsign.1.in sbverify.1.in sbattach.1.in \ sbvarsign.1.in sbsiglist.1.in CLEANFILES = $(man1_MANS) $(builddir)/%.1: $(srcdir)/%.1.in $(top_builddir)/src/% $(MKDIR_P) $(@D) $(HELP2MAN) --no-info -i $< -o $@ $(top_builddir)/src/$* sbsigntool-0.6/docs/sbverify.1.in0000664000175000017500000000006511774125032013740 00000000000000[name] sbverify - UEFI secure boot verification tool sbsigntool-0.6/docs/Makefile.in0000664000175000017500000003305512035660544013475 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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 = docs DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man1dir = $(mandir)/man1 am__installdirs = "$(DESTDIR)$(man1dir)" NROFF = nroff MANS = $(man1_MANS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ 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@ EFI_CPPFLAGS = @EFI_CPPFLAGS@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ HELP2MAN = @HELP2MAN@ 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@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJCOPY = @OBJCOPY@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ 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@ libcrypto_CFLAGS = @libcrypto_CFLAGS@ libcrypto_LIBS = @libcrypto_LIBS@ 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@ 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@ uuid_CFLAGS = @uuid_CFLAGS@ uuid_LIBS = @uuid_LIBS@ man1_MANS = sbsign.1 sbverify.1 sbattach.1 sbvarsign.1 sbsiglist.1 EXTRA_DIST = sbsign.1.in sbverify.1.in sbattach.1.in \ sbvarsign.1.in sbsiglist.1.in CLEANFILES = $(man1_MANS) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu docs/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu docs/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-man1: $(man1_MANS) @$(NORMAL_INSTALL) @list1='$(man1_MANS)'; \ list2=''; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || 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 '/\.1[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,^[^1][0-9a-z]*$$,1,;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)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$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)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) installdirs: for dir in "$(DESTDIR)$(man1dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man1 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic 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-man1 install-pdf install-pdf-am install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ uninstall-am uninstall-man uninstall-man1 $(builddir)/%.1: $(srcdir)/%.1.in $(top_builddir)/src/% $(MKDIR_P) $(@D) $(HELP2MAN) --no-info -i $< -o $@ $(top_builddir)/src/$* # 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: sbsigntool-0.6/NEWS0000664000175000017500000000061612035327262011171 00000000000000v0.5: sbkeysync's default efivars mountpoint has been moved to /sys/firmware/efi/efivars/. This is to match the proposed Linux kernel patch for efivarfs, which provides this sysfs node for the purpose of mounting efivarfs, and leaving the older ../vars/ interface for legacy applications. This default can be overridden using the --efivars-path option to sbkeysync. v0.1: Initial version sbsigntool-0.6/src/0000775000175000017500000000000012035660722011337 500000000000000sbsigntool-0.6/src/image.c0000664000175000017500000003553112034115101012475 00000000000000/* * Copyright (C) 2012 Jeremy Kerr * * 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 3 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the OpenSSL * library under certain conditions as described in each individual source file, * and distribute linked combinations including the two. * * You must obey the GNU General Public License in all respects for all * of the code used other than OpenSSL. If you modify file(s) with this * exception, you may extend this exception to your version of the * file(s), but you are not obligated to do so. If you do not wish to do * so, delete this exception statement from your version. If you delete * this exception statement from all source files in the program, then * also delete it here. */ #include #include #include #include #include #include #include #include #include #include #include #include "fileio.h" #include "image.h" #define DATA_DIR_CERT_TABLE 4 #define CERT_TABLE_TYPE_PKCS 0x0002 /* PKCS signedData */ #define CERT_TABLE_REVISION 0x0200 /* revision 2 */ /** * The PE/COFF headers export struct fields as arrays of chars. So, define * a couple of accessor functions that allow fields to be deferenced as their * native types, to allow strict aliasing. This also allows for endian- * neutral behaviour. */ static uint32_t __pehdr_u32(char field[]) { uint8_t *ufield = (uint8_t *)field; return (ufield[3] << 24) + (ufield[2] << 16) + (ufield[1] << 8) + ufield[0]; } static uint16_t __pehdr_u16(char field[]) { uint8_t *ufield = (uint8_t *)field; return (ufield[1] << 8) + ufield[0]; } /* wrappers to ensure type correctness */ #define pehdr_u32(f) __pehdr_u32(f + BUILD_ASSERT_OR_ZERO(sizeof(f) == 4)) #define pehdr_u16(f) __pehdr_u16(f + BUILD_ASSERT_OR_ZERO(sizeof(f) == 2)) /* Machine-specific PE/COFF parse functions. These parse the relevant a.out * header for the machine type, and set the following members of struct image: * - aouthdr_size * - file_alignment * - header_size * - data_dir * - checksum * * These functions require image->opthdr to be set by the caller. */ static int image_pecoff_parse_32(struct image *image) { if (image->opthdr.opt_32->standard.magic[0] != 0x0b || image->opthdr.opt_32->standard.magic[1] != 0x01) { fprintf(stderr, "Invalid a.out machine type\n"); return -1; } image->opthdr_min_size = sizeof(*image->opthdr.opt_32) - sizeof(image->opthdr.opt_32->DataDirectory); image->file_alignment = pehdr_u32(image->opthdr.opt_32->FileAlignment); image->header_size = pehdr_u32(image->opthdr.opt_32->SizeOfHeaders); image->data_dir = (void *)image->opthdr.opt_32->DataDirectory; image->checksum = (uint32_t *)image->opthdr.opt_32->CheckSum; return 0; } static int image_pecoff_parse_64(struct image *image) { if (image->opthdr.opt_64->standard.magic[0] != 0x0b || image->opthdr.opt_64->standard.magic[1] != 0x02) { fprintf(stderr, "Invalid a.out machine type\n"); return -1; } image->opthdr_min_size = sizeof(*image->opthdr.opt_64) - sizeof(image->opthdr.opt_64->DataDirectory); image->file_alignment = pehdr_u32(image->opthdr.opt_64->FileAlignment); image->header_size = pehdr_u32(image->opthdr.opt_64->SizeOfHeaders); image->data_dir = (void *)image->opthdr.opt_64->DataDirectory; image->checksum = (uint32_t *)image->opthdr.opt_64->CheckSum; return 0; } static int image_pecoff_parse(struct image *image) { struct cert_table_header *cert_table; char nt_sig[] = {'P', 'E', 0, 0}; size_t size = image->size; int rc, cert_table_offset; void *buf = image->buf; uint16_t magic; uint32_t addr; /* sanity checks */ if (size < sizeof(*image->doshdr)) { fprintf(stderr, "file is too small for DOS header\n"); return -1; } image->doshdr = buf; if (image->doshdr->e_magic[0] != 0x4d || image->doshdr->e_magic[1] != 0x5a) { fprintf(stderr, "Invalid DOS header magic\n"); return -1; } addr = pehdr_u32(image->doshdr->e_lfanew); if (addr >= image->size) { fprintf(stderr, "pehdr is beyond end of file [0x%08x]\n", addr); return -1; } if (addr + sizeof(*image->pehdr) > image->size) { fprintf(stderr, "File not large enough to contain pehdr\n"); return -1; } image->pehdr = buf + addr; if (memcmp(image->pehdr->nt_signature, nt_sig, sizeof(nt_sig))) { fprintf(stderr, "Invalid PE header signature\n"); return -1; } /* a.out header directly follows PE header */ image->opthdr.addr = image->pehdr + 1; magic = pehdr_u16(image->pehdr->f_magic); if (magic == IMAGE_FILE_MACHINE_AMD64) { rc = image_pecoff_parse_64(image); } else if (magic == IMAGE_FILE_MACHINE_I386) { rc = image_pecoff_parse_32(image); } else { fprintf(stderr, "Invalid PE header magic\n"); return -1; } if (rc) { fprintf(stderr, "Error parsing a.out header\n"); return -1; } /* the optional header has a variable size, as the data directory * has a variable number of entries. Ensure that the we have enough * space to include the security directory entry */ image->opthdr_size = pehdr_u16(image->pehdr->f_opthdr); cert_table_offset = sizeof(*image->data_dir) * (DATA_DIR_CERT_TABLE + 1); if (image->opthdr_size < image->opthdr_min_size + cert_table_offset) { fprintf(stderr, "PE opt header too small (%d bytes) to contain " "a suitable data directory (need %d bytes)\n", image->opthdr_size, image->opthdr_min_size + cert_table_offset); return -1; } image->data_dir_sigtable = &image->data_dir[DATA_DIR_CERT_TABLE]; if (image->size < sizeof(*image->doshdr) + sizeof(*image->pehdr) + image->opthdr_size) { fprintf(stderr, "file is too small for a.out header\n"); return -1; } image->cert_table_size = image->data_dir_sigtable->size; if (image->cert_table_size) cert_table = buf + image->data_dir_sigtable->addr; else cert_table = NULL; image->cert_table = cert_table; /* if we have a valid cert table header, populate sigbuf as a shadow * copy of the cert table */ if (cert_table && cert_table->revision == CERT_TABLE_REVISION && cert_table->type == CERT_TABLE_TYPE_PKCS && cert_table->size < size) { image->sigsize = cert_table->size; image->sigbuf = talloc_memdup(image, cert_table + 1, image->sigsize); } image->sections = pehdr_u16(image->pehdr->f_nscns); image->scnhdr = image->opthdr.addr + image->opthdr_size; return 0; } static int align_up(int size, int align) { return (size + align - 1) & ~(align - 1); } static int cmp_regions(const void *p1, const void *p2) { const struct region *r1 = p1, *r2 = p2; if (r1->data < r2->data) return -1; if (r1->data > r2->data) return 1; return 0; } static void set_region_from_range(struct region *region, void *start, void *end) { region->data = start; region->size = end - start; } static int image_find_regions(struct image *image) { struct region *regions, *r; void *buf = image->buf; int i, gap_warn; size_t bytes; gap_warn = 0; /* now we know where the checksum and cert table data is, we can * construct regions that need to be signed */ bytes = 0; image->n_checksum_regions = 0; image->checksum_regions = NULL; image->n_checksum_regions = 3; image->checksum_regions = talloc_zero_array(image, struct region, image->n_checksum_regions); /* first region: beginning to checksum field */ regions = image->checksum_regions; set_region_from_range(®ions[0], buf, image->checksum); regions[0].name = "begin->cksum"; bytes += regions[0].size; bytes += sizeof(*image->checksum); /* second region: end of checksum to certificate table entry */ set_region_from_range(®ions[1], image->checksum + 1, image->data_dir_sigtable ); regions[1].name = "cksum->datadir[CERT]"; bytes += regions[1].size; bytes += sizeof(struct data_dir_entry); /* third region: end of checksum to end of headers */ set_region_from_range(®ions[2], (void *)image->data_dir_sigtable + sizeof(struct data_dir_entry), buf + image->header_size); regions[2].name = "datadir[CERT]->headers"; bytes += regions[2].size; /* add COFF sections */ for (i = 0; i < image->sections; i++) { uint32_t file_offset, file_size; file_offset = pehdr_u32(image->scnhdr[i].s_scnptr); file_size = pehdr_u32(image->scnhdr[i].s_size); if (!file_size) continue; image->n_checksum_regions++; image->checksum_regions = talloc_realloc(image, image->checksum_regions, struct region, image->n_checksum_regions); regions = image->checksum_regions; regions[i + 3].data = buf + file_offset; regions[i + 3].size = align_up(file_size, image->file_alignment); regions[i + 3].name = talloc_strndup(image->checksum_regions, image->scnhdr[i].s_name, 8); bytes += regions[i + 3].size; if (file_offset + regions[i+3].size > image->size) { fprintf(stderr, "warning: file-aligned section %s " "extends beyond end of file\n", regions[i+3].name); } if (regions[i+2].data + regions[i+2].size != regions[i+3].data) { fprintf(stderr, "warning: gap in section table:\n"); fprintf(stderr, " %-8s: 0x%08tx - 0x%08tx,\n", regions[i+2].name, regions[i+2].data - buf, regions[i+2].data + regions[i+2].size - buf); fprintf(stderr, " %-8s: 0x%08tx - 0x%08tx,\n", regions[i+3].name, regions[i+3].data - buf, regions[i+3].data + regions[i+3].size - buf); gap_warn = 1; } } if (gap_warn) fprintf(stderr, "gaps in the section table may result in " "different checksums\n"); qsort(image->checksum_regions, image->n_checksum_regions, sizeof(struct region), cmp_regions); if (bytes + image->cert_table_size < image->size) { int n = image->n_checksum_regions++; struct region *r; image->checksum_regions = talloc_realloc(image, image->checksum_regions, struct region, image->n_checksum_regions); r = &image->checksum_regions[n]; r->name = "endjunk"; r->data = image->buf + bytes; r->size = image->size - bytes - image->cert_table_size; fprintf(stderr, "warning: data remaining[%zd vs %zd]: gaps " "between PE/COFF sections?\n", bytes + image->cert_table_size, image->size); } else if (bytes + image->cert_table_size > image->size) { fprintf(stderr, "warning: checksum areas are greater than " "image size. Invalid section table?\n"); } /* record the size of non-signature data */ r = &image->checksum_regions[image->n_checksum_regions - 1]; image->data_size = (r->data - (void *)image->buf) + r->size; return 0; } struct image *image_load(const char *filename) { struct image *image; int rc; image = talloc(NULL, struct image); if (!image) { perror("talloc(image)"); return NULL; } rc = fileio_read_file(image, filename, &image->buf, &image->size); if (rc) goto err; reparse: rc = image_pecoff_parse(image); if (rc) goto err; rc = image_find_regions(image); if (rc) goto err; /* Some images may have incorrectly aligned sections, which get rounded * up to a size that is larger that the image itself (and the buffer * that we've allocated). We would have generated a warning about this, * but we can improve our chances that the verification hash will * succeed by padding the image out to the aligned size, and including * the pad in the signed data. * * In this case, do a realloc, but that may peturb the addresses that * we've calculated during the pecoff parsing, so we need to redo that * too. */ if (image->data_size > image->size) { image->buf = talloc_realloc(image, image->buf, uint8_t, image->data_size); memset(image->buf + image->size, 0, image->data_size - image->size); image->size = image->data_size; goto reparse; } return image; err: talloc_free(image); return NULL; } int image_hash_sha256(struct image *image, uint8_t digest[]) { struct region *region; SHA256_CTX ctx; int rc, i, n; rc = SHA256_Init(&ctx); if (!rc) return -1; n = 0; for (i = 0; i < image->n_checksum_regions; i++) { region = &image->checksum_regions[i]; n += region->size; #if 0 printf("sum region: 0x%04lx -> 0x%04lx [0x%04x bytes]\n", region->data - image->buf, region->data - image->buf - 1 + region->size, region->size); #endif rc = SHA256_Update(&ctx, region->data, region->size); if (!rc) return -1; } rc = SHA256_Final(digest, &ctx); return !rc; } int image_add_signature(struct image *image, void *sig, int size) { /* we only support one signature at present */ if (image->sigbuf) { fprintf(stderr, "warning: overwriting existing signature\n"); talloc_free(image->sigbuf); } image->sigbuf = sig; image->sigsize = size; return 0; } void image_remove_signature(struct image *image) { if (image->sigbuf) talloc_free(image->sigbuf); image->sigbuf = NULL; image->sigsize = 0; } int image_write(struct image *image, const char *filename) { struct cert_table_header cert_table_header; int fd, rc, len, padlen; bool is_signed; uint8_t pad[8]; is_signed = image->sigbuf && image->sigsize; padlen = 0; /* optionally update the image to contain signature data */ if (is_signed) { cert_table_header.size = image->sigsize + sizeof(cert_table_header); cert_table_header.revision = CERT_TABLE_REVISION; cert_table_header.type = CERT_TABLE_TYPE_PKCS; len = sizeof(cert_table_header) + image->sigsize; /* pad to sizeof(pad)-byte boundary */ padlen = align_up(len, sizeof(pad)) - len; image->data_dir_sigtable->addr = image->data_size; image->data_dir_sigtable->size = len + padlen; } else { image->data_dir_sigtable->addr = 0; image->data_dir_sigtable->size = 0; } fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd < 0) { perror("open"); return -1; } rc = write_all(fd, image->buf, image->data_size); if (!rc) goto out; if (!is_signed) goto out; rc = write_all(fd, &cert_table_header, sizeof(cert_table_header)); if (!rc) goto out; rc = write_all(fd, image->sigbuf, image->sigsize); if (!rc) goto out; if (padlen) { memset(pad, 0, sizeof(pad)); rc = write_all(fd, pad, padlen); } out: close(fd); return !rc; } int image_write_detached(struct image *image, const char *filename) { return fileio_write_file(filename, image->sigbuf, image->sigsize); } sbsigntool-0.6/src/coff/0000775000175000017500000000000012035660722012254 500000000000000sbsigntool-0.6/src/coff/external.h0000664000175000017500000001542612032331270014165 00000000000000/* external.h -- External COFF structures Copyright 2001, 2006, 2010 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef COFF_EXTERNAL_H #define COFF_EXTERNAL_H #ifndef DO_NOT_DEFINE_FILHDR /********************** FILE HEADER **********************/ struct external_filehdr { char f_magic[2]; /* magic number */ char f_nscns[2]; /* number of sections */ char f_timdat[4]; /* time & date stamp */ char f_symptr[4]; /* file pointer to symtab */ char f_nsyms[4]; /* number of symtab entries */ char f_opthdr[2]; /* sizeof(optional hdr) */ char f_flags[2]; /* flags */ }; #define FILHDR struct external_filehdr #define FILHSZ 20 #endif #ifndef DO_NOT_DEFINE_AOUTHDR /********************** AOUT "OPTIONAL HEADER" **********************/ typedef struct external_aouthdr { char magic[2]; /* type of file */ char vstamp[2]; /* version stamp */ char tsize[4]; /* text size in bytes, padded to FW bdry*/ char dsize[4]; /* initialized data " " */ char bsize[4]; /* uninitialized data " " */ char entry[4]; /* entry pt. */ char text_start[4]; /* base of text used for this file */ char data_start[4]; /* base of data used for this file */ } ATTRIBUTE_PACKED AOUTHDR; #define AOUTHDRSZ 28 #define AOUTSZ 28 typedef struct external_aouthdr64 { char magic[2]; /* Type of file. */ char vstamp[2]; /* Version stamp. */ char tsize[4]; /* Text size in bytes, padded to FW bdry*/ char dsize[4]; /* Initialized data " ". */ char bsize[4]; /* Uninitialized data " ". */ char entry[4]; /* Entry pt. */ char text_start[4]; /* Base of text used for this file. */ } AOUTHDR64; #define AOUTHDRSZ64 24 #endif /* not DO_NOT_DEFINE_AOUTHDR */ #ifndef DO_NOT_DEFINE_SCNHDR /********************** SECTION HEADER **********************/ struct external_scnhdr { char s_name[8]; /* section name */ char s_paddr[4]; /* physical address, aliased s_nlib */ char s_vaddr[4]; /* virtual address */ char s_size[4]; /* section size */ char s_scnptr[4]; /* file ptr to raw data for section */ char s_relptr[4]; /* file ptr to relocation */ char s_lnnoptr[4]; /* file ptr to line numbers */ char s_nreloc[2]; /* number of relocation entries */ char s_nlnno[2]; /* number of line number entries */ char s_flags[4]; /* flags */ }; #define SCNHDR struct external_scnhdr #define SCNHSZ 40 /* Names of "special" sections. */ #define _TEXT ".text" #define _DATA ".data" #define _BSS ".bss" #define _COMMENT ".comment" #define _LIB ".lib" #endif /* not DO_NOT_DEFINE_SCNHDR */ #ifndef DO_NOT_DEFINE_LINENO /********************** LINE NUMBERS **********************/ #ifndef L_LNNO_SIZE #error L_LNNO_SIZE needs to be defined #endif /* 1 line number entry for every "breakpointable" source line in a section. Line numbers are grouped on a per function basis; first entry in a function grouping will have l_lnno = 0 and in place of physical address will be the symbol table index of the function name. */ struct external_lineno { union { char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ char l_paddr[4]; /* (physical) address of line number */ } l_addr; char l_lnno[L_LNNO_SIZE]; /* line number */ }; #define LINENO struct external_lineno #define LINESZ (4 + L_LNNO_SIZE) #if L_LNNO_SIZE == 4 #define GET_LINENO_LNNO(abfd, ext) H_GET_32 (abfd, (ext->l_lnno)) #define PUT_LINENO_LNNO(abfd, val, ext) H_PUT_32 (abfd, val, (ext->l_lnno)) #endif #if L_LNNO_SIZE == 2 #define GET_LINENO_LNNO(abfd, ext) H_GET_16 (abfd, (ext->l_lnno)) #define PUT_LINENO_LNNO(abfd, val, ext) H_PUT_16 (abfd, val, (ext->l_lnno)) #endif #endif /* not DO_NOT_DEFINE_LINENO */ #ifndef DO_NOT_DEFINE_SYMENT /********************** SYMBOLS **********************/ #define E_SYMNMLEN 8 /* # characters in a symbol name */ #ifndef E_FILNMLEN #define E_FILNMLEN 14 #endif #define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ struct external_syment { union { char e_name[E_SYMNMLEN]; struct { char e_zeroes[4]; char e_offset[4]; } e; } e; char e_value[4]; char e_scnum[2]; char e_type[2]; char e_sclass[1]; char e_numaux[1]; } ATTRIBUTE_PACKED ; #define SYMENT struct external_syment #define SYMESZ 18 #ifndef N_BTMASK #define N_BTMASK 0xf #endif #ifndef N_TMASK #define N_TMASK 0x30 #endif #ifndef N_BTSHFT #define N_BTSHFT 4 #endif #ifndef N_TSHIFT #define N_TSHIFT 2 #endif #endif /* not DO_NOT_DEFINE_SYMENT */ #ifndef DO_NOT_DEFINE_AUXENT union external_auxent { struct { char x_tagndx[4]; /* str, un, or enum tag indx */ union { struct { char x_lnno[2]; /* declaration line number */ char x_size[2]; /* str/union/array size */ } x_lnsz; char x_fsize[4]; /* size of function */ } x_misc; union { struct /* if ISFCN, tag, or .bb */ { char x_lnnoptr[4]; /* ptr to fcn line # */ char x_endndx[4]; /* entry ndx past block end */ } x_fcn; struct /* if ISARY, up to 4 dimen. */ { char x_dimen[E_DIMNUM][2]; } x_ary; } x_fcnary; char x_tvndx[2]; /* tv index */ } x_sym; union { char x_fname[E_FILNMLEN]; struct { char x_zeroes[4]; char x_offset[4]; } x_n; } x_file; struct { char x_scnlen[4]; /* section length */ char x_nreloc[2]; /* # relocation entries */ char x_nlinno[2]; /* # line numbers */ #ifdef INCLUDE_COMDAT_FIELDS_IN_AUXENT char x_checksum[4]; /* section COMDAT checksum */ char x_associated[2]; /* COMDAT associated section index */ char x_comdat[1]; /* COMDAT selection number */ #endif } x_scn; struct { char x_tvfill[4]; /* tv fill value */ char x_tvlen[2]; /* length of .tv */ char x_tvran[2][2]; /* tv range */ } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ } ATTRIBUTE_PACKED ; #define AUXENT union external_auxent #define AUXESZ 18 #define _ETEXT "etext" #endif /* not DO_NOT_DEFINE_AUXENT */ #endif /* COFF_EXTERNAL_H */ sbsigntool-0.6/src/coff/pe.h0000664000175000017500000004575312032331270012755 00000000000000/* pe.h - PE COFF header information Copyright 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _PE_H #define _PE_H /* NT specific file attributes. */ #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 #define IMAGE_FILE_AGGRESSIVE_WS_TRIM 0x0010 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020 #define IMAGE_FILE_16BIT_MACHINE 0x0040 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 #define IMAGE_FILE_32BIT_MACHINE 0x0100 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800 #define IMAGE_FILE_SYSTEM 0x1000 #define IMAGE_FILE_DLL 0x2000 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 /* DllCharacteristics flag bits. The inconsistent naming may seem odd, but that is how they are defined in the PE specification. */ #define IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE 0x0040 #define IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY 0x0080 #define IMAGE_DLL_CHARACTERISTICS_NX_COMPAT 0x0100 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000 /* Additional flags to be set for section headers to allow the NT loader to read and write to the section data (to replace the addresses of data in dlls for one thing); also to execute the section in .text's case. */ #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 #define IMAGE_SCN_MEM_EXECUTE 0x20000000 #define IMAGE_SCN_MEM_READ 0x40000000 #define IMAGE_SCN_MEM_WRITE 0x80000000 /* Section characteristics added for ppc-nt. */ #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved. */ #define IMAGE_SCN_CNT_CODE 0x00000020 /* Section contains code. */ #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 /* Section contains initialized data. */ #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 /* Section contains uninitialized data. */ #define IMAGE_SCN_LNK_OTHER 0x00000100 /* Reserved. */ #define IMAGE_SCN_LNK_INFO 0x00000200 /* Section contains comments or some other type of information. */ #define IMAGE_SCN_LNK_REMOVE 0x00000800 /* Section contents will not become part of image. */ #define IMAGE_SCN_LNK_COMDAT 0x00001000 /* Section contents comdat. */ #define IMAGE_SCN_MEM_FARDATA 0x00008000 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000 #define IMAGE_SCN_MEM_16BIT 0x00020000 #define IMAGE_SCN_MEM_LOCKED 0x00040000 #define IMAGE_SCN_MEM_PRELOAD 0x00080000 /* Bit position in the s_flags field where the alignment values start. */ #define IMAGE_SCN_ALIGN_POWER_BIT_POS 20 #define IMAGE_SCN_ALIGN_POWER_BIT_MASK 0x00f00000 #define IMAGE_SCN_ALIGN_POWER_NUM(val) \ (((val) >> IMAGE_SCN_ALIGN_POWER_BIT_POS) - 1) #define IMAGE_SCN_ALIGN_POWER_CONST(val) \ (((val) + 1) << IMAGE_SCN_ALIGN_POWER_BIT_POS) #define IMAGE_SCN_ALIGN_1BYTES IMAGE_SCN_ALIGN_POWER_CONST (0) #define IMAGE_SCN_ALIGN_2BYTES IMAGE_SCN_ALIGN_POWER_CONST (1) #define IMAGE_SCN_ALIGN_4BYTES IMAGE_SCN_ALIGN_POWER_CONST (2) #define IMAGE_SCN_ALIGN_8BYTES IMAGE_SCN_ALIGN_POWER_CONST (3) /* Default alignment if no others are specified. */ #define IMAGE_SCN_ALIGN_16BYTES IMAGE_SCN_ALIGN_POWER_CONST (4) #define IMAGE_SCN_ALIGN_32BYTES IMAGE_SCN_ALIGN_POWER_CONST (5) #define IMAGE_SCN_ALIGN_64BYTES IMAGE_SCN_ALIGN_POWER_CONST (6) #define IMAGE_SCN_ALIGN_128BYTES IMAGE_SCN_ALIGN_POWER_CONST (7) #define IMAGE_SCN_ALIGN_256BYTES IMAGE_SCN_ALIGN_POWER_CONST (8) #define IMAGE_SCN_ALIGN_512BYTES IMAGE_SCN_ALIGN_POWER_CONST (9) #define IMAGE_SCN_ALIGN_1024BYTES IMAGE_SCN_ALIGN_POWER_CONST (10) #define IMAGE_SCN_ALIGN_2048BYTES IMAGE_SCN_ALIGN_POWER_CONST (11) #define IMAGE_SCN_ALIGN_4096BYTES IMAGE_SCN_ALIGN_POWER_CONST (12) #define IMAGE_SCN_ALIGN_8192BYTES IMAGE_SCN_ALIGN_POWER_CONST (13) /* Encode alignment power into IMAGE_SCN_ALIGN bits of s_flags */ #define COFF_ENCODE_ALIGNMENT(SECTION, ALIGNMENT_POWER) \ ((SECTION).s_flags |= IMAGE_SCN_ALIGN_POWER_CONST ((ALIGNMENT_POWER))) #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 /* Section contains extended relocations. */ #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 /* Section is not cachable. */ #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 /* Section is not pageable. */ #define IMAGE_SCN_MEM_SHARED 0x10000000 /* Section is shareable. */ /* COMDAT selection codes. */ #define IMAGE_COMDAT_SELECT_NODUPLICATES (1) /* Warn if duplicates. */ #define IMAGE_COMDAT_SELECT_ANY (2) /* No warning. */ #define IMAGE_COMDAT_SELECT_SAME_SIZE (3) /* Warn if different size. */ #define IMAGE_COMDAT_SELECT_EXACT_MATCH (4) /* Warn if different. */ #define IMAGE_COMDAT_SELECT_ASSOCIATIVE (5) /* Base on other section. */ /* Machine numbers. */ #define IMAGE_FILE_MACHINE_UNKNOWN 0x0000 #define IMAGE_FILE_MACHINE_ALPHA 0x0184 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284 #define IMAGE_FILE_MACHINE_AM33 0x01d3 #define IMAGE_FILE_MACHINE_AMD64 0x8664 #define IMAGE_FILE_MACHINE_ARM 0x01c0 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64 #define IMAGE_FILE_MACHINE_CEE 0xc0ee #define IMAGE_FILE_MACHINE_CEF 0x0cef #define IMAGE_FILE_MACHINE_EBC 0x0ebc #define IMAGE_FILE_MACHINE_I386 0x014c #define IMAGE_FILE_MACHINE_IA64 0x0200 #define IMAGE_FILE_MACHINE_M32R 0x9041 #define IMAGE_FILE_MACHINE_M68K 0x0268 #define IMAGE_FILE_MACHINE_MIPS16 0x0266 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1 #define IMAGE_FILE_MACHINE_R10000 0x0168 #define IMAGE_FILE_MACHINE_R3000 0x0162 #define IMAGE_FILE_MACHINE_R4000 0x0166 #define IMAGE_FILE_MACHINE_SH3 0x01a2 #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3 #define IMAGE_FILE_MACHINE_SH3E 0x01a4 #define IMAGE_FILE_MACHINE_SH4 0x01a6 #define IMAGE_FILE_MACHINE_SH5 0x01a8 #define IMAGE_FILE_MACHINE_THUMB 0x01c2 #define IMAGE_FILE_MACHINE_TRICORE 0x0520 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169 #define IMAGE_FILE_MACHINE_AMD64 0x8664 #define IMAGE_SUBSYSTEM_UNKNOWN 0 #define IMAGE_SUBSYSTEM_NATIVE 1 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 #define IMAGE_SUBSYSTEM_POSIX_CUI 7 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12 #define IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER 13 #define IMAGE_SUBSYSTEM_XBOX 14 /* Magic values that are true for all dos/nt implementations. */ #define DOSMAGIC 0x5a4d #define NT_SIGNATURE 0x00004550 /* NT allows long filenames, we want to accommodate this. This may break some of the bfd functions. */ #undef FILNMLEN #define FILNMLEN 18 /* # characters in a file name. */ struct external_PEI_DOS_hdr { /* DOS header fields - always at offset zero in the EXE file. */ char e_magic[2]; /* Magic number, 0x5a4d. */ char e_cblp[2]; /* Bytes on last page of file, 0x90. */ char e_cp[2]; /* Pages in file, 0x3. */ char e_crlc[2]; /* Relocations, 0x0. */ char e_cparhdr[2]; /* Size of header in paragraphs, 0x4. */ char e_minalloc[2]; /* Minimum extra paragraphs needed, 0x0. */ char e_maxalloc[2]; /* Maximum extra paragraphs needed, 0xFFFF. */ char e_ss[2]; /* Initial (relative) SS value, 0x0. */ char e_sp[2]; /* Initial SP value, 0xb8. */ char e_csum[2]; /* Checksum, 0x0. */ char e_ip[2]; /* Initial IP value, 0x0. */ char e_cs[2]; /* Initial (relative) CS value, 0x0. */ char e_lfarlc[2]; /* File address of relocation table, 0x40. */ char e_ovno[2]; /* Overlay number, 0x0. */ char e_res[4][2]; /* Reserved words, all 0x0. */ char e_oemid[2]; /* OEM identifier (for e_oeminfo), 0x0. */ char e_oeminfo[2]; /* OEM information; e_oemid specific, 0x0. */ char e_res2[10][2]; /* Reserved words, all 0x0. */ char e_lfanew[4]; /* File address of new exe header, usually 0x80. */ char dos_message[16][4]; /* Other stuff, always follow DOS header. */ }; struct external_PEI_IMAGE_hdr { char nt_signature[4]; /* required NT signature, 0x4550. */ /* From standard header. */ char f_magic[2]; /* Magic number. */ char f_nscns[2]; /* Number of sections. */ char f_timdat[4]; /* Time & date stamp. */ char f_symptr[4]; /* File pointer to symtab. */ char f_nsyms[4]; /* Number of symtab entries. */ char f_opthdr[2]; /* Sizeof(optional hdr). */ char f_flags[2]; /* Flags. */ }; struct external_PEI_filehdr { /* DOS header fields - always at offset zero in the EXE file. */ char e_magic[2]; /* Magic number, 0x5a4d. */ char e_cblp[2]; /* Bytes on last page of file, 0x90. */ char e_cp[2]; /* Pages in file, 0x3. */ char e_crlc[2]; /* Relocations, 0x0. */ char e_cparhdr[2]; /* Size of header in paragraphs, 0x4. */ char e_minalloc[2]; /* Minimum extra paragraphs needed, 0x0. */ char e_maxalloc[2]; /* Maximum extra paragraphs needed, 0xFFFF. */ char e_ss[2]; /* Initial (relative) SS value, 0x0. */ char e_sp[2]; /* Initial SP value, 0xb8. */ char e_csum[2]; /* Checksum, 0x0. */ char e_ip[2]; /* Initial IP value, 0x0. */ char e_cs[2]; /* Initial (relative) CS value, 0x0. */ char e_lfarlc[2]; /* File address of relocation table, 0x40. */ char e_ovno[2]; /* Overlay number, 0x0. */ char e_res[4][2]; /* Reserved words, all 0x0. */ char e_oemid[2]; /* OEM identifier (for e_oeminfo), 0x0. */ char e_oeminfo[2]; /* OEM information; e_oemid specific, 0x0. */ char e_res2[10][2]; /* Reserved words, all 0x0. */ char e_lfanew[4]; /* File address of new exe header, usually 0x80. */ char dos_message[16][4]; /* Other stuff, always follow DOS header. */ /* Note: additional bytes may be inserted before the signature. Use the e_lfanew field to find the actual location of the NT signature. */ char nt_signature[4]; /* required NT signature, 0x4550. */ /* From standard header. */ char f_magic[2]; /* Magic number. */ char f_nscns[2]; /* Number of sections. */ char f_timdat[4]; /* Time & date stamp. */ char f_symptr[4]; /* File pointer to symtab. */ char f_nsyms[4]; /* Number of symtab entries. */ char f_opthdr[2]; /* Sizeof(optional hdr). */ char f_flags[2]; /* Flags. */ }; #ifdef COFF_IMAGE_WITH_PE /* The filehdr is only weird in images. */ #undef FILHDR #define FILHDR struct external_PEI_filehdr #undef FILHSZ #define FILHSZ 152 #endif /* COFF_IMAGE_WITH_PE */ /* 32-bit PE a.out header: */ typedef struct { AOUTHDR standard; /* NT extra fields; see internal.h for descriptions. */ char ImageBase[4]; char SectionAlignment[4]; char FileAlignment[4]; char MajorOperatingSystemVersion[2]; char MinorOperatingSystemVersion[2]; char MajorImageVersion[2]; char MinorImageVersion[2]; char MajorSubsystemVersion[2]; char MinorSubsystemVersion[2]; char Reserved1[4]; char SizeOfImage[4]; char SizeOfHeaders[4]; char CheckSum[4]; char Subsystem[2]; char DllCharacteristics[2]; char SizeOfStackReserve[4]; char SizeOfStackCommit[4]; char SizeOfHeapReserve[4]; char SizeOfHeapCommit[4]; char LoaderFlags[4]; char NumberOfRvaAndSizes[4]; /* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; */ char DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars. */ } PEAOUTHDR; #undef AOUTSZ #define AOUTSZ (AOUTHDRSZ + 196) /* Like PEAOUTHDR, except that the "standard" member has no BaseOfData (aka data_start) member and that some of the members are 8 instead of just 4 bytes long. */ typedef struct { #ifdef AOUTHDRSZ64 AOUTHDR64 standard; #else AOUTHDR standard; #endif /* NT extra fields; see internal.h for descriptions. */ char ImageBase[8]; char SectionAlignment[4]; char FileAlignment[4]; char MajorOperatingSystemVersion[2]; char MinorOperatingSystemVersion[2]; char MajorImageVersion[2]; char MinorImageVersion[2]; char MajorSubsystemVersion[2]; char MinorSubsystemVersion[2]; char Reserved1[4]; char SizeOfImage[4]; char SizeOfHeaders[4]; char CheckSum[4]; char Subsystem[2]; char DllCharacteristics[2]; char SizeOfStackReserve[8]; char SizeOfStackCommit[8]; char SizeOfHeapReserve[8]; char SizeOfHeapCommit[8]; char LoaderFlags[4]; char NumberOfRvaAndSizes[4]; /* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; */ char DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars. */ } PEPAOUTHDR; #ifdef AOUTHDRSZ64 #define PEPAOUTSZ (AOUTHDRSZ64 + 196 + 5 * 4) /* = 240 */ #else #define PEPAOUTSZ 240 #endif #undef E_FILNMLEN #define E_FILNMLEN 18 /* # characters in a file name. */ /* Import Tyoes fot ILF format object files.. */ #define IMPORT_CODE 0 #define IMPORT_DATA 1 #define IMPORT_CONST 2 /* Import Name Tyoes for ILF format object files. */ #define IMPORT_ORDINAL 0 #define IMPORT_NAME 1 #define IMPORT_NAME_NOPREFIX 2 #define IMPORT_NAME_UNDECORATE 3 /* Weak external characteristics. */ #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3 /* .pdata/.xdata defines and structures for x64 PE+ for exception handling. */ /* .pdata in exception directory. */ struct pex64_runtime_function { bfd_vma rva_BeginAddress; bfd_vma rva_EndAddress; bfd_vma rva_UnwindData; unsigned int isChained : 1; }; struct external_pex64_runtime_function { bfd_byte rva_BeginAddress[4]; bfd_byte rva_EndAddress[4]; bfd_byte rva_UnwindData[4]; }; /* If the lowest significant bit is set for rva_UnwindData RVA, it means that the unified RVA points to another pex64_runtime_function that this entry shares the unwind_info block with. */ #define PEX64_IS_RUNTIME_FUNCTION_CHAINED(PTR_RTF) \ (((PTR_RTF)->rva_UnwindData & 1) != 0) #define PEX64_GET_UNWINDDATA_UNIFIED_RVA(PTR_RTF) \ ((PTR_RTF)->rva_UnwindData & ~1) /* The unwind codes. */ #define UWOP_PUSH_NONVOL 0 #define UWOP_ALLOC_LARGE 1 #define UWOP_ALLOC_SMALL 2 #define UWOP_SET_FPREG 3 #define UWOP_SAVE_NONVOL 4 #define UWOP_SAVE_NONVOL_FAR 5 #define UWOP_SAVE_XMM 6 #define UWOP_SAVE_XMM_FAR 7 #define UWOP_SAVE_XMM128 8 #define UWOP_SAVE_XMM128_FAR 9 #define UWOP_PUSH_MACHFRAME 10 struct pex64_unwind_code { bfd_vma prologue_offset; /* Contains Frame offset, or frame allocation size. */ bfd_vma frame_addr; unsigned int uwop_code : 4; /* xmm, mm, or standard register from 0 - 15. */ unsigned int reg : 4; /* Used for UWOP_PUSH_MACHFRAME to indicate optional errorcode stack argument. */ unsigned int has_errorcode : 1; }; struct external_pex64_unwind_code { bfd_byte dta[2]; }; #define PEX64_UNWCODE_CODE(VAL) ((VAL) & 0xf) #define PEX64_UNWCODE_INFO(VAL) (((VAL) >> 4) & 0xf) /* The unwind info. */ #define UNW_FLAG_NHANDLER 0 #define UNW_FLAG_EHANDLER 1 #define UNW_FLAG_UHANDLER 2 #define UNW_FLAG_FHANDLER 3 #define UNW_FLAG_CHAININFO 4 #define UNW_FLAG_MASK 0x1f struct pex64_unwind_info { bfd_vma SizeOfBlock; bfd_byte Version; /* Values from 0 up to 7 are possible. */ bfd_byte Flags; /* Values from 0 up to 31 are possible. */ bfd_vma SizeOfPrologue; bfd_vma CountOfCodes; /* Amount of pex64_unwind_code elements. */ /* 0 = CFA, 1..15 are index of integer registers. */ unsigned int FrameRegister : 4; bfd_vma FrameOffset; bfd_vma sizeofUnwindCodes; bfd_byte *rawUnwindCodes; /* Valid for UNW_FLAG_EHANDLER and UNW_FLAG_UHANDLER. */ bfd_vma CountOfScopes; bfd_byte *rawScopeEntries; bfd_vma rva_ExceptionHandler; /* UNW_EHANDLER. */ bfd_vma rva_TerminationHandler; /* UNW_FLAG_UHANDLER. */ bfd_vma rva_FrameHandler; /* UNW_FLAG_FHANDLER. */ bfd_vma FrameHandlerArgument; /* UNW_FLAG_FHANDLER. */ bfd_vma rva_FunctionEntry; /* UNW_FLAG_CHAININFO. */ }; struct external_pex64_unwind_info { bfd_byte Version_Flags; bfd_byte SizeOfPrologue; bfd_byte CountOfCodes; bfd_byte FrameRegisterOffset; /* external_pex64_unwind_code array. */ /* bfd_byte handler[4]; */ /* Optional language specific data. */ }; struct external_pex64_scope { bfd_vma Count; }; struct pex64_scope { bfd_byte Count[4]; }; struct pex64_scope_entry { bfd_vma rva_BeginAddress; bfd_vma rva_EndAddress; bfd_vma rva_HandlerAddress; bfd_vma rva_JumpAddress; }; #define PEX64_SCOPE_ENTRY_SIZE 16 struct external_pex64_scope_entry { bfd_byte rva_BeginAddress[4]; bfd_byte rva_EndAddress[4]; bfd_byte rva_HandlerAddress[4]; bfd_byte rva_JumpAddress[4]; }; #define PEX64_UWI_VERSION(VAL) ((VAL) & 7) #define PEX64_UWI_FLAGS(VAL) (((VAL) >> 3) & 0x1f) #define PEX64_UWI_FRAMEREG(VAL) ((VAL) & 0xf) #define PEX64_UWI_FRAMEOFF(VAL) (((VAL) >> 4) & 0xf) #define PEX64_UWI_SIZEOF_UWCODE_ARRAY(VAL) \ ((((VAL) + 1) & ~1) * 2) #define PEX64_OFFSET_TO_UNWIND_CODE 0x4 #define PEX64_OFFSET_TO_HANDLER_RVA (COUNTOFUNWINDCODES) \ (PEX64_OFFSET_TO_UNWIND_CODE + \ PEX64_UWI_SIZEOF_UWCODE_ARRAY(COUNTOFUNWINDCODES)) #define PEX64_OFFSET_TO_SCOPE_COUNT(COUNTOFUNWINDCODES) \ (PEX64_OFFSET_TO_HANDLER_RVA(COUNTOFUNWINDCODES) + 4) #define PEX64_SCOPE_ENTRY(COUNTOFUNWINDCODES, IDX) \ (PEX64_OFFSET_TO_SCOPE_COUNT(COUNTOFUNWINDCODES) + \ PEX64_SCOPE_ENTRY_SIZE * (IDX)) #endif /* _PE_H */ sbsigntool-0.6/src/efivars.h0000664000175000017500000000622012032331270013055 00000000000000/* * Copyright (C) 2012 Jeremy Kerr * * 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 3 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the OpenSSL * library under certain conditions as described in each individual source file, * and distribute linked combinations including the two. * * You must obey the GNU General Public License in all respects for all * of the code used other than OpenSSL. If you modify file(s) with this * exception, you may extend this exception to your version of the * file(s), but you are not obligated to do so. If you do not wish to do * so, delete this exception statement from your version. If you delete * this exception statement from all source files in the program, then * also delete it here. */ #ifndef EFI_VARAUTH_H #define EFI_VARAUTH_H #include #define EFI_CERT_TYPE_PKCS7_GUID \ { 0x4aafd29d, 0x68df, 0x49ee, \ { 0x8a, 0xa9, 0x34, 0x7d, 0x37, 0x56, 0x65, 0xa7 } } #define EFI_CERT_X509_GUID \ { 0xa5c059a1, 0x94e4, 0x4aa7, \ { 0x87, 0xb5, 0xab, 0x15, 0x5c, 0x2b, 0xf0, 0x72 } } #define EFI_CERT_SHA256_GUID \ { 0xc1c41626, 0x504c, 0x4092, \ { 0xac, 0xa9, 0x41, 0xf9, 0x36, 0x93, 0x43, 0x28 } } #define EFI_IMAGE_SECURITY_DATABASE_GUID \ { 0xd719b2cb, 0x3d3a, 0x4596, \ { 0xa3, 0xbc, 0xda, 0xd0, 0x0e, 0x67, 0x65, 0x6f } } #ifndef EFI_VARIABLE_NON_VOLATILE #define EFI_VARIABLE_NON_VOLATILE 0x00000001 #endif #ifndef EFI_VARIABLE_BOOTSERVICE_ACCESS #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002 #endif #ifndef EFI_VARIABLE_RUNTIME_ACCESS #define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004 #endif #ifndef EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS #define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x00000020 #endif #ifndef EFI_VARIABLE_APPEND_WRITE #define EFI_VARIABLE_APPEND_WRITE 0x00000040 #endif typedef struct { UINT32 dwLength; UINT16 wRevision; UINT16 wCertificateType; UINT8 bCertificate[]; } WIN_CERTIFICATE; typedef struct { WIN_CERTIFICATE Hdr; EFI_GUID CertType; UINT8 CertData[]; } WIN_CERTIFICATE_UEFI_GUID; typedef struct { EFI_TIME TimeStamp; WIN_CERTIFICATE_UEFI_GUID AuthInfo; } EFI_VARIABLE_AUTHENTICATION_2; typedef struct { EFI_GUID SignatureOwner; UINT8 SignatureData[]; } EFI_SIGNATURE_DATA; typedef struct { EFI_GUID SignatureType; UINT32 SignatureListSize; UINT32 SignatureHeaderSize; UINT32 SignatureSize; } EFI_SIGNATURE_LIST; #endif /* EFI_VARAUTH_H */ sbsigntool-0.6/src/idc.h0000664000175000017500000000342212032331270012156 00000000000000/* * Copyright (C) 2012 Jeremy Kerr * * 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 3 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the OpenSSL * library under certain conditions as described in each individual source file, * and distribute linked combinations including the two. * * You must obey the GNU General Public License in all respects for all * of the code used other than OpenSSL. If you modify file(s) with this * exception, you may extend this exception to your version of the * file(s), but you are not obligated to do so. If you do not wish to do * so, delete this exception statement from your version. If you delete * this exception statement from all source files in the program, then * also delete it here. */ #ifndef IDC_H #define IDC_H #include "image.h" #include struct idc; int IDC_set(PKCS7 *p7, PKCS7_SIGNER_INFO *si, struct image *image); struct idc *IDC_get(PKCS7 *p7, BIO *bio); int IDC_check_hash(struct idc *idc, struct image *image); #endif /* IDC_H */ sbsigntool-0.6/src/fileio.h0000664000175000017500000000375212032331270012674 00000000000000/* * Copyright (C) 2012 Jeremy Kerr * * 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 3 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the OpenSSL * library under certain conditions as described in each individual source file, * and distribute linked combinations including the two. * * You must obey the GNU General Public License in all respects for all * of the code used other than OpenSSL. If you modify file(s) with this * exception, you may extend this exception to your version of the * file(s), but you are not obligated to do so. If you do not wish to do * so, delete this exception statement from your version. If you delete * this exception statement from all source files in the program, then * also delete it here. */ #ifndef FILEIO_H #define FILEIO_H #include #include #include EVP_PKEY *fileio_read_pkey(const char *filename); X509 *fileio_read_cert(const char *filename); int fileio_read_file(void *ctx, const char *filename, uint8_t **out_buf, size_t *out_len); int fileio_read_file_noerror(void *ctx, const char *filename, uint8_t **out_buf, size_t *out_len); int fileio_write_file(const char *filename, uint8_t *buf, size_t len); #endif /* FILEIO_H */ sbsigntool-0.6/src/sbkeysync.c0000664000175000017500000005340412035327262013442 00000000000000/* * Copyright (C) 2012 Jeremy Kerr * * 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 3 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the OpenSSL * library under certain conditions as described in each individual source file, * and distribute linked combinations including the two. * * You must obey the GNU General Public License in all respects for all * of the code used other than OpenSSL. If you modify file(s) with this * exception, you may extend this exception to your version of the * file(s), but you are not obligated to do so. If you do not wish to do * so, delete this exception statement from your version. If you delete * this exception statement from all source files in the program, then * also delete it here. */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "fileio.h" #include "efivars.h" #define EFIVARS_MOUNTPOINT "/sys/firmware/efi/efivars" #define EFIVARS_FSTYPE 0x6165676C #define EFI_IMAGE_SECURITY_DATABASE_GUID \ { 0xd719b2cb, 0x3d3a, 0x4596, \ { 0xa3, 0xbc, 0xda, 0xd0, 0x0e, 0x67, 0x65, 0x6f } } static const char *toolname = "sbkeysync"; static const uint32_t sigdb_attrs = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | EFI_VARIABLE_APPEND_WRITE; struct key_database_type { const char *name; EFI_GUID guid; }; struct key_database_type keydb_types[] = { { "PK", EFI_GLOBAL_VARIABLE }, { "KEK", EFI_GLOBAL_VARIABLE }, { "db", EFI_IMAGE_SECURITY_DATABASE_GUID }, { "dbx", EFI_IMAGE_SECURITY_DATABASE_GUID }, }; enum keydb_type { KEYDB_PK = 0, KEYDB_KEK = 1, KEYDB_DB = 2, KEYDB_DBX = 3, }; static const char *default_keystore_dirs[] = { "/etc/secureboot/keys", "/usr/share/secureboot/keys", }; struct key { EFI_GUID type; int id_len; uint8_t *id; char *description; struct list_node list; /* set for keys loaded from a filesystem keystore */ struct fs_keystore_entry *keystore_entry; }; typedef int (*key_parse_func)(struct key *, uint8_t *, size_t); struct cert_type { EFI_GUID guid; key_parse_func parse; }; struct key_database { const struct key_database_type *type; struct list_head keys; }; struct keyset { struct key_database pk; struct key_database kek; struct key_database db; struct key_database dbx; }; struct fs_keystore_entry { const struct key_database_type *type; const char *root; const char *name; uint8_t *data; size_t len; struct list_node keystore_list; struct list_node new_list; }; struct fs_keystore { struct list_head keys; }; struct sync_context { const char *efivars_dir; struct keyset *filesystem_keys; struct keyset *firmware_keys; struct fs_keystore *fs_keystore; const char **keystore_dirs; unsigned int n_keystore_dirs; struct list_head new_keys; bool verbose; bool dry_run; bool set_pk; }; #define GUID_STRLEN (8 + 1 + 4 + 1 + 4 + 1 + 4 + 1 + 12 + 1) static void guid_to_str(const EFI_GUID *guid, char *str) { snprintf(str, GUID_STRLEN, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]); } static int sha256_key_parse(struct key *key, uint8_t *data, size_t len) { const unsigned int sha256_id_size = 256 / 8; unsigned int i; if (len != sha256_id_size) return -1; key->id = talloc_memdup(key, data, sha256_id_size); key->id_len = sha256_id_size; key->description = talloc_array(key, char, len * 2 + 1); for (i = 0; i < len; i++) snprintf(&key->description[i*2], 3, "%02x", data[i]); key->description[len*2] = '\0'; return 0; } static int x509_key_parse(struct key *key, uint8_t *data, size_t len) { const int description_len = 160; ASN1_INTEGER *serial; const uint8_t *tmp; X509 *x509; int rc; rc = -1; tmp = data; x509 = d2i_X509(NULL, &tmp, len); if (!x509) return -1; /* we use the X509 serial number as the key ID */ if (!x509->cert_info || !x509->cert_info->serialNumber) goto out; serial = x509->cert_info->serialNumber; key->id_len = ASN1_STRING_length(serial); key->id = talloc_memdup(key, ASN1_STRING_data(serial), key->id_len); key->description = talloc_array(key, char, description_len); X509_NAME_oneline(x509->cert_info->subject, key->description, description_len); rc = 0; out: X509_free(x509); return rc; } struct cert_type cert_types[] = { { EFI_CERT_SHA256_GUID, sha256_key_parse }, { EFI_CERT_X509_GUID, x509_key_parse }, }; static int guidcmp(const EFI_GUID *a, const EFI_GUID *b) { return memcmp(a, b, sizeof(EFI_GUID)); } static int key_parse(struct key *key, const EFI_GUID *type, uint8_t *data, size_t len) { char guid_str[GUID_STRLEN]; unsigned int i; for (i = 0; i < ARRAY_SIZE(cert_types); i++) { if (guidcmp(&cert_types[i].guid, type)) continue; return cert_types[i].parse(key, data, len); } guid_to_str(type, guid_str); printf("warning: unknown signature type found:\n %s\n", guid_str); return -1; } typedef int (*sigdata_fn)(EFI_SIGNATURE_DATA *, int, const EFI_GUID *, void *); /** * Iterates an buffer of EFI_SIGNATURE_LISTs (at db_data, of length len), * and calls fn on each EFI_SIGNATURE_DATA item found. * * fn is passed the EFI_SIGNATURE_DATA pointer, and the length of the * signature data (including GUID header), the type of the signature list, * and a context pointer. */ static int sigdb_iterate(void *db_data, size_t len, sigdata_fn fn, void *arg) { EFI_SIGNATURE_LIST *siglist; EFI_SIGNATURE_DATA *sigdata; unsigned int i, j; int rc = 0; if (len == 0) return 0; if (len < sizeof(*siglist)) return -1; for (i = 0, siglist = db_data + i; i + sizeof(*siglist) <= len && i + siglist->SignatureListSize > i && i + siglist->SignatureListSize <= len && !rc; i += siglist->SignatureListSize, siglist = db_data + i) { /* ensure that the header & sig sizes are sensible */ if (siglist->SignatureHeaderSize > siglist->SignatureListSize) continue; if (siglist->SignatureSize > siglist->SignatureListSize) continue; if (siglist->SignatureSize < sizeof(*sigdata)) continue; /* iterate through the (constant-sized) signature data blocks */ for (j = sizeof(*siglist) + siglist->SignatureHeaderSize; j < siglist->SignatureListSize && !rc; j += siglist->SignatureSize) { sigdata = (void *)(siglist) + j; rc = fn(sigdata, siglist->SignatureSize, &siglist->SignatureType, arg); } } return rc; } struct keydb_add_ctx { struct fs_keystore_entry *ke; struct key_database *kdb; struct keyset *keyset; }; static int keydb_add_key(EFI_SIGNATURE_DATA *sigdata, int len, const EFI_GUID *type, void *arg) { struct keydb_add_ctx *add_ctx = arg; struct key *key; int rc; key = talloc(add_ctx->keyset, struct key); rc = key_parse(key, type, sigdata->SignatureData, len - sizeof(*sigdata)); if (rc) { talloc_free(key); return 0; } key->keystore_entry = add_ctx->ke; key->type = *type; /* add a reference to the keystore entry: we don't want it to be * deallocated if the keystore is deallocated before the * struct key. */ if (key->keystore_entry) talloc_reference(key, key->keystore_entry); list_add(&add_ctx->kdb->keys, &key->list); return 0; } static int read_firmware_keydb(struct sync_context *ctx, struct key_database *kdb) { struct keydb_add_ctx add_ctx; char guid_str[GUID_STRLEN]; char *filename; uint8_t *buf; int rc = -1; size_t len; add_ctx.keyset = ctx->firmware_keys; add_ctx.kdb = kdb; add_ctx.ke = NULL; guid_to_str(&kdb->type->guid, guid_str); filename = talloc_asprintf(ctx->firmware_keys, "%s/%s-%s", ctx->efivars_dir, kdb->type->name, guid_str); buf = NULL; rc = fileio_read_file_noerror(ctx->firmware_keys, filename, &buf, &len); if (rc) goto out; /* efivars files start with a 32-bit attribute block */ if (len < sizeof(uint32_t)) goto out; buf += sizeof(uint32_t); len -= sizeof(uint32_t); rc = 0; sigdb_iterate(buf, len, keydb_add_key, &add_ctx); out: if (rc) talloc_free(buf); talloc_free(filename); return rc; } static void __attribute__((format(printf, 2, 3))) print_keystore_key_error( struct fs_keystore_entry *ke, const char *fmt, ...) { char *errstr; va_list ap; va_start(ap, fmt); errstr = talloc_vasprintf(ke, fmt, ap); fprintf(stderr, "Invalid key %s/%s\n - %s\n", ke->root, ke->name, errstr); talloc_free(errstr); va_end(ap); } static int read_filesystem_keydb(struct sync_context *ctx, struct key_database *kdb) { EFI_GUID cert_type_pkcs7 = EFI_CERT_TYPE_PKCS7_GUID; EFI_VARIABLE_AUTHENTICATION_2 *auth; struct keydb_add_ctx add_ctx; struct fs_keystore_entry *ke; int rc; add_ctx.keyset = ctx->filesystem_keys; add_ctx.kdb = kdb; list_for_each(&ctx->fs_keystore->keys, ke, keystore_list) { unsigned int len; void *buf; if (ke->len == 0) continue; if (ke->type != kdb->type) continue; /* parse the three data structures: * EFI_VARIABLE_AUTHENTICATION_2 token * EFI_SIGNATURE_LIST * EFI_SIGNATURE_DATA * ensuring that we have enough data for each */ buf = ke->data; len = ke->len; if (len < sizeof(*auth)) { print_keystore_key_error(ke, "does not contain an " "EFI_VARIABLE_AUTHENTICATION_2 descriptor"); continue; } auth = buf; if (guidcmp(&auth->AuthInfo.CertType, &cert_type_pkcs7)) { print_keystore_key_error(ke, "unknown cert type"); continue; } if (auth->AuthInfo.Hdr.dwLength > len) { print_keystore_key_error(ke, "invalid WIN_CERTIFICATE length"); continue; } /* the dwLength field includes the size of the WIN_CERTIFICATE, * but not the other data in the EFI_VARIABLE_AUTHENTICATION_2 * descriptor */ buf += sizeof(*auth) - sizeof(auth->AuthInfo) + auth->AuthInfo.Hdr.dwLength; len -= sizeof(*auth) - sizeof(auth->AuthInfo) + auth->AuthInfo.Hdr.dwLength; add_ctx.ke = ke; rc = sigdb_iterate(buf, len, keydb_add_key, &add_ctx); if (rc) { print_keystore_key_error(ke, "error parsing " "EFI_SIGNATURE_LIST"); continue; } } return 0; } static int read_keysets(struct sync_context *ctx) { read_firmware_keydb(ctx, &ctx->firmware_keys->pk); read_firmware_keydb(ctx, &ctx->firmware_keys->kek); read_firmware_keydb(ctx, &ctx->firmware_keys->db); read_firmware_keydb(ctx, &ctx->firmware_keys->dbx); read_filesystem_keydb(ctx, &ctx->filesystem_keys->pk); read_filesystem_keydb(ctx, &ctx->filesystem_keys->kek); read_filesystem_keydb(ctx, &ctx->filesystem_keys->db); read_filesystem_keydb(ctx, &ctx->filesystem_keys->dbx); return 0; } static int check_pk(struct sync_context *ctx) { struct key *key; int i = 0; list_for_each(&ctx->filesystem_keys->pk.keys, key, list) i++; return (i <= 1) ? 0 : 1; } static void print_keyset(struct keyset *keyset, const char *name) { struct key_database *kdbs[] = { &keyset->pk, &keyset->kek, &keyset->db, &keyset->dbx }; struct key *key; unsigned int i; printf("%s keys:\n", name); for (i = 0; i < ARRAY_SIZE(kdbs); i++) { printf(" %s:\n", kdbs[i]->type->name); list_for_each(&kdbs[i]->keys, key, list) { printf(" %s\n", key->description); if (key->keystore_entry) printf(" from %s/%s\n", key->keystore_entry->root, key->keystore_entry->name); } } } static int check_efivars_mount(const char *mountpoint) { struct statfs statbuf; int rc; rc = statfs(mountpoint, &statbuf); if (rc) return -1; if (statbuf.f_type != EFIVARS_FSTYPE) return -1; return 0; } static int keystore_entry_read(struct fs_keystore_entry *ke) { const char *path; int rc; path = talloc_asprintf(ke, "%s/%s", ke->root, ke->name); rc = fileio_read_file(ke, path, &ke->data, &ke->len); talloc_free(path); return rc; } static bool keystore_contains_file(struct fs_keystore *keystore, const char *filename) { struct fs_keystore_entry *ke; list_for_each(&keystore->keys, ke, keystore_list) { if (!strcmp(ke->name, filename)) return true; } return false; } static int update_keystore(struct fs_keystore *keystore, const char *root) { struct fs_keystore_entry *ke; unsigned int i; for (i = 0; i < ARRAY_SIZE(keydb_types); i++) { const char *filename, *dirname; struct dirent *dirent; DIR *dir; dirname = talloc_asprintf(keystore, "%s/%s", root, keydb_types[i].name); dir = opendir(dirname); if (!dir) continue; for (dirent = readdir(dir); dirent; dirent = readdir(dir)) { if (dirent->d_name[0] == '.') continue; filename = talloc_asprintf(dirname, "%s/%s", keydb_types[i].name, dirent->d_name); if (keystore_contains_file(keystore, filename)) continue; ke = talloc(keystore, struct fs_keystore_entry); ke->name = filename; ke->root = root; ke->type = &keydb_types[i]; talloc_steal(ke, ke->name); if (keystore_entry_read(ke)) talloc_free(ke); else list_add(&keystore->keys, &ke->keystore_list); } closedir(dir); talloc_free(dirname); } return 0; } static int read_keystore(struct sync_context *ctx) { struct fs_keystore *keystore; unsigned int i; keystore = talloc(ctx, struct fs_keystore); list_head_init(&keystore->keys); for (i = 0; i < ctx->n_keystore_dirs; i++) { update_keystore(keystore, ctx->keystore_dirs[i]); } ctx->fs_keystore = keystore; return 0; } static void print_keystore(struct fs_keystore *keystore) { struct fs_keystore_entry *ke; printf("Filesystem keystore:\n"); list_for_each(&keystore->keys, ke, keystore_list) printf(" %s/%s [%zd bytes]\n", ke->root, ke->name, ke->len); } static int key_cmp(struct key *a, struct key *b) { if (a->id_len != b->id_len) return a->id_len - b->id_len; return memcmp(a->id, b->id, a->id_len); } /** * Finds the set-difference of the filesystem and firmware keys, and * populates ctx->new_keys with the keystore_entries that should be * inserted into firmware */ static int find_new_keys(struct sync_context *ctx) { struct { struct key_database *fs_kdb, *fw_kdb; } kdbs[] = { { &ctx->filesystem_keys->pk, &ctx->firmware_keys->pk }, { &ctx->filesystem_keys->kek, &ctx->firmware_keys->kek }, { &ctx->filesystem_keys->db, &ctx->firmware_keys->db }, { &ctx->filesystem_keys->dbx, &ctx->firmware_keys->dbx }, }; unsigned int i; int n = 0; for (i = 0; i < ARRAY_SIZE(kdbs); i++ ) { struct fs_keystore_entry *ke; struct key *fs_key, *fw_key; bool found; list_for_each(&kdbs[i].fs_kdb->keys, fs_key, list) { found = false; list_for_each(&kdbs[i].fw_kdb->keys, fw_key, list) { if (!key_cmp(fs_key, fw_key)) { found = true; break; } } if (found) continue; /* add the keystore entry if it's not already present */ found = false; list_for_each(&ctx->new_keys, ke, new_list) { if (fs_key->keystore_entry == ke) { found = true; break; } } if (found) continue; list_add(&ctx->new_keys, &fs_key->keystore_entry->new_list); n++; } } return n; } static void print_new_keys(struct sync_context *ctx) { struct fs_keystore_entry *ke; printf("New keys in filesystem:\n"); list_for_each(&ctx->new_keys, ke, new_list) printf(" %s/%s\n", ke->root, ke->name); } static int insert_key(struct sync_context *ctx, struct fs_keystore_entry *ke) { char guid_str[GUID_STRLEN]; char *efivars_filename; unsigned int buf_len; uint8_t *buf; int fd, rc; fd = -1; rc = -1; if (ctx->verbose) printf("Inserting key update %s/%s into %s\n", ke->root, ke->name, ke->type->name); /* we create a contiguous buffer of attributes & key data, so that * we write to the efivars file in a single syscall */ buf_len = sizeof(sigdb_attrs) + ke->len; buf = talloc_array(ke, uint8_t, buf_len); memcpy(buf, &sigdb_attrs, sizeof(sigdb_attrs)); memcpy(buf + sizeof(sigdb_attrs), ke->data, ke->len); guid_to_str(&ke->type->guid, guid_str); efivars_filename = talloc_asprintf(ke, "%s/%s-%s", ctx->efivars_dir, ke->type->name, guid_str); fd = open(efivars_filename, O_WRONLY | O_CREAT, 0600); if (fd < 0) { fprintf(stderr, "Can't create key file %s: %s\n", efivars_filename, strerror(errno)); goto out; } rc = write(fd, buf, buf_len); if (rc <= 0) { fprintf(stderr, "Error writing key update: %s\n", strerror(errno)); goto out; } if (rc != (int)buf_len) { fprintf(stderr, "Partial write during key update: " "wrote %d bytes, expecting %d\n", rc, buf_len); goto out; } rc = 0; out: if (fd >= 0) close(fd); talloc_free(efivars_filename); talloc_free(buf); if (rc) fprintf(stderr, "Error syncing keystore file %s/%s\n", ke->root, ke->name); return rc; } static int insert_new_keys(struct sync_context *ctx) { struct fs_keystore_entry *ke, *ke_pk; int pks, rc; rc = 0; pks = 0; ke_pk = NULL; list_for_each(&ctx->new_keys, ke, new_list) { /* we handle PK last */ if (ke->type == &keydb_types[KEYDB_PK]) { ke_pk = ke; pks++; continue; } if (insert_key(ctx, ke)) rc = -1; } if (rc) return rc; if (pks == 0 || !ctx->set_pk) return 0; if (pks > 1) { fprintf(stderr, "Skipping PK update due to mutiple PKs\n"); return -1; } rc = insert_key(ctx, ke_pk); return rc; } static struct keyset *init_keyset(struct sync_context *ctx) { struct keyset *keyset; keyset = talloc(ctx, struct keyset); list_head_init(&keyset->pk.keys); keyset->pk.type = &keydb_types[KEYDB_PK]; list_head_init(&keyset->kek.keys); keyset->kek.type = &keydb_types[KEYDB_KEK]; list_head_init(&keyset->db.keys); keyset->db.type = &keydb_types[KEYDB_DB]; list_head_init(&keyset->dbx.keys); keyset->dbx.type = &keydb_types[KEYDB_DBX]; return keyset; } static struct option options[] = { { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, { "efivars-path", required_argument, NULL, 'e' }, { "verbose", no_argument, NULL, 'v' }, { "dry-run", no_argument, NULL, 'n' }, { "pk", no_argument, NULL, 'p' }, { "no-default-keystores", no_argument, NULL, 'd' }, { "keystore", required_argument, NULL, 'k' }, { NULL, 0, NULL, 0 }, }; static void usage(void) { printf("Usage: %s [options]\n" "Update EFI key databases from the filesystem\n" "\n" "Options:\n" "\t--efivars-path Path to efivars mountpoint\n" "\t (or regular directory for testing)\n" "\t--verbose Print verbose progress information\n" "\t--dry-run Don't update firmware key databases\n" "\t--pk Set PK\n" "\t--keystore Read keys from /{db,dbx,KEK}/*\n" "\t (can be specified multiple times,\n" "\t first dir takes precedence)\n" "\t--no-default-keystores\n" "\t Don't read keys from the default\n" "\t keystore dirs\n", toolname); } static void version(void) { printf("%s %s\n", toolname, VERSION); } static void add_keystore_dir(struct sync_context *ctx, const char *dir) { ctx->keystore_dirs = talloc_realloc(ctx, ctx->keystore_dirs, const char *, ++ctx->n_keystore_dirs); ctx->keystore_dirs[ctx->n_keystore_dirs - 1] = talloc_strdup(ctx->keystore_dirs, dir); } int main(int argc, char **argv) { bool use_default_keystore_dirs; struct sync_context *ctx; use_default_keystore_dirs = true; ctx = talloc_zero(NULL, struct sync_context); list_head_init(&ctx->new_keys); for (;;) { int idx, c; c = getopt_long(argc, argv, "e:dpkvhV", options, &idx); if (c == -1) break; switch (c) { case 'e': ctx->efivars_dir = optarg; break; case 'd': use_default_keystore_dirs = false; break; case 'k': add_keystore_dir(ctx, optarg); break; case 'p': ctx->set_pk = true; break; case 'v': ctx->verbose = true; break; case 'n': ctx->dry_run = true; break; case 'V': version(); return EXIT_SUCCESS; case 'h': usage(); return EXIT_SUCCESS; } } if (argc != optind) { usage(); return EXIT_FAILURE; } ERR_load_crypto_strings(); OpenSSL_add_all_digests(); OpenSSL_add_all_ciphers(); ctx->filesystem_keys = init_keyset(ctx); ctx->firmware_keys = init_keyset(ctx); if (!ctx->efivars_dir) { ctx->efivars_dir = EFIVARS_MOUNTPOINT; if (check_efivars_mount(ctx->efivars_dir)) { fprintf(stderr, "Can't access efivars filesystem " "at %s, aborting\n", ctx->efivars_dir); return EXIT_FAILURE; } } if (use_default_keystore_dirs) { unsigned int i; for (i = 0; i < ARRAY_SIZE(default_keystore_dirs); i++) add_keystore_dir(ctx, default_keystore_dirs[i]); } read_keystore(ctx); if (ctx->verbose) print_keystore(ctx->fs_keystore); read_keysets(ctx); if (ctx->verbose) { print_keyset(ctx->firmware_keys, "firmware"); print_keyset(ctx->filesystem_keys, "filesystem"); } if (check_pk(ctx)) fprintf(stderr, "WARNING: multiple PKs found in filesystem\n"); find_new_keys(ctx); if (ctx->verbose) print_new_keys(ctx); if (!ctx->dry_run) insert_new_keys(ctx); talloc_free(ctx); return EXIT_SUCCESS; } sbsigntool-0.6/src/Makefile.am0000664000175000017500000000241212032331270013300 00000000000000 bin_PROGRAMS = sbsign sbverify sbattach sbvarsign sbsiglist sbkeysync coff_headers = coff/external.h coff/pe.h AM_CFLAGS = -Wall -Wextra --std=gnu99 common_SOURCES = idc.c idc.h image.c image.h fileio.c fileio.h \ efivars.h $(coff_headers) common_LDADD = ../lib/ccan/libccan.a $(libcrypto_LIBS) common_CFLAGS = -I$(top_srcdir)/lib/ccan/ sbsign_SOURCES = sbsign.c $(common_SOURCES) sbsign_LDADD = $(common_LDADD) sbsign_CFLAGS = $(AM_CFLAGS) $(common_CFLAGS) sbverify_SOURCES = sbverify.c $(common_SOURCES) sbverify_LDADD = $(common_LDADD) sbverify_CFLAGS = $(AM_CFLAGS) $(common_CFLAGS) sbattach_SOURCES = sbattach.c $(common_SOURCES) sbattach_LDADD = $(common_LDADD) sbattach_CFLAGS = $(AM_CFLAGS) $(common_CFLAGS) sbvarsign_SOURCES = sbvarsign.c $(common_SOURCES) sbvarsign_LDADD = $(common_LDADD) $(uuid_LIBS) sbvarsign_CPPFLAGS = $(EFI_CPPFLAGS) sbvarsign_CFLAGS = $(AM_CFLAGS) $(uuid_CFLAGS) $(common_CFLAGS) sbsiglist_SOURCES = sbsiglist.c $(common_SOURCES) sbsiglist_LDADD = $(common_LDADD) $(uuid_LIBS) sbsiglist_CPPFLAGS = $(EFI_CPPFLAGS) sbsiglist_CFLAGS = $(AM_CFLAGS) $(common_CFLAGS) sbkeysync_SOURCES = sbkeysync.c $(common_SOURCES) sbkeysync_LDADD = $(common_LDADD) $(uuid_LIBS) sbkeysync_CPPFLAGS = $(EFI_CPPFLAGS) sbkeysync_CFLAGS = $(AM_CFLAGS) $(common_CFLAGS) sbsigntool-0.6/src/sbverify.c0000664000175000017500000002014712035660417013261 00000000000000/* * Copyright (C) 2012 Jeremy Kerr * * 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 3 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the OpenSSL * library under certain conditions as described in each individual source file, * and distribute linked combinations including the two. * * You must obey the GNU General Public License in all respects for all * of the code used other than OpenSSL. If you modify file(s) with this * exception, you may extend this exception to your version of the * file(s), but you are not obligated to do so. If you do not wish to do * so, delete this exception statement from your version. If you delete * this exception statement from all source files in the program, then * also delete it here. */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include "image.h" #include "idc.h" #include "fileio.h" #include #include #include #include #include #include static const char *toolname = "sbverify"; static const int cert_name_len = 160; enum verify_status { VERIFY_FAIL = 0, VERIFY_OK = 1, }; static struct option options[] = { { "cert", required_argument, NULL, 'c' }, { "no-verify", no_argument, NULL, 'n' }, { "detached", required_argument, NULL, 'd' }, { "verbose", no_argument, NULL, 'v' }, { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, { NULL, 0, NULL, 0 }, }; static void usage(void) { printf("Usage: %s [options] --cert \n" "Verify a UEFI secure boot image.\n\n" "Options:\n" "\t--cert certificate (x509 certificate)\n" "\t--no-verify don't perform certificate verification\n" "\t--detached read signature from , instead of\n" "\t looking for an embedded signature\n", toolname); } static void version(void) { printf("%s %s\n", toolname, VERSION); } int load_cert(X509_STORE *certs, const char *filename) { X509 *cert; cert = fileio_read_cert(filename); if (!cert) return -1; X509_STORE_add_cert(certs, cert); return 0; } static void print_signature_info(PKCS7 *p7) { char subject_name[cert_name_len + 1], issuer_name[cert_name_len + 1]; PKCS7_SIGNER_INFO *si; X509 *cert; int i; printf("image signature issuers:\n"); for (i = 0; i < sk_PKCS7_SIGNER_INFO_num(p7->d.sign->signer_info); i++) { si = sk_PKCS7_SIGNER_INFO_value(p7->d.sign->signer_info, i); X509_NAME_oneline(si->issuer_and_serial->issuer, issuer_name, cert_name_len); printf(" - %s\n", issuer_name); } printf("image signature certificates:\n"); for (i = 0; i < sk_X509_num(p7->d.sign->cert); i++) { cert = sk_X509_value(p7->d.sign->cert, i); X509_NAME_oneline(cert->cert_info->subject, subject_name, cert_name_len); X509_NAME_oneline(cert->cert_info->issuer, issuer_name, cert_name_len); printf(" - subject: %s\n", subject_name); printf(" issuer: %s\n", issuer_name); } } static void print_certificate_store_certs(X509_STORE *certs) { char subject_name[cert_name_len + 1], issuer_name[cert_name_len + 1]; X509_OBJECT *obj; int i; printf("certificate store:\n"); for (i = 0; i < sk_X509_OBJECT_num(certs->objs); i++) { obj = sk_X509_OBJECT_value(certs->objs, i); if (obj->type != X509_LU_X509) continue; X509_NAME_oneline(obj->data.x509->cert_info->subject, subject_name, cert_name_len); X509_NAME_oneline(obj->data.x509->cert_info->issuer, issuer_name, cert_name_len); printf(" - subject: %s\n", subject_name); printf(" issuer: %s\n", issuer_name); } } static int load_image_signature_data(struct image *image, uint8_t **buf, size_t *len) { struct cert_table_header *header; if (!image->data_dir_sigtable->addr || !image->data_dir_sigtable->size) { fprintf(stderr, "No signature table present\n"); return -1; } header = (void *)image->buf + image->data_dir_sigtable->addr; *buf = (void *)(header + 1); *len = header->size - sizeof(*header); return 0; } static int load_detached_signature_data(struct image *image, const char *filename, uint8_t **buf, size_t *len) { return fileio_read_file(image, filename, buf, len); } static int cert_in_store(X509 *cert, X509_STORE_CTX *ctx) { X509_OBJECT obj; obj.type = X509_LU_X509; obj.data.x509 = cert; return X509_OBJECT_retrieve_match(ctx->ctx->objs, &obj) != NULL; } static int x509_verify_cb(int status, X509_STORE_CTX *ctx) { int err = X509_STORE_CTX_get_error(ctx); /* also accept code-signing keys */ if (err == X509_V_ERR_INVALID_PURPOSE && ctx->cert->ex_xkusage == XKU_CODE_SIGN) status = 1; /* all certs given with the --cert argument are trusted */ else if (err == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY || err == X509_V_ERR_CERT_UNTRUSTED) { if (cert_in_store(ctx->current_cert, ctx)) status = 1; } return status; } int main(int argc, char **argv) { const char *detached_sig_filename, *image_filename; enum verify_status status; int rc, c, flags, verify; const uint8_t *tmp_buf; struct image *image; X509_STORE *certs; uint8_t *sig_buf; size_t sig_size; struct idc *idc; bool verbose; BIO *idcbio; PKCS7 *p7; status = VERIFY_FAIL; certs = X509_STORE_new(); verify = 1; verbose = false; detached_sig_filename = NULL; OpenSSL_add_all_digests(); ERR_load_crypto_strings(); for (;;) { int idx; c = getopt_long(argc, argv, "c:d:nVh", options, &idx); if (c == -1) break; switch (c) { case 'c': rc = load_cert(certs, optarg); if (rc) return EXIT_FAILURE; break; case 'd': detached_sig_filename = optarg; break; case 'n': verify = 0; break; case 'v': verbose = true; break; case 'V': version(); return EXIT_SUCCESS; case 'h': usage(); return EXIT_SUCCESS; } } if (argc != optind + 1) { usage(); return EXIT_FAILURE; } image_filename = argv[optind]; image = image_load(image_filename); if (!image) { fprintf(stderr, "Can't open image %s\n", image_filename); return EXIT_FAILURE; } if (detached_sig_filename) rc = load_detached_signature_data(image, detached_sig_filename, &sig_buf, &sig_size); else rc = load_image_signature_data(image, &sig_buf, &sig_size); if (rc) { fprintf(stderr, "Unable to read signature data from %s\n", detached_sig_filename ? : image_filename); goto out; } tmp_buf = sig_buf; p7 = d2i_PKCS7(NULL, &tmp_buf, sig_size); if (!p7) { fprintf(stderr, "Unable to parse signature data\n"); ERR_print_errors_fp(stderr); goto out; } if (verbose) { print_signature_info(p7); print_certificate_store_certs(certs); } idcbio = BIO_new(BIO_s_mem()); idc = IDC_get(p7, idcbio); if (!idc) goto out; rc = IDC_check_hash(idc, image); if (rc) goto out; flags = PKCS7_BINARY; if (!verify) flags |= PKCS7_NOVERIFY; X509_STORE_set_verify_cb_func(certs, x509_verify_cb); rc = PKCS7_verify(p7, NULL, certs, idcbio, NULL, flags); if (!rc) { printf("PKCS7 verification failed\n"); ERR_print_errors_fp(stderr); goto out; } status = VERIFY_OK; out: talloc_free(image); if (status == VERIFY_OK) printf("Signature verification OK\n"); else printf("Signature verification failed\n"); return status == VERIFY_OK ? EXIT_SUCCESS : EXIT_FAILURE; } sbsigntool-0.6/src/sbvarsign.c0000664000175000017500000003212012032331270013405 00000000000000/* * Copyright (C) 2012 Jeremy Kerr * * 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 3 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the OpenSSL * library under certain conditions as described in each individual source file, * and distribute linked combinations including the two. * * You must obey the GNU General Public License in all respects for all * of the code used other than OpenSSL. If you modify file(s) with this * exception, you may extend this exception to your version of the * file(s), but you are not obligated to do so. If you do not wish to do * so, delete this exception statement from your version. If you delete * this exception statement from all source files in the program, then * also delete it here. */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "efivars.h" #include "fileio.h" static const char *toolname = "sbvarsign"; struct varsign_context { const char *infilename; const char *outfilename; uint8_t *data; size_t data_len; CHAR16 *var_name; int var_name_bytes; EFI_GUID var_guid; uint32_t var_attrs; EVP_PKEY *key; X509 *cert; EFI_VARIABLE_AUTHENTICATION_2 *auth_descriptor; int auth_descriptor_len; EFI_TIME timestamp; int verbose; }; struct attr { const char *name; int value; }; #define EFI_VAR_ATTR(n) { #n, EFI_VARIABLE_ ## n } static struct attr attrs[] = { EFI_VAR_ATTR(NON_VOLATILE), EFI_VAR_ATTR(BOOTSERVICE_ACCESS), EFI_VAR_ATTR(RUNTIME_ACCESS), EFI_VAR_ATTR(TIME_BASED_AUTHENTICATED_WRITE_ACCESS), EFI_VAR_ATTR(APPEND_WRITE), }; static uint32_t default_attrs = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | EFI_VARIABLE_APPEND_WRITE; static uint32_t attr_invalid = 0xffffffffu; static const char *attr_prefix = "EFI_VARIABLE_"; static const EFI_GUID default_guid = EFI_GLOBAL_VARIABLE; static const EFI_GUID cert_pkcs7_guid = EFI_CERT_TYPE_PKCS7_GUID; static void set_default_outfilename(struct varsign_context *ctx) { const char *extension = "signed"; ctx->outfilename = talloc_asprintf(ctx, "%s.%s", ctx->infilename, extension); } static uint32_t parse_single_attr(const char *attr_str) { unsigned int i; /* skip standard prefix, if present */ if (!strncmp(attr_str, attr_prefix, strlen(attr_prefix))) attr_str += strlen(attr_prefix); for (i = 0; i < ARRAY_SIZE(attrs); i++) { if (!strcmp(attr_str, attrs[i].name)) return attrs[i].value; } return attr_invalid; } static uint32_t parse_attrs(const char *attrs_str) { uint32_t attr, attrs_val; const char *attr_str; char *str; /* we always need E_V_T_B_A_W_A */ attrs_val = EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS; if (!attrs_str[0]) return attrs_val; str = strdup(attrs_str); for (attr_str = strtok(str, ","); attr_str; attr_str = strtok(NULL, ",")) { attr = parse_single_attr(attr_str); if (attr == attr_invalid) { fprintf(stderr, "Invalid attribute string %s\n", attr_str); return attr_invalid; } attrs_val |= attr; } return attrs_val; } static int set_varname(struct varsign_context *ctx, const char *str) { CHAR16 *wstr; int i, len; len = strlen(str); wstr = talloc_array(ctx, CHAR16, len); for (i = 0; i < len; i++) wstr[i] = str[i]; ctx->var_name = wstr; ctx->var_name_bytes = len * sizeof(CHAR16); return 0; } static int parse_guid(const char *str, EFI_GUID *guid) { uuid_t uuid; if (uuid_parse(str, uuid)) return -1; /* convert to an EFI_GUID */ guid->Data1 = uuid[0] << 24 | uuid[1] << 16 | uuid[2] << 8 | uuid[3]; guid->Data2 = uuid[4] << 8 | uuid[5]; guid->Data3 = uuid[6] << 8 | uuid[7]; memcpy(guid->Data4, &uuid[8], sizeof(guid->Data4)); return 0; } static int set_timestamp(EFI_TIME *timestamp) { struct tm *tm; time_t t; time(&t); tm = gmtime(&t); if (!tm) { perror("gmtime"); return -1; } /* copy to our EFI-specific time structure. Other fields (Nanosecond, * TimeZone, Daylight and Pad) are defined to be zero */ memset(timestamp, 0, sizeof(*timestamp)); timestamp->Year = tm->tm_year; timestamp->Month = tm->tm_mon; timestamp->Day = tm->tm_mday; timestamp->Hour = tm->tm_hour; timestamp->Minute = tm->tm_min; timestamp->Second = tm->tm_sec; return 0; } static int add_auth_descriptor(struct varsign_context *ctx) { EFI_VARIABLE_AUTHENTICATION_2 *auth; int rc, len, flags; EFI_TIME timestamp; const EVP_MD *md; BIO *data_bio; uint8_t *tmp; PKCS7 *p7; if (set_timestamp(×tamp)) return -1; /* create a BIO for our variable data, containing: * * Variablename (not including trailing nul) * * VendorGUID * * Attributes * * TimeStamp * * Data */ data_bio = BIO_new(BIO_s_mem()); BIO_write(data_bio, ctx->var_name, ctx->var_name_bytes); BIO_write(data_bio, &ctx->var_guid, sizeof(ctx->var_guid)); BIO_write(data_bio, &ctx->var_attrs, sizeof(ctx->var_attrs)); BIO_write(data_bio, ×tamp, sizeof(timestamp)); BIO_write(data_bio, ctx->data, ctx->data_len); md = EVP_get_digestbyname("SHA256"); p7 = PKCS7_new(); flags = PKCS7_BINARY | PKCS7_DETACHED | PKCS7_NOSMIMECAP;; PKCS7_set_type(p7, NID_pkcs7_signed); PKCS7_content_new(p7, NID_pkcs7_data); PKCS7_sign_add_signer(p7, ctx->cert, ctx->key, md, flags); PKCS7_set_detached(p7, 1); rc = PKCS7_final(p7, data_bio, flags); if (!rc) { fprintf(stderr, "Error signing variable data\n"); ERR_print_errors_fp(stderr); BIO_free_all(data_bio); return -1; } len = i2d_PKCS7(p7, NULL); /* set up our auth descriptor */ auth = talloc_size(ctx, sizeof(*auth) + len); auth->TimeStamp = timestamp; auth->AuthInfo.Hdr.dwLength = len + sizeof(auth->AuthInfo); auth->AuthInfo.Hdr.wRevision = 0x0200; auth->AuthInfo.Hdr.wCertificateType = 0x0EF1; auth->AuthInfo.CertType = cert_pkcs7_guid; tmp = auth->AuthInfo.CertData; i2d_PKCS7(p7, &tmp); ctx->auth_descriptor = auth; ctx->auth_descriptor_len = sizeof(*auth) + len; BIO_free_all(data_bio); return 0; } int write_signed(struct varsign_context *ctx, int include_attrs) { int fd, rc; fd = open(ctx->outfilename, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd < 0) { perror("open"); goto err; } /* For some uses (eg, writing to the efivars filesystem), we may * want to prefix the signed variable with four bytes of attribute * data */ if (include_attrs) { rc = write_all(fd, &ctx->var_attrs, sizeof(ctx->var_attrs)); if (!rc) { perror("write_all"); goto err; } } /* Write the authentication descriptor */ rc = write_all(fd, ctx->auth_descriptor, ctx->auth_descriptor_len); if (!rc) { perror("write_all"); goto err; } /* ... and the variable data itself */ rc = write_all(fd, ctx->data, ctx->data_len); if (!rc) { perror("write_all"); goto err; } if (ctx->verbose) { size_t i = 0; printf("Wrote signed data:\n"); if (include_attrs) { i = sizeof(ctx->var_attrs); printf(" [%04zx:%04zx] attrs\n", 0l, i); } printf(" [%04zx:%04x] authentication descriptor\n", i, ctx->auth_descriptor_len); printf(" [%04zx:%04zx] EFI_VAR_AUTH_2 header\n", i, sizeof(EFI_VARIABLE_AUTHENTICATION_2)); printf(" [%04zx:%04zx] WIN_CERT_UEFI_GUID header\n", i + offsetof(EFI_VARIABLE_AUTHENTICATION_2, AuthInfo), sizeof(WIN_CERTIFICATE_UEFI_GUID)); printf(" [%04zx:%04zx] WIN_CERT header\n", i + offsetof(EFI_VARIABLE_AUTHENTICATION_2, AuthInfo.Hdr), sizeof(WIN_CERTIFICATE)); printf(" [%04zx:%04zx] pkcs7 data\n", i + offsetof(EFI_VARIABLE_AUTHENTICATION_2, AuthInfo.CertData), ctx->auth_descriptor_len - sizeof(EFI_VARIABLE_AUTHENTICATION_2)); i += ctx->auth_descriptor_len; printf(" [%04zx:%04zx] variable data\n", i, i + ctx->data_len); } close(fd); return 0; err: fprintf(stderr, "Can't write signed data to file '%s'\n", ctx->outfilename); if (fd >= 0) close(fd); return -1; } static void set_default_guid(struct varsign_context *ctx, const char *varname) { EFI_GUID secdb_guid = EFI_IMAGE_SECURITY_DATABASE_GUID; EFI_GUID global_guid = EFI_GLOBAL_VARIABLE; if (!strcmp(varname, "db") || !strcmp(varname, "dbx")) ctx->var_guid = secdb_guid; else ctx->var_guid = global_guid; } static struct option options[] = { { "output", required_argument, NULL, 'o' }, { "guid", required_argument, NULL, 'g' }, { "attrs", required_argument, NULL, 'a' }, { "key", required_argument, NULL, 'k' }, { "cert", required_argument, NULL, 'c' }, { "include-attrs", no_argument, NULL, 'i' }, { "verbose", no_argument, NULL, 'v' }, { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, { NULL, 0, NULL, 0 }, }; void usage(void) { unsigned int i; printf("Usage: %s [options] --key --cert " " \n" "Sign a blob of data for use in SetVariable().\n\n" "Options:\n" "\t--key signing key (PEM-encoded RSA " "private key)\n" "\t--cert certificate (x509 certificate)\n" "\t--include-attrs include attrs at beginning of output file\n" "\t--guid EFI GUID for the variable. If omitted,\n" "\t EFI_IMAGE_SECURITY_DATABASE or\n" "\t EFI_GLOBAL_VARIABLE (depending on\n" "\t ) will be used.\n" "\t--attr variable attributes. One or more of:\n", toolname); for (i = 0; i < ARRAY_SIZE(attrs); i++) printf("\t %s\n", attrs[i].name); printf("\t Separate multiple attrs with a comma,\n" "\t default is all attributes,\n" "\t TIME_BASED_AUTH... is always included.\n" "\t--output write signed data to \n" "\t (default .signed)\n"); } static void version(void) { printf("%s %s\n", toolname, VERSION); } int main(int argc, char **argv) { const char *guid_str, *attr_str, *varname; const char *keyfilename, *certfilename; struct varsign_context *ctx; bool include_attrs; int c; ctx = talloc_zero(NULL, struct varsign_context); keyfilename = NULL; certfilename = NULL; guid_str = NULL; attr_str= NULL; include_attrs = false; for (;;) { int idx; c = getopt_long(argc, argv, "o:g:a:k:c:ivVh", options, &idx); if (c == -1) break; switch (c) { case 'o': ctx->outfilename = optarg; break; case 'g': guid_str = optarg; break; case 'a': attr_str = optarg; break; case 'k': keyfilename = optarg; break; case 'c': certfilename = optarg; break; case 'i': include_attrs = true; break; case 'v': ctx->verbose = 1; break; case 'V': version(); return EXIT_SUCCESS; case 'h': usage(); return EXIT_SUCCESS; } } if (argc != optind + 2) { usage(); return EXIT_FAILURE; } if (!keyfilename) { fprintf(stderr, "No signing key specified\n"); return EXIT_FAILURE; } if (!certfilename) { fprintf(stderr, "No signing certificate specified\n"); return EXIT_FAILURE; } /* initialise openssl */ OpenSSL_add_all_digests(); OpenSSL_add_all_ciphers(); ERR_load_crypto_strings(); /* set up the variable signing context */ varname = argv[optind]; set_varname(ctx, varname); ctx->infilename = argv[optind+1]; if (!ctx->outfilename) set_default_outfilename(ctx); if (attr_str) { ctx->var_attrs = parse_attrs(attr_str); if (ctx->var_attrs == attr_invalid) return EXIT_FAILURE; } else { ctx->var_attrs = default_attrs; } if (guid_str) { if (parse_guid(guid_str, &ctx->var_guid)) { fprintf(stderr, "Invalid GUID '%s'\n", guid_str); return EXIT_FAILURE; } } else { set_default_guid(ctx, varname); } if (fileio_read_file(ctx, ctx->infilename, &ctx->data, &ctx->data_len)) return EXIT_FAILURE; ctx->key = fileio_read_pkey(keyfilename); if (!ctx->key) return EXIT_FAILURE; ctx->cert = fileio_read_cert(certfilename); if (!ctx->cert) return EXIT_FAILURE; /* do the signing */ if (add_auth_descriptor(ctx)) return EXIT_FAILURE; /* write the resulting image */ if (write_signed(ctx, include_attrs)) return EXIT_FAILURE; return EXIT_SUCCESS; } sbsigntool-0.6/src/sbattach.c0000664000175000017500000001366312032331270013213 00000000000000/* * Copyright (C) 2012 Jeremy Kerr * * 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 3 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the OpenSSL * library under certain conditions as described in each individual source file, * and distribute linked combinations including the two. * * You must obey the GNU General Public License in all respects for all * of the code used other than OpenSSL. If you modify file(s) with this * exception, you may extend this exception to your version of the * file(s), but you are not obligated to do so. If you do not wish to do * so, delete this exception statement from your version. If you delete * this exception statement from all source files in the program, then * also delete it here. */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "config.h" #include "image.h" #include "fileio.h" static const char *toolname = "sbattach"; static struct option options[] = { { "attach", required_argument, NULL, 'a' }, { "detach", required_argument, NULL, 'd' }, { "remove", no_argument, NULL, 'r' }, { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, { NULL, 0, NULL, 0 }, }; static void usage(void) { printf("Usage: %s --attach \n" " or: %s --detach [--remove] \n" " or: %s --remove \n" "Attach or detach a signature file to/from a boot image\n" "\n" "Options:\n" "\t--attach set as the boot image's\n" "\t signature table\n" "\t--detach copy the boot image's signature table\n" "\t to \n" "\t--remove remove the boot image's signature\n" "\t table from the original file\n", toolname, toolname, toolname); } static void version(void) { printf("%s %s\n", toolname, VERSION); } static int detach_sig(struct image *image, const char *sig_filename) { return image_write_detached(image, sig_filename); } static int attach_sig(struct image *image, const char *image_filename, const char *sig_filename) { const uint8_t *tmp_buf; uint8_t *sigbuf; size_t size; PKCS7 *p7; int rc; rc = fileio_read_file(image, sig_filename, &sigbuf, &size); if (rc) goto out; image_add_signature(image, sigbuf, size); rc = -1; tmp_buf = sigbuf; p7 = d2i_PKCS7(NULL, &tmp_buf, size); if (!p7) { fprintf(stderr, "Unable to parse signature data in file: %s\n", sig_filename); ERR_print_errors_fp(stderr); goto out; } rc = PKCS7_verify(p7, NULL, NULL, NULL, NULL, PKCS7_BINARY | PKCS7_NOVERIFY | PKCS7_NOSIGS); if (!rc) { fprintf(stderr, "PKCS7 verification failed for file %s\n", sig_filename); ERR_print_errors_fp(stderr); goto out; } rc = image_write(image, image_filename); if (rc) fprintf(stderr, "Error writing %s: %s\n", image_filename, strerror(errno)); out: talloc_free(sigbuf); return rc; } static int remove_sig(struct image *image, const char *image_filename) { int rc; image_remove_signature(image); rc = image_write(image, image_filename); if (rc) fprintf(stderr, "Error writing %s: %s\n", image_filename, strerror(errno)); return rc; } enum action { ACTION_NONE, ACTION_ATTACH, ACTION_DETACH, }; int main(int argc, char **argv) { const char *image_filename, *sig_filename; struct image *image; enum action action; bool remove; int c, rc; action = ACTION_NONE; sig_filename = NULL; remove = false; for (;;) { int idx; c = getopt_long(argc, argv, "a:d:rhV", options, &idx); if (c == -1) break; switch (c) { case 'a': case 'd': if (action != ACTION_NONE) { fprintf(stderr, "Multiple actions specified\n"); usage(); return EXIT_FAILURE; } action = (c == 'a') ? ACTION_ATTACH : ACTION_DETACH; sig_filename = optarg; break; case 'r': remove = true; break; case 'V': version(); return EXIT_SUCCESS; case 'h': usage(); return EXIT_SUCCESS; } } if (argc != optind + 1) { usage(); return EXIT_FAILURE; } image_filename = argv[optind]; /* sanity check action combinations */ if (action == ACTION_ATTACH && remove) { fprintf(stderr, "Can't use --remove with --attach\n"); return EXIT_FAILURE; } if (action == ACTION_NONE && !remove) { fprintf(stderr, "No action (attach/detach/remove) specified\n"); usage(); return EXIT_FAILURE; } ERR_load_crypto_strings(); OpenSSL_add_all_digests(); image = image_load(image_filename); if (!image) { fprintf(stderr, "Can't load image file %s\n", image_filename); return EXIT_FAILURE; } rc = 0; if (action == ACTION_ATTACH) rc = attach_sig(image, image_filename, sig_filename); else if (action == ACTION_DETACH) rc = detach_sig(image, sig_filename); if (rc) goto out; if (remove) rc = remove_sig(image, image_filename); out: talloc_free(image); return (rc == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } sbsigntool-0.6/src/Makefile.in0000664000175000017500000017017712035660544013343 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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 = : bin_PROGRAMS = sbsign$(EXEEXT) sbverify$(EXEEXT) sbattach$(EXEEXT) \ sbvarsign$(EXEEXT) sbsiglist$(EXEEXT) sbkeysync$(EXEEXT) subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am__objects_1 = am__objects_2 = sbattach-idc.$(OBJEXT) sbattach-image.$(OBJEXT) \ sbattach-fileio.$(OBJEXT) $(am__objects_1) am_sbattach_OBJECTS = sbattach-sbattach.$(OBJEXT) $(am__objects_2) sbattach_OBJECTS = $(am_sbattach_OBJECTS) am__DEPENDENCIES_1 = am__DEPENDENCIES_2 = ../lib/ccan/libccan.a $(am__DEPENDENCIES_1) sbattach_DEPENDENCIES = $(am__DEPENDENCIES_2) sbattach_LINK = $(CCLD) $(sbattach_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ am__objects_3 = sbkeysync-idc.$(OBJEXT) sbkeysync-image.$(OBJEXT) \ sbkeysync-fileio.$(OBJEXT) $(am__objects_1) am_sbkeysync_OBJECTS = sbkeysync-sbkeysync.$(OBJEXT) $(am__objects_3) sbkeysync_OBJECTS = $(am_sbkeysync_OBJECTS) sbkeysync_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) sbkeysync_LINK = $(CCLD) $(sbkeysync_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ am__objects_4 = sbsiglist-idc.$(OBJEXT) sbsiglist-image.$(OBJEXT) \ sbsiglist-fileio.$(OBJEXT) $(am__objects_1) am_sbsiglist_OBJECTS = sbsiglist-sbsiglist.$(OBJEXT) $(am__objects_4) sbsiglist_OBJECTS = $(am_sbsiglist_OBJECTS) sbsiglist_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) sbsiglist_LINK = $(CCLD) $(sbsiglist_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ am__objects_5 = sbsign-idc.$(OBJEXT) sbsign-image.$(OBJEXT) \ sbsign-fileio.$(OBJEXT) $(am__objects_1) am_sbsign_OBJECTS = sbsign-sbsign.$(OBJEXT) $(am__objects_5) sbsign_OBJECTS = $(am_sbsign_OBJECTS) sbsign_DEPENDENCIES = $(am__DEPENDENCIES_2) sbsign_LINK = $(CCLD) $(sbsign_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ am__objects_6 = sbvarsign-idc.$(OBJEXT) sbvarsign-image.$(OBJEXT) \ sbvarsign-fileio.$(OBJEXT) $(am__objects_1) am_sbvarsign_OBJECTS = sbvarsign-sbvarsign.$(OBJEXT) $(am__objects_6) sbvarsign_OBJECTS = $(am_sbvarsign_OBJECTS) sbvarsign_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) sbvarsign_LINK = $(CCLD) $(sbvarsign_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ am__objects_7 = sbverify-idc.$(OBJEXT) sbverify-image.$(OBJEXT) \ sbverify-fileio.$(OBJEXT) $(am__objects_1) am_sbverify_OBJECTS = sbverify-sbverify.$(OBJEXT) $(am__objects_7) sbverify_OBJECTS = $(am_sbverify_OBJECTS) sbverify_DEPENDENCIES = $(am__DEPENDENCIES_2) sbverify_LINK = $(CCLD) $(sbverify_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ 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) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(sbattach_SOURCES) $(sbkeysync_SOURCES) \ $(sbsiglist_SOURCES) $(sbsign_SOURCES) $(sbvarsign_SOURCES) \ $(sbverify_SOURCES) DIST_SOURCES = $(sbattach_SOURCES) $(sbkeysync_SOURCES) \ $(sbsiglist_SOURCES) $(sbsign_SOURCES) $(sbvarsign_SOURCES) \ $(sbverify_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ 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@ EFI_CPPFLAGS = @EFI_CPPFLAGS@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ HELP2MAN = @HELP2MAN@ 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@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJCOPY = @OBJCOPY@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ 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@ libcrypto_CFLAGS = @libcrypto_CFLAGS@ libcrypto_LIBS = @libcrypto_LIBS@ 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@ 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@ uuid_CFLAGS = @uuid_CFLAGS@ uuid_LIBS = @uuid_LIBS@ coff_headers = coff/external.h coff/pe.h AM_CFLAGS = -Wall -Wextra --std=gnu99 common_SOURCES = idc.c idc.h image.c image.h fileio.c fileio.h \ efivars.h $(coff_headers) common_LDADD = ../lib/ccan/libccan.a $(libcrypto_LIBS) common_CFLAGS = -I$(top_srcdir)/lib/ccan/ sbsign_SOURCES = sbsign.c $(common_SOURCES) sbsign_LDADD = $(common_LDADD) sbsign_CFLAGS = $(AM_CFLAGS) $(common_CFLAGS) sbverify_SOURCES = sbverify.c $(common_SOURCES) sbverify_LDADD = $(common_LDADD) sbverify_CFLAGS = $(AM_CFLAGS) $(common_CFLAGS) sbattach_SOURCES = sbattach.c $(common_SOURCES) sbattach_LDADD = $(common_LDADD) sbattach_CFLAGS = $(AM_CFLAGS) $(common_CFLAGS) sbvarsign_SOURCES = sbvarsign.c $(common_SOURCES) sbvarsign_LDADD = $(common_LDADD) $(uuid_LIBS) sbvarsign_CPPFLAGS = $(EFI_CPPFLAGS) sbvarsign_CFLAGS = $(AM_CFLAGS) $(uuid_CFLAGS) $(common_CFLAGS) sbsiglist_SOURCES = sbsiglist.c $(common_SOURCES) sbsiglist_LDADD = $(common_LDADD) $(uuid_LIBS) sbsiglist_CPPFLAGS = $(EFI_CPPFLAGS) sbsiglist_CFLAGS = $(AM_CFLAGS) $(common_CFLAGS) sbkeysync_SOURCES = sbkeysync.c $(common_SOURCES) sbkeysync_LDADD = $(common_LDADD) $(uuid_LIBS) sbkeysync_CPPFLAGS = $(EFI_CPPFLAGS) sbkeysync_CFLAGS = $(AM_CFLAGS) $(common_CFLAGS) all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p; \ 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)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) sbattach$(EXEEXT): $(sbattach_OBJECTS) $(sbattach_DEPENDENCIES) $(EXTRA_sbattach_DEPENDENCIES) @rm -f sbattach$(EXEEXT) $(sbattach_LINK) $(sbattach_OBJECTS) $(sbattach_LDADD) $(LIBS) sbkeysync$(EXEEXT): $(sbkeysync_OBJECTS) $(sbkeysync_DEPENDENCIES) $(EXTRA_sbkeysync_DEPENDENCIES) @rm -f sbkeysync$(EXEEXT) $(sbkeysync_LINK) $(sbkeysync_OBJECTS) $(sbkeysync_LDADD) $(LIBS) sbsiglist$(EXEEXT): $(sbsiglist_OBJECTS) $(sbsiglist_DEPENDENCIES) $(EXTRA_sbsiglist_DEPENDENCIES) @rm -f sbsiglist$(EXEEXT) $(sbsiglist_LINK) $(sbsiglist_OBJECTS) $(sbsiglist_LDADD) $(LIBS) sbsign$(EXEEXT): $(sbsign_OBJECTS) $(sbsign_DEPENDENCIES) $(EXTRA_sbsign_DEPENDENCIES) @rm -f sbsign$(EXEEXT) $(sbsign_LINK) $(sbsign_OBJECTS) $(sbsign_LDADD) $(LIBS) sbvarsign$(EXEEXT): $(sbvarsign_OBJECTS) $(sbvarsign_DEPENDENCIES) $(EXTRA_sbvarsign_DEPENDENCIES) @rm -f sbvarsign$(EXEEXT) $(sbvarsign_LINK) $(sbvarsign_OBJECTS) $(sbvarsign_LDADD) $(LIBS) sbverify$(EXEEXT): $(sbverify_OBJECTS) $(sbverify_DEPENDENCIES) $(EXTRA_sbverify_DEPENDENCIES) @rm -f sbverify$(EXEEXT) $(sbverify_LINK) $(sbverify_OBJECTS) $(sbverify_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbattach-fileio.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbattach-idc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbattach-image.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbattach-sbattach.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbkeysync-fileio.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbkeysync-idc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbkeysync-image.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbkeysync-sbkeysync.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbsiglist-fileio.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbsiglist-idc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbsiglist-image.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbsiglist-sbsiglist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbsign-fileio.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbsign-idc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbsign-image.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbsign-sbsign.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbvarsign-fileio.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbvarsign-idc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbvarsign-image.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbvarsign-sbvarsign.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbverify-fileio.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbverify-idc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbverify-image.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbverify-sbverify.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` sbattach-sbattach.o: sbattach.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbattach_CFLAGS) $(CFLAGS) -MT sbattach-sbattach.o -MD -MP -MF $(DEPDIR)/sbattach-sbattach.Tpo -c -o sbattach-sbattach.o `test -f 'sbattach.c' || echo '$(srcdir)/'`sbattach.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbattach-sbattach.Tpo $(DEPDIR)/sbattach-sbattach.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sbattach.c' object='sbattach-sbattach.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbattach_CFLAGS) $(CFLAGS) -c -o sbattach-sbattach.o `test -f 'sbattach.c' || echo '$(srcdir)/'`sbattach.c sbattach-sbattach.obj: sbattach.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbattach_CFLAGS) $(CFLAGS) -MT sbattach-sbattach.obj -MD -MP -MF $(DEPDIR)/sbattach-sbattach.Tpo -c -o sbattach-sbattach.obj `if test -f 'sbattach.c'; then $(CYGPATH_W) 'sbattach.c'; else $(CYGPATH_W) '$(srcdir)/sbattach.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbattach-sbattach.Tpo $(DEPDIR)/sbattach-sbattach.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sbattach.c' object='sbattach-sbattach.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbattach_CFLAGS) $(CFLAGS) -c -o sbattach-sbattach.obj `if test -f 'sbattach.c'; then $(CYGPATH_W) 'sbattach.c'; else $(CYGPATH_W) '$(srcdir)/sbattach.c'; fi` sbattach-idc.o: idc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbattach_CFLAGS) $(CFLAGS) -MT sbattach-idc.o -MD -MP -MF $(DEPDIR)/sbattach-idc.Tpo -c -o sbattach-idc.o `test -f 'idc.c' || echo '$(srcdir)/'`idc.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbattach-idc.Tpo $(DEPDIR)/sbattach-idc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='idc.c' object='sbattach-idc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbattach_CFLAGS) $(CFLAGS) -c -o sbattach-idc.o `test -f 'idc.c' || echo '$(srcdir)/'`idc.c sbattach-idc.obj: idc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbattach_CFLAGS) $(CFLAGS) -MT sbattach-idc.obj -MD -MP -MF $(DEPDIR)/sbattach-idc.Tpo -c -o sbattach-idc.obj `if test -f 'idc.c'; then $(CYGPATH_W) 'idc.c'; else $(CYGPATH_W) '$(srcdir)/idc.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbattach-idc.Tpo $(DEPDIR)/sbattach-idc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='idc.c' object='sbattach-idc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbattach_CFLAGS) $(CFLAGS) -c -o sbattach-idc.obj `if test -f 'idc.c'; then $(CYGPATH_W) 'idc.c'; else $(CYGPATH_W) '$(srcdir)/idc.c'; fi` sbattach-image.o: image.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbattach_CFLAGS) $(CFLAGS) -MT sbattach-image.o -MD -MP -MF $(DEPDIR)/sbattach-image.Tpo -c -o sbattach-image.o `test -f 'image.c' || echo '$(srcdir)/'`image.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbattach-image.Tpo $(DEPDIR)/sbattach-image.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='image.c' object='sbattach-image.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbattach_CFLAGS) $(CFLAGS) -c -o sbattach-image.o `test -f 'image.c' || echo '$(srcdir)/'`image.c sbattach-image.obj: image.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbattach_CFLAGS) $(CFLAGS) -MT sbattach-image.obj -MD -MP -MF $(DEPDIR)/sbattach-image.Tpo -c -o sbattach-image.obj `if test -f 'image.c'; then $(CYGPATH_W) 'image.c'; else $(CYGPATH_W) '$(srcdir)/image.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbattach-image.Tpo $(DEPDIR)/sbattach-image.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='image.c' object='sbattach-image.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbattach_CFLAGS) $(CFLAGS) -c -o sbattach-image.obj `if test -f 'image.c'; then $(CYGPATH_W) 'image.c'; else $(CYGPATH_W) '$(srcdir)/image.c'; fi` sbattach-fileio.o: fileio.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbattach_CFLAGS) $(CFLAGS) -MT sbattach-fileio.o -MD -MP -MF $(DEPDIR)/sbattach-fileio.Tpo -c -o sbattach-fileio.o `test -f 'fileio.c' || echo '$(srcdir)/'`fileio.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbattach-fileio.Tpo $(DEPDIR)/sbattach-fileio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fileio.c' object='sbattach-fileio.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbattach_CFLAGS) $(CFLAGS) -c -o sbattach-fileio.o `test -f 'fileio.c' || echo '$(srcdir)/'`fileio.c sbattach-fileio.obj: fileio.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbattach_CFLAGS) $(CFLAGS) -MT sbattach-fileio.obj -MD -MP -MF $(DEPDIR)/sbattach-fileio.Tpo -c -o sbattach-fileio.obj `if test -f 'fileio.c'; then $(CYGPATH_W) 'fileio.c'; else $(CYGPATH_W) '$(srcdir)/fileio.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbattach-fileio.Tpo $(DEPDIR)/sbattach-fileio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fileio.c' object='sbattach-fileio.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbattach_CFLAGS) $(CFLAGS) -c -o sbattach-fileio.obj `if test -f 'fileio.c'; then $(CYGPATH_W) 'fileio.c'; else $(CYGPATH_W) '$(srcdir)/fileio.c'; fi` sbkeysync-sbkeysync.o: sbkeysync.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbkeysync_CPPFLAGS) $(CPPFLAGS) $(sbkeysync_CFLAGS) $(CFLAGS) -MT sbkeysync-sbkeysync.o -MD -MP -MF $(DEPDIR)/sbkeysync-sbkeysync.Tpo -c -o sbkeysync-sbkeysync.o `test -f 'sbkeysync.c' || echo '$(srcdir)/'`sbkeysync.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbkeysync-sbkeysync.Tpo $(DEPDIR)/sbkeysync-sbkeysync.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sbkeysync.c' object='sbkeysync-sbkeysync.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbkeysync_CPPFLAGS) $(CPPFLAGS) $(sbkeysync_CFLAGS) $(CFLAGS) -c -o sbkeysync-sbkeysync.o `test -f 'sbkeysync.c' || echo '$(srcdir)/'`sbkeysync.c sbkeysync-sbkeysync.obj: sbkeysync.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbkeysync_CPPFLAGS) $(CPPFLAGS) $(sbkeysync_CFLAGS) $(CFLAGS) -MT sbkeysync-sbkeysync.obj -MD -MP -MF $(DEPDIR)/sbkeysync-sbkeysync.Tpo -c -o sbkeysync-sbkeysync.obj `if test -f 'sbkeysync.c'; then $(CYGPATH_W) 'sbkeysync.c'; else $(CYGPATH_W) '$(srcdir)/sbkeysync.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbkeysync-sbkeysync.Tpo $(DEPDIR)/sbkeysync-sbkeysync.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sbkeysync.c' object='sbkeysync-sbkeysync.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbkeysync_CPPFLAGS) $(CPPFLAGS) $(sbkeysync_CFLAGS) $(CFLAGS) -c -o sbkeysync-sbkeysync.obj `if test -f 'sbkeysync.c'; then $(CYGPATH_W) 'sbkeysync.c'; else $(CYGPATH_W) '$(srcdir)/sbkeysync.c'; fi` sbkeysync-idc.o: idc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbkeysync_CPPFLAGS) $(CPPFLAGS) $(sbkeysync_CFLAGS) $(CFLAGS) -MT sbkeysync-idc.o -MD -MP -MF $(DEPDIR)/sbkeysync-idc.Tpo -c -o sbkeysync-idc.o `test -f 'idc.c' || echo '$(srcdir)/'`idc.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbkeysync-idc.Tpo $(DEPDIR)/sbkeysync-idc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='idc.c' object='sbkeysync-idc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbkeysync_CPPFLAGS) $(CPPFLAGS) $(sbkeysync_CFLAGS) $(CFLAGS) -c -o sbkeysync-idc.o `test -f 'idc.c' || echo '$(srcdir)/'`idc.c sbkeysync-idc.obj: idc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbkeysync_CPPFLAGS) $(CPPFLAGS) $(sbkeysync_CFLAGS) $(CFLAGS) -MT sbkeysync-idc.obj -MD -MP -MF $(DEPDIR)/sbkeysync-idc.Tpo -c -o sbkeysync-idc.obj `if test -f 'idc.c'; then $(CYGPATH_W) 'idc.c'; else $(CYGPATH_W) '$(srcdir)/idc.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbkeysync-idc.Tpo $(DEPDIR)/sbkeysync-idc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='idc.c' object='sbkeysync-idc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbkeysync_CPPFLAGS) $(CPPFLAGS) $(sbkeysync_CFLAGS) $(CFLAGS) -c -o sbkeysync-idc.obj `if test -f 'idc.c'; then $(CYGPATH_W) 'idc.c'; else $(CYGPATH_W) '$(srcdir)/idc.c'; fi` sbkeysync-image.o: image.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbkeysync_CPPFLAGS) $(CPPFLAGS) $(sbkeysync_CFLAGS) $(CFLAGS) -MT sbkeysync-image.o -MD -MP -MF $(DEPDIR)/sbkeysync-image.Tpo -c -o sbkeysync-image.o `test -f 'image.c' || echo '$(srcdir)/'`image.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbkeysync-image.Tpo $(DEPDIR)/sbkeysync-image.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='image.c' object='sbkeysync-image.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbkeysync_CPPFLAGS) $(CPPFLAGS) $(sbkeysync_CFLAGS) $(CFLAGS) -c -o sbkeysync-image.o `test -f 'image.c' || echo '$(srcdir)/'`image.c sbkeysync-image.obj: image.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbkeysync_CPPFLAGS) $(CPPFLAGS) $(sbkeysync_CFLAGS) $(CFLAGS) -MT sbkeysync-image.obj -MD -MP -MF $(DEPDIR)/sbkeysync-image.Tpo -c -o sbkeysync-image.obj `if test -f 'image.c'; then $(CYGPATH_W) 'image.c'; else $(CYGPATH_W) '$(srcdir)/image.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbkeysync-image.Tpo $(DEPDIR)/sbkeysync-image.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='image.c' object='sbkeysync-image.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbkeysync_CPPFLAGS) $(CPPFLAGS) $(sbkeysync_CFLAGS) $(CFLAGS) -c -o sbkeysync-image.obj `if test -f 'image.c'; then $(CYGPATH_W) 'image.c'; else $(CYGPATH_W) '$(srcdir)/image.c'; fi` sbkeysync-fileio.o: fileio.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbkeysync_CPPFLAGS) $(CPPFLAGS) $(sbkeysync_CFLAGS) $(CFLAGS) -MT sbkeysync-fileio.o -MD -MP -MF $(DEPDIR)/sbkeysync-fileio.Tpo -c -o sbkeysync-fileio.o `test -f 'fileio.c' || echo '$(srcdir)/'`fileio.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbkeysync-fileio.Tpo $(DEPDIR)/sbkeysync-fileio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fileio.c' object='sbkeysync-fileio.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbkeysync_CPPFLAGS) $(CPPFLAGS) $(sbkeysync_CFLAGS) $(CFLAGS) -c -o sbkeysync-fileio.o `test -f 'fileio.c' || echo '$(srcdir)/'`fileio.c sbkeysync-fileio.obj: fileio.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbkeysync_CPPFLAGS) $(CPPFLAGS) $(sbkeysync_CFLAGS) $(CFLAGS) -MT sbkeysync-fileio.obj -MD -MP -MF $(DEPDIR)/sbkeysync-fileio.Tpo -c -o sbkeysync-fileio.obj `if test -f 'fileio.c'; then $(CYGPATH_W) 'fileio.c'; else $(CYGPATH_W) '$(srcdir)/fileio.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbkeysync-fileio.Tpo $(DEPDIR)/sbkeysync-fileio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fileio.c' object='sbkeysync-fileio.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbkeysync_CPPFLAGS) $(CPPFLAGS) $(sbkeysync_CFLAGS) $(CFLAGS) -c -o sbkeysync-fileio.obj `if test -f 'fileio.c'; then $(CYGPATH_W) 'fileio.c'; else $(CYGPATH_W) '$(srcdir)/fileio.c'; fi` sbsiglist-sbsiglist.o: sbsiglist.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbsiglist_CPPFLAGS) $(CPPFLAGS) $(sbsiglist_CFLAGS) $(CFLAGS) -MT sbsiglist-sbsiglist.o -MD -MP -MF $(DEPDIR)/sbsiglist-sbsiglist.Tpo -c -o sbsiglist-sbsiglist.o `test -f 'sbsiglist.c' || echo '$(srcdir)/'`sbsiglist.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbsiglist-sbsiglist.Tpo $(DEPDIR)/sbsiglist-sbsiglist.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sbsiglist.c' object='sbsiglist-sbsiglist.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbsiglist_CPPFLAGS) $(CPPFLAGS) $(sbsiglist_CFLAGS) $(CFLAGS) -c -o sbsiglist-sbsiglist.o `test -f 'sbsiglist.c' || echo '$(srcdir)/'`sbsiglist.c sbsiglist-sbsiglist.obj: sbsiglist.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbsiglist_CPPFLAGS) $(CPPFLAGS) $(sbsiglist_CFLAGS) $(CFLAGS) -MT sbsiglist-sbsiglist.obj -MD -MP -MF $(DEPDIR)/sbsiglist-sbsiglist.Tpo -c -o sbsiglist-sbsiglist.obj `if test -f 'sbsiglist.c'; then $(CYGPATH_W) 'sbsiglist.c'; else $(CYGPATH_W) '$(srcdir)/sbsiglist.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbsiglist-sbsiglist.Tpo $(DEPDIR)/sbsiglist-sbsiglist.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sbsiglist.c' object='sbsiglist-sbsiglist.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbsiglist_CPPFLAGS) $(CPPFLAGS) $(sbsiglist_CFLAGS) $(CFLAGS) -c -o sbsiglist-sbsiglist.obj `if test -f 'sbsiglist.c'; then $(CYGPATH_W) 'sbsiglist.c'; else $(CYGPATH_W) '$(srcdir)/sbsiglist.c'; fi` sbsiglist-idc.o: idc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbsiglist_CPPFLAGS) $(CPPFLAGS) $(sbsiglist_CFLAGS) $(CFLAGS) -MT sbsiglist-idc.o -MD -MP -MF $(DEPDIR)/sbsiglist-idc.Tpo -c -o sbsiglist-idc.o `test -f 'idc.c' || echo '$(srcdir)/'`idc.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbsiglist-idc.Tpo $(DEPDIR)/sbsiglist-idc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='idc.c' object='sbsiglist-idc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbsiglist_CPPFLAGS) $(CPPFLAGS) $(sbsiglist_CFLAGS) $(CFLAGS) -c -o sbsiglist-idc.o `test -f 'idc.c' || echo '$(srcdir)/'`idc.c sbsiglist-idc.obj: idc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbsiglist_CPPFLAGS) $(CPPFLAGS) $(sbsiglist_CFLAGS) $(CFLAGS) -MT sbsiglist-idc.obj -MD -MP -MF $(DEPDIR)/sbsiglist-idc.Tpo -c -o sbsiglist-idc.obj `if test -f 'idc.c'; then $(CYGPATH_W) 'idc.c'; else $(CYGPATH_W) '$(srcdir)/idc.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbsiglist-idc.Tpo $(DEPDIR)/sbsiglist-idc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='idc.c' object='sbsiglist-idc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbsiglist_CPPFLAGS) $(CPPFLAGS) $(sbsiglist_CFLAGS) $(CFLAGS) -c -o sbsiglist-idc.obj `if test -f 'idc.c'; then $(CYGPATH_W) 'idc.c'; else $(CYGPATH_W) '$(srcdir)/idc.c'; fi` sbsiglist-image.o: image.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbsiglist_CPPFLAGS) $(CPPFLAGS) $(sbsiglist_CFLAGS) $(CFLAGS) -MT sbsiglist-image.o -MD -MP -MF $(DEPDIR)/sbsiglist-image.Tpo -c -o sbsiglist-image.o `test -f 'image.c' || echo '$(srcdir)/'`image.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbsiglist-image.Tpo $(DEPDIR)/sbsiglist-image.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='image.c' object='sbsiglist-image.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbsiglist_CPPFLAGS) $(CPPFLAGS) $(sbsiglist_CFLAGS) $(CFLAGS) -c -o sbsiglist-image.o `test -f 'image.c' || echo '$(srcdir)/'`image.c sbsiglist-image.obj: image.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbsiglist_CPPFLAGS) $(CPPFLAGS) $(sbsiglist_CFLAGS) $(CFLAGS) -MT sbsiglist-image.obj -MD -MP -MF $(DEPDIR)/sbsiglist-image.Tpo -c -o sbsiglist-image.obj `if test -f 'image.c'; then $(CYGPATH_W) 'image.c'; else $(CYGPATH_W) '$(srcdir)/image.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbsiglist-image.Tpo $(DEPDIR)/sbsiglist-image.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='image.c' object='sbsiglist-image.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbsiglist_CPPFLAGS) $(CPPFLAGS) $(sbsiglist_CFLAGS) $(CFLAGS) -c -o sbsiglist-image.obj `if test -f 'image.c'; then $(CYGPATH_W) 'image.c'; else $(CYGPATH_W) '$(srcdir)/image.c'; fi` sbsiglist-fileio.o: fileio.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbsiglist_CPPFLAGS) $(CPPFLAGS) $(sbsiglist_CFLAGS) $(CFLAGS) -MT sbsiglist-fileio.o -MD -MP -MF $(DEPDIR)/sbsiglist-fileio.Tpo -c -o sbsiglist-fileio.o `test -f 'fileio.c' || echo '$(srcdir)/'`fileio.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbsiglist-fileio.Tpo $(DEPDIR)/sbsiglist-fileio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fileio.c' object='sbsiglist-fileio.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbsiglist_CPPFLAGS) $(CPPFLAGS) $(sbsiglist_CFLAGS) $(CFLAGS) -c -o sbsiglist-fileio.o `test -f 'fileio.c' || echo '$(srcdir)/'`fileio.c sbsiglist-fileio.obj: fileio.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbsiglist_CPPFLAGS) $(CPPFLAGS) $(sbsiglist_CFLAGS) $(CFLAGS) -MT sbsiglist-fileio.obj -MD -MP -MF $(DEPDIR)/sbsiglist-fileio.Tpo -c -o sbsiglist-fileio.obj `if test -f 'fileio.c'; then $(CYGPATH_W) 'fileio.c'; else $(CYGPATH_W) '$(srcdir)/fileio.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbsiglist-fileio.Tpo $(DEPDIR)/sbsiglist-fileio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fileio.c' object='sbsiglist-fileio.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbsiglist_CPPFLAGS) $(CPPFLAGS) $(sbsiglist_CFLAGS) $(CFLAGS) -c -o sbsiglist-fileio.obj `if test -f 'fileio.c'; then $(CYGPATH_W) 'fileio.c'; else $(CYGPATH_W) '$(srcdir)/fileio.c'; fi` sbsign-sbsign.o: sbsign.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbsign_CFLAGS) $(CFLAGS) -MT sbsign-sbsign.o -MD -MP -MF $(DEPDIR)/sbsign-sbsign.Tpo -c -o sbsign-sbsign.o `test -f 'sbsign.c' || echo '$(srcdir)/'`sbsign.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbsign-sbsign.Tpo $(DEPDIR)/sbsign-sbsign.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sbsign.c' object='sbsign-sbsign.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbsign_CFLAGS) $(CFLAGS) -c -o sbsign-sbsign.o `test -f 'sbsign.c' || echo '$(srcdir)/'`sbsign.c sbsign-sbsign.obj: sbsign.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbsign_CFLAGS) $(CFLAGS) -MT sbsign-sbsign.obj -MD -MP -MF $(DEPDIR)/sbsign-sbsign.Tpo -c -o sbsign-sbsign.obj `if test -f 'sbsign.c'; then $(CYGPATH_W) 'sbsign.c'; else $(CYGPATH_W) '$(srcdir)/sbsign.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbsign-sbsign.Tpo $(DEPDIR)/sbsign-sbsign.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sbsign.c' object='sbsign-sbsign.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbsign_CFLAGS) $(CFLAGS) -c -o sbsign-sbsign.obj `if test -f 'sbsign.c'; then $(CYGPATH_W) 'sbsign.c'; else $(CYGPATH_W) '$(srcdir)/sbsign.c'; fi` sbsign-idc.o: idc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbsign_CFLAGS) $(CFLAGS) -MT sbsign-idc.o -MD -MP -MF $(DEPDIR)/sbsign-idc.Tpo -c -o sbsign-idc.o `test -f 'idc.c' || echo '$(srcdir)/'`idc.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbsign-idc.Tpo $(DEPDIR)/sbsign-idc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='idc.c' object='sbsign-idc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbsign_CFLAGS) $(CFLAGS) -c -o sbsign-idc.o `test -f 'idc.c' || echo '$(srcdir)/'`idc.c sbsign-idc.obj: idc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbsign_CFLAGS) $(CFLAGS) -MT sbsign-idc.obj -MD -MP -MF $(DEPDIR)/sbsign-idc.Tpo -c -o sbsign-idc.obj `if test -f 'idc.c'; then $(CYGPATH_W) 'idc.c'; else $(CYGPATH_W) '$(srcdir)/idc.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbsign-idc.Tpo $(DEPDIR)/sbsign-idc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='idc.c' object='sbsign-idc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbsign_CFLAGS) $(CFLAGS) -c -o sbsign-idc.obj `if test -f 'idc.c'; then $(CYGPATH_W) 'idc.c'; else $(CYGPATH_W) '$(srcdir)/idc.c'; fi` sbsign-image.o: image.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbsign_CFLAGS) $(CFLAGS) -MT sbsign-image.o -MD -MP -MF $(DEPDIR)/sbsign-image.Tpo -c -o sbsign-image.o `test -f 'image.c' || echo '$(srcdir)/'`image.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbsign-image.Tpo $(DEPDIR)/sbsign-image.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='image.c' object='sbsign-image.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbsign_CFLAGS) $(CFLAGS) -c -o sbsign-image.o `test -f 'image.c' || echo '$(srcdir)/'`image.c sbsign-image.obj: image.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbsign_CFLAGS) $(CFLAGS) -MT sbsign-image.obj -MD -MP -MF $(DEPDIR)/sbsign-image.Tpo -c -o sbsign-image.obj `if test -f 'image.c'; then $(CYGPATH_W) 'image.c'; else $(CYGPATH_W) '$(srcdir)/image.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbsign-image.Tpo $(DEPDIR)/sbsign-image.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='image.c' object='sbsign-image.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbsign_CFLAGS) $(CFLAGS) -c -o sbsign-image.obj `if test -f 'image.c'; then $(CYGPATH_W) 'image.c'; else $(CYGPATH_W) '$(srcdir)/image.c'; fi` sbsign-fileio.o: fileio.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbsign_CFLAGS) $(CFLAGS) -MT sbsign-fileio.o -MD -MP -MF $(DEPDIR)/sbsign-fileio.Tpo -c -o sbsign-fileio.o `test -f 'fileio.c' || echo '$(srcdir)/'`fileio.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbsign-fileio.Tpo $(DEPDIR)/sbsign-fileio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fileio.c' object='sbsign-fileio.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbsign_CFLAGS) $(CFLAGS) -c -o sbsign-fileio.o `test -f 'fileio.c' || echo '$(srcdir)/'`fileio.c sbsign-fileio.obj: fileio.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbsign_CFLAGS) $(CFLAGS) -MT sbsign-fileio.obj -MD -MP -MF $(DEPDIR)/sbsign-fileio.Tpo -c -o sbsign-fileio.obj `if test -f 'fileio.c'; then $(CYGPATH_W) 'fileio.c'; else $(CYGPATH_W) '$(srcdir)/fileio.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbsign-fileio.Tpo $(DEPDIR)/sbsign-fileio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fileio.c' object='sbsign-fileio.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbsign_CFLAGS) $(CFLAGS) -c -o sbsign-fileio.obj `if test -f 'fileio.c'; then $(CYGPATH_W) 'fileio.c'; else $(CYGPATH_W) '$(srcdir)/fileio.c'; fi` sbvarsign-sbvarsign.o: sbvarsign.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbvarsign_CPPFLAGS) $(CPPFLAGS) $(sbvarsign_CFLAGS) $(CFLAGS) -MT sbvarsign-sbvarsign.o -MD -MP -MF $(DEPDIR)/sbvarsign-sbvarsign.Tpo -c -o sbvarsign-sbvarsign.o `test -f 'sbvarsign.c' || echo '$(srcdir)/'`sbvarsign.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbvarsign-sbvarsign.Tpo $(DEPDIR)/sbvarsign-sbvarsign.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sbvarsign.c' object='sbvarsign-sbvarsign.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbvarsign_CPPFLAGS) $(CPPFLAGS) $(sbvarsign_CFLAGS) $(CFLAGS) -c -o sbvarsign-sbvarsign.o `test -f 'sbvarsign.c' || echo '$(srcdir)/'`sbvarsign.c sbvarsign-sbvarsign.obj: sbvarsign.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbvarsign_CPPFLAGS) $(CPPFLAGS) $(sbvarsign_CFLAGS) $(CFLAGS) -MT sbvarsign-sbvarsign.obj -MD -MP -MF $(DEPDIR)/sbvarsign-sbvarsign.Tpo -c -o sbvarsign-sbvarsign.obj `if test -f 'sbvarsign.c'; then $(CYGPATH_W) 'sbvarsign.c'; else $(CYGPATH_W) '$(srcdir)/sbvarsign.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbvarsign-sbvarsign.Tpo $(DEPDIR)/sbvarsign-sbvarsign.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sbvarsign.c' object='sbvarsign-sbvarsign.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbvarsign_CPPFLAGS) $(CPPFLAGS) $(sbvarsign_CFLAGS) $(CFLAGS) -c -o sbvarsign-sbvarsign.obj `if test -f 'sbvarsign.c'; then $(CYGPATH_W) 'sbvarsign.c'; else $(CYGPATH_W) '$(srcdir)/sbvarsign.c'; fi` sbvarsign-idc.o: idc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbvarsign_CPPFLAGS) $(CPPFLAGS) $(sbvarsign_CFLAGS) $(CFLAGS) -MT sbvarsign-idc.o -MD -MP -MF $(DEPDIR)/sbvarsign-idc.Tpo -c -o sbvarsign-idc.o `test -f 'idc.c' || echo '$(srcdir)/'`idc.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbvarsign-idc.Tpo $(DEPDIR)/sbvarsign-idc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='idc.c' object='sbvarsign-idc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbvarsign_CPPFLAGS) $(CPPFLAGS) $(sbvarsign_CFLAGS) $(CFLAGS) -c -o sbvarsign-idc.o `test -f 'idc.c' || echo '$(srcdir)/'`idc.c sbvarsign-idc.obj: idc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbvarsign_CPPFLAGS) $(CPPFLAGS) $(sbvarsign_CFLAGS) $(CFLAGS) -MT sbvarsign-idc.obj -MD -MP -MF $(DEPDIR)/sbvarsign-idc.Tpo -c -o sbvarsign-idc.obj `if test -f 'idc.c'; then $(CYGPATH_W) 'idc.c'; else $(CYGPATH_W) '$(srcdir)/idc.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbvarsign-idc.Tpo $(DEPDIR)/sbvarsign-idc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='idc.c' object='sbvarsign-idc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbvarsign_CPPFLAGS) $(CPPFLAGS) $(sbvarsign_CFLAGS) $(CFLAGS) -c -o sbvarsign-idc.obj `if test -f 'idc.c'; then $(CYGPATH_W) 'idc.c'; else $(CYGPATH_W) '$(srcdir)/idc.c'; fi` sbvarsign-image.o: image.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbvarsign_CPPFLAGS) $(CPPFLAGS) $(sbvarsign_CFLAGS) $(CFLAGS) -MT sbvarsign-image.o -MD -MP -MF $(DEPDIR)/sbvarsign-image.Tpo -c -o sbvarsign-image.o `test -f 'image.c' || echo '$(srcdir)/'`image.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbvarsign-image.Tpo $(DEPDIR)/sbvarsign-image.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='image.c' object='sbvarsign-image.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbvarsign_CPPFLAGS) $(CPPFLAGS) $(sbvarsign_CFLAGS) $(CFLAGS) -c -o sbvarsign-image.o `test -f 'image.c' || echo '$(srcdir)/'`image.c sbvarsign-image.obj: image.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbvarsign_CPPFLAGS) $(CPPFLAGS) $(sbvarsign_CFLAGS) $(CFLAGS) -MT sbvarsign-image.obj -MD -MP -MF $(DEPDIR)/sbvarsign-image.Tpo -c -o sbvarsign-image.obj `if test -f 'image.c'; then $(CYGPATH_W) 'image.c'; else $(CYGPATH_W) '$(srcdir)/image.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbvarsign-image.Tpo $(DEPDIR)/sbvarsign-image.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='image.c' object='sbvarsign-image.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbvarsign_CPPFLAGS) $(CPPFLAGS) $(sbvarsign_CFLAGS) $(CFLAGS) -c -o sbvarsign-image.obj `if test -f 'image.c'; then $(CYGPATH_W) 'image.c'; else $(CYGPATH_W) '$(srcdir)/image.c'; fi` sbvarsign-fileio.o: fileio.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbvarsign_CPPFLAGS) $(CPPFLAGS) $(sbvarsign_CFLAGS) $(CFLAGS) -MT sbvarsign-fileio.o -MD -MP -MF $(DEPDIR)/sbvarsign-fileio.Tpo -c -o sbvarsign-fileio.o `test -f 'fileio.c' || echo '$(srcdir)/'`fileio.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbvarsign-fileio.Tpo $(DEPDIR)/sbvarsign-fileio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fileio.c' object='sbvarsign-fileio.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbvarsign_CPPFLAGS) $(CPPFLAGS) $(sbvarsign_CFLAGS) $(CFLAGS) -c -o sbvarsign-fileio.o `test -f 'fileio.c' || echo '$(srcdir)/'`fileio.c sbvarsign-fileio.obj: fileio.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbvarsign_CPPFLAGS) $(CPPFLAGS) $(sbvarsign_CFLAGS) $(CFLAGS) -MT sbvarsign-fileio.obj -MD -MP -MF $(DEPDIR)/sbvarsign-fileio.Tpo -c -o sbvarsign-fileio.obj `if test -f 'fileio.c'; then $(CYGPATH_W) 'fileio.c'; else $(CYGPATH_W) '$(srcdir)/fileio.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbvarsign-fileio.Tpo $(DEPDIR)/sbvarsign-fileio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fileio.c' object='sbvarsign-fileio.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sbvarsign_CPPFLAGS) $(CPPFLAGS) $(sbvarsign_CFLAGS) $(CFLAGS) -c -o sbvarsign-fileio.obj `if test -f 'fileio.c'; then $(CYGPATH_W) 'fileio.c'; else $(CYGPATH_W) '$(srcdir)/fileio.c'; fi` sbverify-sbverify.o: sbverify.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbverify_CFLAGS) $(CFLAGS) -MT sbverify-sbverify.o -MD -MP -MF $(DEPDIR)/sbverify-sbverify.Tpo -c -o sbverify-sbverify.o `test -f 'sbverify.c' || echo '$(srcdir)/'`sbverify.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbverify-sbverify.Tpo $(DEPDIR)/sbverify-sbverify.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sbverify.c' object='sbverify-sbverify.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbverify_CFLAGS) $(CFLAGS) -c -o sbverify-sbverify.o `test -f 'sbverify.c' || echo '$(srcdir)/'`sbverify.c sbverify-sbverify.obj: sbverify.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbverify_CFLAGS) $(CFLAGS) -MT sbverify-sbverify.obj -MD -MP -MF $(DEPDIR)/sbverify-sbverify.Tpo -c -o sbverify-sbverify.obj `if test -f 'sbverify.c'; then $(CYGPATH_W) 'sbverify.c'; else $(CYGPATH_W) '$(srcdir)/sbverify.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbverify-sbverify.Tpo $(DEPDIR)/sbverify-sbverify.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sbverify.c' object='sbverify-sbverify.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbverify_CFLAGS) $(CFLAGS) -c -o sbverify-sbverify.obj `if test -f 'sbverify.c'; then $(CYGPATH_W) 'sbverify.c'; else $(CYGPATH_W) '$(srcdir)/sbverify.c'; fi` sbverify-idc.o: idc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbverify_CFLAGS) $(CFLAGS) -MT sbverify-idc.o -MD -MP -MF $(DEPDIR)/sbverify-idc.Tpo -c -o sbverify-idc.o `test -f 'idc.c' || echo '$(srcdir)/'`idc.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbverify-idc.Tpo $(DEPDIR)/sbverify-idc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='idc.c' object='sbverify-idc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbverify_CFLAGS) $(CFLAGS) -c -o sbverify-idc.o `test -f 'idc.c' || echo '$(srcdir)/'`idc.c sbverify-idc.obj: idc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbverify_CFLAGS) $(CFLAGS) -MT sbverify-idc.obj -MD -MP -MF $(DEPDIR)/sbverify-idc.Tpo -c -o sbverify-idc.obj `if test -f 'idc.c'; then $(CYGPATH_W) 'idc.c'; else $(CYGPATH_W) '$(srcdir)/idc.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbverify-idc.Tpo $(DEPDIR)/sbverify-idc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='idc.c' object='sbverify-idc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbverify_CFLAGS) $(CFLAGS) -c -o sbverify-idc.obj `if test -f 'idc.c'; then $(CYGPATH_W) 'idc.c'; else $(CYGPATH_W) '$(srcdir)/idc.c'; fi` sbverify-image.o: image.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbverify_CFLAGS) $(CFLAGS) -MT sbverify-image.o -MD -MP -MF $(DEPDIR)/sbverify-image.Tpo -c -o sbverify-image.o `test -f 'image.c' || echo '$(srcdir)/'`image.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbverify-image.Tpo $(DEPDIR)/sbverify-image.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='image.c' object='sbverify-image.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbverify_CFLAGS) $(CFLAGS) -c -o sbverify-image.o `test -f 'image.c' || echo '$(srcdir)/'`image.c sbverify-image.obj: image.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbverify_CFLAGS) $(CFLAGS) -MT sbverify-image.obj -MD -MP -MF $(DEPDIR)/sbverify-image.Tpo -c -o sbverify-image.obj `if test -f 'image.c'; then $(CYGPATH_W) 'image.c'; else $(CYGPATH_W) '$(srcdir)/image.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbverify-image.Tpo $(DEPDIR)/sbverify-image.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='image.c' object='sbverify-image.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbverify_CFLAGS) $(CFLAGS) -c -o sbverify-image.obj `if test -f 'image.c'; then $(CYGPATH_W) 'image.c'; else $(CYGPATH_W) '$(srcdir)/image.c'; fi` sbverify-fileio.o: fileio.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbverify_CFLAGS) $(CFLAGS) -MT sbverify-fileio.o -MD -MP -MF $(DEPDIR)/sbverify-fileio.Tpo -c -o sbverify-fileio.o `test -f 'fileio.c' || echo '$(srcdir)/'`fileio.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbverify-fileio.Tpo $(DEPDIR)/sbverify-fileio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fileio.c' object='sbverify-fileio.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbverify_CFLAGS) $(CFLAGS) -c -o sbverify-fileio.o `test -f 'fileio.c' || echo '$(srcdir)/'`fileio.c sbverify-fileio.obj: fileio.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbverify_CFLAGS) $(CFLAGS) -MT sbverify-fileio.obj -MD -MP -MF $(DEPDIR)/sbverify-fileio.Tpo -c -o sbverify-fileio.obj `if test -f 'fileio.c'; then $(CYGPATH_W) 'fileio.c'; else $(CYGPATH_W) '$(srcdir)/fileio.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/sbverify-fileio.Tpo $(DEPDIR)/sbverify-fileio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fileio.c' object='sbverify-fileio.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(sbverify_CFLAGS) $(CFLAGS) -c -o sbverify-fileio.obj `if test -f 'fileio.c'; then $(CYGPATH_W) 'fileio.c'; else $(CYGPATH_W) '$(srcdir)/fileio.c'; fi` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-binPROGRAMS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: sbsigntool-0.6/src/sbsiglist.c0000664000175000017500000001511112032331270013413 00000000000000/* * Copyright (C) 2012 Jeremy Kerr * * 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 3 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the OpenSSL * library under certain conditions as described in each individual source file, * and distribute linked combinations including the two. * * You must obey the GNU General Public License in all respects for all * of the code used other than OpenSSL. If you modify file(s) with this * exception, you may extend this exception to your version of the * file(s), but you are not obligated to do so. If you do not wish to do * so, delete this exception statement from your version. If you delete * this exception statement from all source files in the program, then * also delete it here. */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "efivars.h" #include "fileio.h" static const char *toolname = "sbsiglist"; static struct option options[] = { { "output", required_argument, NULL, 'o' }, { "type", required_argument, NULL, 't' }, { "owner", required_argument, NULL, 'w' }, { "verbose", no_argument, NULL, 'v' }, { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, { NULL, 0, NULL, 0 }, }; struct cert_type { const char *name; const EFI_GUID guid; unsigned int sigsize; }; struct cert_type cert_types[] = { { "x509", EFI_CERT_X509_GUID, 0 }, { "sha256", EFI_CERT_SHA256_GUID, 32 }, }; struct siglist_context { int verbose; const char *infilename; const char *outfilename; const struct cert_type *type; EFI_GUID owner; uint8_t *data; size_t data_len; EFI_SIGNATURE_LIST *siglist; }; void usage(void) { unsigned int i; printf("Usage: %s [options] --owner --type \n" "Create an EFI_SIGNATURE_LIST from a signature file\n" "Options:\n" "\t--owner Signature owner GUID\n" "\t--type Signature type. One of:\n", toolname); for (i = 0; i < ARRAY_SIZE(cert_types); i++) printf("\t %s\n", cert_types[i].name); printf("\t--output write signed data to \n" "\t (default .siglist)\n"); } static void version(void) { printf("%s %s\n", toolname, VERSION); } static int siglist_create(struct siglist_context *ctx) { EFI_SIGNATURE_LIST *siglist; EFI_SIGNATURE_DATA *sigdata; uint32_t size; if (ctx->type->sigsize && ctx->data_len != ctx->type->sigsize) { fprintf(stderr, "Error: signature lists of type '%s' expect " "%d bytes of data, " "%zd bytes provided.\n", ctx->type->name, ctx->type->sigsize, ctx->data_len); return -1; } size = sizeof(*siglist) + sizeof(*sigdata) + ctx->data_len; siglist = talloc_size(ctx, size); sigdata = (void *)(siglist + 1); siglist->SignatureType = ctx->type->guid; siglist->SignatureListSize = size; siglist->SignatureHeaderSize = 0; siglist->SignatureSize = ctx->data_len + sizeof(*sigdata); sigdata->SignatureOwner = ctx->owner; memcpy(sigdata->SignatureData, ctx->data, ctx->data_len); ctx->siglist = siglist; return 0; } static int parse_guid(const char *str, EFI_GUID *guid) { uuid_t uuid; if (uuid_parse(str, uuid)) return -1; /* convert to an EFI_GUID */ guid->Data1 = uuid[0] << 24 | uuid[1] << 16 | uuid[2] << 8 | uuid[3]; guid->Data2 = uuid[4] << 8 | uuid[5]; guid->Data3 = uuid[6] << 8 | uuid[7]; memcpy(guid->Data4, &uuid[8], sizeof(guid->Data4)); return 0; } static struct cert_type *parse_type(const char *str) { unsigned int i; for (i = 0; i < ARRAY_SIZE(cert_types); i++) if (!strcasecmp(cert_types[i].name, str)) return &cert_types[i]; return NULL; } static void set_default_outfilename(struct siglist_context *ctx) { const char *extension = "siglist"; ctx->outfilename = talloc_asprintf(ctx, "%s.%s", ctx->infilename, extension); } int main(int argc, char **argv) { const char *type_str, *owner_guid_str; struct siglist_context *ctx; int c; ctx = talloc_zero(NULL, struct siglist_context); owner_guid_str = NULL; type_str = NULL; for (;;) { int idx; c = getopt_long(argc, argv, "o:t:w:ivVh", options, &idx); if (c == -1) break; switch (c) { case 'o': ctx->outfilename = optarg; break; case 't': type_str = optarg; break; case 'w': owner_guid_str = optarg; break; case 'v': ctx->verbose = 1; break; case 'V': version(); return EXIT_SUCCESS; case 'h': usage(); return EXIT_SUCCESS; } } if (argc != optind + 1) { usage(); return EXIT_FAILURE; } ctx->infilename = argv[optind]; if (!type_str) { fprintf(stderr, "No type specified\n"); usage(); return EXIT_FAILURE; } if (!type_str) { fprintf(stderr, "No owner specified\n"); usage(); return EXIT_FAILURE; } ctx->type = parse_type(type_str); if (!ctx->type) { fprintf(stderr, "Invalid type '%s'\n", type_str); return EXIT_FAILURE; } if (parse_guid(owner_guid_str, &ctx->owner)) { fprintf(stderr, "Invalid owner GUID '%s'\n", owner_guid_str); return EXIT_FAILURE; } if (!ctx->outfilename) set_default_outfilename(ctx); if (fileio_read_file(ctx, ctx->infilename, &ctx->data, &ctx->data_len)) { fprintf(stderr, "Can't read input file %s\n", ctx->infilename); return EXIT_FAILURE; } if (siglist_create(ctx)) return EXIT_FAILURE; if (fileio_write_file(ctx->outfilename, (void *)ctx->siglist, ctx->siglist->SignatureListSize)) { fprintf(stderr, "Can't write output file %s\n", ctx->outfilename); return EXIT_FAILURE; } return EXIT_SUCCESS; } sbsigntool-0.6/src/fileio.c0000664000175000017500000000742212032331270012665 00000000000000/* * Copyright (C) 2012 Jeremy Kerr * * 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 3 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the OpenSSL * library under certain conditions as described in each individual source file, * and distribute linked combinations including the two. * * You must obey the GNU General Public License in all respects for all * of the code used other than OpenSSL. If you modify file(s) with this * exception, you may extend this exception to your version of the * file(s), but you are not obligated to do so. If you do not wish to do * so, delete this exception statement from your version. If you delete * this exception statement from all source files in the program, then * also delete it here. */ #include #include #include #include #include #include #include #include #include #include #include "fileio.h" #define FLAG_NOERROR (1<<0) EVP_PKEY *fileio_read_pkey(const char *filename) { EVP_PKEY *key = NULL; BIO *bio; bio = BIO_new_file(filename, "r"); if (!bio) goto out; key = PEM_read_bio_PrivateKey(bio, NULL, NULL, NULL); out: BIO_free_all(bio); if (!key) { fprintf(stderr, "Can't load key from file '%s'\n", filename); ERR_print_errors_fp(stderr); } return key; } X509 *fileio_read_cert(const char *filename) { X509 *cert = NULL; BIO *bio; bio = BIO_new_file(filename, "r"); if (!bio) goto out; cert = PEM_read_bio_X509(bio, NULL, NULL, NULL); out: BIO_free_all(bio); if (!cert) { fprintf(stderr, "Can't load certificate from file '%s'\n", filename); ERR_print_errors_fp(stderr); } return cert; } static int __fileio_read_file(void *ctx, const char *filename, uint8_t **out_buf, size_t *out_len, int flags) { struct stat statbuf; uint8_t *buf; size_t len; int fd, rc; rc = -1; fd = open(filename, O_RDONLY); if (fd < 0) goto out; rc = fstat(fd, &statbuf); if (rc) goto out; len = statbuf.st_size; buf = talloc_array(ctx, uint8_t, len); if (!buf) goto out; if (!read_all(fd, buf, len)) goto out; rc = 0; out: if (fd >= 0) close(fd); if (rc) { if (!(flags & FLAG_NOERROR)) fprintf(stderr, "Error reading file %s: %s\n", filename, strerror(errno)); } else { *out_buf = buf; *out_len = len; } return rc; } int fileio_read_file(void *ctx, const char *filename, uint8_t **out_buf, size_t *out_len) { return __fileio_read_file(ctx, filename, out_buf, out_len, 0); } int fileio_read_file_noerror(void *ctx, const char *filename, uint8_t **out_buf, size_t *out_len) { return __fileio_read_file(ctx, filename, out_buf, out_len, FLAG_NOERROR); } int fileio_write_file(const char *filename, uint8_t *buf, size_t len) { int fd; fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd < 0) { perror("open"); return -1; } if (!write_all(fd, buf, len)) { perror("write_all"); close(fd); return -1; } close(fd); return 0; } sbsigntool-0.6/src/idc.c0000664000175000017500000002021712032331270012152 00000000000000/* * Copyright (C) 2012 Jeremy Kerr * * 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 3 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the OpenSSL * library under certain conditions as described in each individual source file, * and distribute linked combinations including the two. * * You must obey the GNU General Public License in all respects for all * of the code used other than OpenSSL. If you modify file(s) with this * exception, you may extend this exception to your version of the * file(s), but you are not obligated to do so. If you do not wish to do * so, delete this exception statement from your version. If you delete * this exception statement from all source files in the program, then * also delete it here. */ #include #include #include #include #include #include #include #include #include "idc.h" typedef struct idc_type_value { ASN1_OBJECT *type; ASN1_TYPE *value; } IDC_TYPE_VALUE; ASN1_SEQUENCE(IDC_TYPE_VALUE) = { ASN1_SIMPLE(IDC_TYPE_VALUE, type, ASN1_OBJECT), ASN1_OPT(IDC_TYPE_VALUE, value, ASN1_ANY), } ASN1_SEQUENCE_END(IDC_TYPE_VALUE); IMPLEMENT_ASN1_FUNCTIONS(IDC_TYPE_VALUE); typedef struct idc_string { int type; union { ASN1_BMPSTRING *unicode; ASN1_IA5STRING *ascii; } value; } IDC_STRING; ASN1_CHOICE(IDC_STRING) = { ASN1_IMP(IDC_STRING, value.unicode, ASN1_BMPSTRING, 0), ASN1_IMP(IDC_STRING, value.ascii, ASN1_IA5STRING, 1), } ASN1_CHOICE_END(IDC_STRING); IMPLEMENT_ASN1_FUNCTIONS(IDC_STRING); typedef struct idc_link { int type; union { ASN1_NULL *url; ASN1_NULL *moniker; IDC_STRING *file; } value; } IDC_LINK; ASN1_CHOICE(IDC_LINK) = { ASN1_IMP(IDC_LINK, value.url, ASN1_NULL, 0), ASN1_IMP(IDC_LINK, value.moniker, ASN1_NULL, 1), ASN1_EXP(IDC_LINK, value.file, IDC_STRING, 2), } ASN1_CHOICE_END(IDC_LINK); IMPLEMENT_ASN1_FUNCTIONS(IDC_LINK); typedef struct idc_pe_image_data { ASN1_BIT_STRING *flags; IDC_LINK *file; } IDC_PEID; ASN1_SEQUENCE(IDC_PEID) = { ASN1_SIMPLE(IDC_PEID, flags, ASN1_BIT_STRING), ASN1_EXP(IDC_PEID, file, IDC_LINK, 0), } ASN1_SEQUENCE_END(IDC_PEID); IMPLEMENT_ASN1_FUNCTIONS(IDC_PEID); typedef struct idc_digest { X509_ALGOR *alg; ASN1_OCTET_STRING *digest; } IDC_DIGEST; ASN1_SEQUENCE(IDC_DIGEST) = { ASN1_SIMPLE(IDC_DIGEST, alg, X509_ALGOR), ASN1_SIMPLE(IDC_DIGEST, digest, ASN1_OCTET_STRING), } ASN1_SEQUENCE_END(IDC_DIGEST) IMPLEMENT_ASN1_FUNCTIONS(IDC_DIGEST) typedef struct idc { IDC_TYPE_VALUE *data; IDC_DIGEST *digest; } IDC; ASN1_SEQUENCE(IDC) = { ASN1_SIMPLE(IDC, data, IDC_TYPE_VALUE), ASN1_SIMPLE(IDC, digest, IDC_DIGEST), } ASN1_SEQUENCE_END(IDC) IMPLEMENT_ASN1_FUNCTIONS(IDC) static int type_set_sequence(void *ctx, ASN1_TYPE *type, void *s, const ASN1_ITEM *it) { uint8_t *seq_data, *tmp; ASN1_OCTET_STRING *os; ASN1_STRING *seq = s; int len; os = ASN1_STRING_new(); len = ASN1_item_i2d((ASN1_VALUE *)seq, NULL, it); tmp = seq_data = talloc_array(ctx, uint8_t, len); ASN1_item_i2d((ASN1_VALUE *)seq, &tmp, it); ASN1_STRING_set(os, seq_data, len); ASN1_TYPE_set(type, V_ASN1_SEQUENCE, os); return 0; } const char obsolete[] = { 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x4f, 0x00, 0x62, 0x00, 0x73, 0x00, 0x6f, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x74, 0x00, 0x65, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e }; const char *sha256_str(const uint8_t *hash) { static char s[SHA256_DIGEST_LENGTH * 2 + 1]; int i; for (i = 0; i < SHA256_DIGEST_LENGTH; i++) snprintf(s + i * 2, 3, "%02x", hash[i]); return s; } int IDC_set(PKCS7 *p7, PKCS7_SIGNER_INFO *si, struct image *image) { uint8_t *buf, *tmp, sha[SHA256_DIGEST_LENGTH]; int idc_nid, peid_nid, len, rc; IDC_PEID *peid; ASN1_STRING *s; ASN1_TYPE *t; BIO *sigbio; IDC *idc; idc_nid = OBJ_create("1.3.6.1.4.1.311.2.1.4", "spcIndirectDataContext", "Indirect Data Context"); peid_nid = OBJ_create("1.3.6.1.4.1.311.2.1.15", "spcPEImageData", "PE Image Data"); image_hash_sha256(image, sha); idc = IDC_new(); peid = IDC_PEID_new(); peid->file = IDC_LINK_new(); peid->file->type = 2; peid->file->value.file = IDC_STRING_new(); peid->file->value.file->type = 0; peid->file->value.file->value.unicode = ASN1_STRING_new(); ASN1_STRING_set(peid->file->value.file->value.unicode, obsolete, sizeof(obsolete)); idc->data->type = OBJ_nid2obj(peid_nid); idc->data->value = ASN1_TYPE_new(); type_set_sequence(image, idc->data->value, peid, &IDC_PEID_it); idc->digest->alg->parameter = ASN1_TYPE_new(); idc->digest->alg->algorithm = OBJ_nid2obj(NID_sha256); idc->digest->alg->parameter->type = V_ASN1_NULL; ASN1_OCTET_STRING_set(idc->digest->digest, sha, sizeof(sha)); len = i2d_IDC(idc, NULL); tmp = buf = talloc_array(image, uint8_t, len); i2d_IDC(idc, &tmp); /* Add the contentType authenticated attribute */ PKCS7_add_signed_attribute(si, NID_pkcs9_contentType, V_ASN1_OBJECT, OBJ_nid2obj(idc_nid)); /* Because the PKCS7 lib has a hard time dealing with non-standard * data types, we create a temporary BIO to hold the signed data, so * that the top-level PKCS7 object calculates the correct hash... */ sigbio = PKCS7_dataInit(p7, NULL); BIO_write(sigbio, buf+2, len-2); /* ... then we finalise the p7 content, which does the actual * signing ... */ rc = PKCS7_dataFinal(p7, sigbio); if (!rc) { fprintf(stderr, "dataFinal failed\n"); ERR_print_errors_fp(stderr); return -1; } /* ... and we replace the content with the actual IDC ASN type. */ t = ASN1_TYPE_new(); s = ASN1_STRING_new(); ASN1_STRING_set(s, buf, len); ASN1_TYPE_set(t, V_ASN1_SEQUENCE, s); PKCS7_set0_type_other(p7->d.sign->contents, idc_nid, t); return 0; } struct idc *IDC_get(PKCS7 *p7, BIO *bio) { const unsigned char *buf, *idcbuf; ASN1_STRING *str; IDC *idc; /* extract the idc from the signed PKCS7 'other' data */ str = p7->d.sign->contents->d.other->value.asn1_string; idcbuf = buf = ASN1_STRING_data(str); idc = d2i_IDC(NULL, &buf, ASN1_STRING_length(str)); /* If we were passed a BIO, write the idc data, minus type and length, * to the BIO. This can be used to PKCS7_verify the idc */ if (bio) { uint32_t idclen; uint8_t tmp; tmp = idcbuf[1]; if (!(tmp & 0x80)) { idclen = tmp & 0x7f; idcbuf += 2; } else if ((tmp & 0x82) == 0x82) { idclen = (idcbuf[2] << 8) + idcbuf[3]; idcbuf += 4; } else { fprintf(stderr, "Invalid ASN.1 data in " "IndirectDataContext?\n"); return NULL; } BIO_write(bio, idcbuf, idclen); } return idc; } int IDC_check_hash(struct idc *idc, struct image *image) { unsigned char sha[SHA256_DIGEST_LENGTH]; const unsigned char *buf; ASN1_STRING *str; image_hash_sha256(image, sha); /* check hash algorithm sanity */ if (OBJ_cmp(idc->digest->alg->algorithm, OBJ_nid2obj(NID_sha256))) { fprintf(stderr, "Invalid algorithm type\n"); return -1; } str = idc->digest->digest; if (ASN1_STRING_length(str) != sizeof(sha)) { fprintf(stderr, "Invalid algorithm length\n"); return -1; } /* check hash against the one we calculated from the image */ buf = ASN1_STRING_data(str); if (memcmp(buf, sha, sizeof(sha))) { fprintf(stderr, "Hash doesn't match image\n"); fprintf(stderr, " got: %s\n", sha256_str(buf)); fprintf(stderr, " expecting: %s\n", sha256_str(sha)); return -1; } return 0; } sbsigntool-0.6/src/image.h0000664000175000017500000000655212032331270012510 00000000000000/* * Copyright (C) 2012 Jeremy Kerr * * 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 3 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the OpenSSL * library under certain conditions as described in each individual source file, * and distribute linked combinations including the two. * * You must obey the GNU General Public License in all respects for all * of the code used other than OpenSSL. If you modify file(s) with this * exception, you may extend this exception to your version of the * file(s), but you are not obligated to do so. If you do not wish to do * so, delete this exception statement from your version. If you delete * this exception statement from all source files in the program, then * also delete it here. */ #ifndef IMAGE_H #define IMAGE_H #include #include #define DO_NOT_DEFINE_LINENO #include "coff/external.h" #include "coff/pe.h" struct region { void *data; int size; char *name; }; struct image { uint8_t *buf; size_t size; /* size of the image, without signature */ size_t data_size; /* Pointers to interesting parts of the image */ uint32_t *checksum; struct external_PEI_DOS_hdr *doshdr; struct external_PEI_IMAGE_hdr *pehdr; union { PEPAOUTHDR *opt_64; PEAOUTHDR *opt_32; void *addr; } opthdr; /* size of a minimal opthdr for this machine, without data * directories */ unsigned int opthdr_min_size; /* size of the opthdr as specified by the image */ unsigned int opthdr_size; struct data_dir_entry *data_dir; struct data_dir_entry *data_dir_sigtable; struct external_scnhdr *scnhdr; int sections; void *cert_table; int cert_table_size; /* We cache a few values from the aout header, so we don't have to * keep checking whether to use the 32- or 64-bit version */ uint32_t file_alignment; uint32_t header_size; /* Regions that are included in the image hash: populated * during image parsing, then used during the hash process. */ struct region *checksum_regions; int n_checksum_regions; /* Generated signature */ void *sigbuf; size_t sigsize; }; struct data_dir_entry { uint32_t addr; uint32_t size; } __attribute__((packed)); struct cert_table_header { uint32_t size; uint16_t revision; uint16_t type; } __attribute__((packed)); struct image *image_load(const char *filename); int image_hash_sha256(struct image *image, uint8_t digest[]); int image_add_signature(struct image *, void *sig, int size); void image_remove_signature(struct image *image); int image_write(struct image *image, const char *filename); int image_write_detached(struct image *image, const char *filename); #endif /* IMAGE_H */ sbsigntool-0.6/src/sbsign.c0000664000175000017500000001324612032331270012704 00000000000000/* * Copyright (C) 2012 Jeremy Kerr * * 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 3 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the OpenSSL * library under certain conditions as described in each individual source file, * and distribute linked combinations including the two. * * You must obey the GNU General Public License in all respects for all * of the code used other than OpenSSL. If you modify file(s) with this * exception, you may extend this exception to your version of the * file(s), but you are not obligated to do so. If you do not wish to do * so, delete this exception statement from your version. If you delete * this exception statement from all source files in the program, then * also delete it here. */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "idc.h" #include "image.h" #include "fileio.h" static const char *toolname = "sbsign"; struct sign_context { struct image *image; const char *infilename; const char *outfilename; int verbose; int detached; }; static struct option options[] = { { "output", required_argument, NULL, 'o' }, { "cert", required_argument, NULL, 'c' }, { "key", required_argument, NULL, 'k' }, { "detached", no_argument, NULL, 'd' }, { "verbose", no_argument, NULL, 'v' }, { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, { NULL, 0, NULL, 0 }, }; static void usage(void) { printf("Usage: %s [options] --key --cert " "\n" "Sign an EFI boot image for use with secure boot.\n\n" "Options:\n" "\t--key signing key (PEM-encoded RSA " "private key)\n" "\t--cert certificate (x509 certificate)\n" "\t--detached write a detached signature, instead of\n" "\t a signed binary\n" "\t--output write signed data to \n" "\t (default .signed,\n" "\t or .pk7 for detached\n" "\t signatures)\n", toolname); } static void version(void) { printf("%s %s\n", toolname, VERSION); } static void set_default_outfilename(struct sign_context *ctx) { const char *extension; extension = ctx->detached ? "pk7" : "signed"; ctx->outfilename = talloc_asprintf(ctx, "%s.%s", ctx->infilename, extension); } int main(int argc, char **argv) { const char *keyfilename, *certfilename; struct sign_context *ctx; uint8_t *buf, *tmp; int rc, c, sigsize; ctx = talloc_zero(NULL, struct sign_context); keyfilename = NULL; certfilename = NULL; for (;;) { int idx; c = getopt_long(argc, argv, "o:c:k:dvVh", options, &idx); if (c == -1) break; switch (c) { case 'o': ctx->outfilename = talloc_strdup(ctx, optarg); break; case 'c': certfilename = optarg; break; case 'k': keyfilename = optarg; break; case 'd': ctx->detached = 1; break; case 'v': ctx->verbose = 1; break; case 'V': version(); return EXIT_SUCCESS; case 'h': usage(); return EXIT_SUCCESS; } } if (argc != optind + 1) { usage(); return EXIT_FAILURE; } ctx->infilename = argv[optind]; if (!ctx->outfilename) set_default_outfilename(ctx); if (!certfilename) { fprintf(stderr, "error: No certificate specified (with --cert)\n"); usage(); return EXIT_FAILURE; } if (!keyfilename) { fprintf(stderr, "error: No key specified (with --key)\n"); usage(); return EXIT_FAILURE; } ctx->image = image_load(ctx->infilename); if (!ctx->image) return EXIT_FAILURE; talloc_steal(ctx, ctx->image); ERR_load_crypto_strings(); OpenSSL_add_all_digests(); OpenSSL_add_all_ciphers(); EVP_PKEY *pkey = fileio_read_pkey(keyfilename); if (!pkey) return EXIT_FAILURE; X509 *cert = fileio_read_cert(certfilename); if (!cert) return EXIT_FAILURE; const EVP_MD *md = EVP_get_digestbyname("SHA256"); /* set up the PKCS7 object */ PKCS7 *p7 = PKCS7_new(); PKCS7_set_type(p7, NID_pkcs7_signed); PKCS7_SIGNER_INFO *si = PKCS7_sign_add_signer(p7, cert, pkey, md, PKCS7_BINARY); if (!si) { fprintf(stderr, "error in key/certificate chain\n"); ERR_print_errors_fp(stderr); return EXIT_FAILURE; } PKCS7_content_new(p7, NID_pkcs7_data); rc = IDC_set(p7, si, ctx->image); if (rc) return EXIT_FAILURE; sigsize = i2d_PKCS7(p7, NULL); tmp = buf = talloc_array(ctx->image, uint8_t, sigsize); i2d_PKCS7(p7, &tmp); ERR_print_errors_fp(stdout); image_add_signature(ctx->image, buf, sigsize); if (ctx->detached) image_write_detached(ctx->image, ctx->outfilename); else image_write(ctx->image, ctx->outfilename); talloc_free(ctx); return EXIT_SUCCESS; } sbsigntool-0.6/Makefile.am0000664000175000017500000000004312032331270012507 00000000000000 SUBDIRS = lib/ccan src docs tests sbsigntool-0.6/ChangeLog0000664000175000017500000003160512032346016012241 000000000000002012-09-28 01d2aa4 Jeremy Kerr * image: improve section table parsing 2012-09-28 22fa5ba Jeremy Kerr * image: Allow variable sized data directories 2012-09-05 027bde0 Jeremy Kerr * sbvarsign: fix incorrect pointer in add_auth_descriptor 2012-09-05 8a9366d Jeremy Kerr * sbvarsign: auth descriptor hash does not cover the \0 in the varname 2012-08-24 6a56400 Jeremy Kerr * sbkeysync: fix siglist iteration 2012-08-24 6e4e566 Jeremy Kerr * sbvarsign: Improve default GUID choice 2012-08-24 1b6eaee Jeremy Kerr * skkeysync: Add PK-handing code 2012-08-24 c80b5a2 Jeremy Kerr * sbkeysync: Refactor signature database data structures 2012-08-23 81bb4e3 Jeremy Kerr * sbkeysync: fix invalid free in keystore_read_entry 2012-08-23 a870a28 Jeremy Kerr * sbkeysync: Improve error handling in read_firmware_key_database 2012-08-23 b53ad57 Jeremy Kerr * sbkeysync: insert new keys 2012-08-23 fbedc4b Jeremy Kerr * sbkeysync: print keystore before key databases 2012-08-23 603e4f9 Jeremy Kerr * sbkeysync: Find keys missing from firmware key databases 2012-08-23 7e7fae0 Jeremy Kerr * sbkeysync: Rename struct keystore_entry->list to keystore_list 2012-08-22 2a87e12 Jeremy Kerr * sbkeysync: Generate and print key descriptions 2012-08-22 a5f7a63 Jeremy Kerr * sbkeysync: add comment to sigdb_iterate 2012-08-22 8c3bd4f Jeremy Kerr * sbkeysync: Change key_id to key_parse 2012-08-22 ac5d82d Jeremy Kerr * sbkeysync: Print filesystem key databases 2012-08-21 0c6ca3f Jeremy Kerr * sbkeysync: read keystore into kdb->filesystem_keys 2012-08-21 6576207 Jeremy Kerr * sbkeysync: Unify key_database 2012-08-21 d48d2a5 Jeremy Kerr * sbkeysync: Add key_database->filesystem_keys 2012-08-21 4c7eff0 Jeremy Kerr * sbkeysync: keystore -> fs_keystore 2012-08-21 ed3059d Jeremy Kerr * sbkeysync: pass data buffer (instead of EFI_SIGNATURE_DATA) to key_id 2012-08-21 3f10faa Jeremy Kerr * sbkeysync: add keystore_entry->root 2012-08-21 2d58004 Jeremy Kerr * sbkeysync: Add --keystore and --no-default-keystores options 2012-08-21 3729176 Jeremy Kerr * sbkeysync: Add --verbose option and conditionally print debug output 2012-08-20 651d158 Jeremy Kerr * sbkeysync: Add keystore parsing functions 2012-08-20 c0f22ed Jeremy Kerr * sbkeysync: Add --efivars-dir option to specific different locations for var files 2012-08-20 2625af1 Jeremy Kerr * sbkeysync: Add X509 key parsing 2012-08-20 7c4b36d Jeremy Kerr * sbkeysync: Add key ID data to print_key_database() 2012-08-20 d45de48 Jeremy Kerr * sbkeysync: read & print signature databases 2012-08-20 63b21b9 Jeremy Kerr * Move EFI_CERT types to efivars.h 2012-08-24 7fca8bd Jeremy Kerr * fileio: Add fileio_read_file_noerror() 2012-08-23 0ba703a Jeremy Kerr * sbvarsign: Start with a default set of variable attributes 2012-08-23 922bcc9 Jeremy Kerr * efivars: Move EFI_VARIABLE_* attributes to efivars.h 2012-08-22 fa42e39 Jeremy Kerr * sbsiglist: fix signature size check 2012-08-22 ef7f262 Jeremy Kerr * sbvarsign: WIN_CERTIFICATE.dwLength should include the header size 2012-08-22 887f5a1 Jeremy Kerr * sbvarsign: Fix invalid sizeof() for zeroing timestamp data 2012-08-21 378ecab Jeremy Kerr * sbsiglist: check for owner and type arguments 2012-08-14 2e7d96b Jeremy Kerr * sbsiglist: Fix SignatureSize 2012-08-13 98dc757 Jeremy Kerr * image: use fileio_write_file 2012-08-13 3e2bd9b Jeremy Kerr * Remove unused gen-keyfiles source 2012-08-13 ac3f03f Jeremy Kerr * docs: Create man pages for sbvarsign & sbsiglist 2012-08-13 101b703 Jeremy Kerr * Move sources to src/ subdirectory 2012-08-13 9464dcf Jeremy Kerr * image: Use size of image data when writing images 2012-08-13 b164b13 Jeremy Kerr * image: always parse image regions 2012-08-13 c9481ba Jeremy Kerr * Include efivars.h in automake infrastructure 2012-08-13 2a38dec Jeremy Kerr * tests: run tests for each arch 2012-08-10 dfc59be Jeremy Kerr * image: Allow manipulation of i386 PE/COFF files 2012-08-10 96d5769 Jeremy Kerr * Remove arch-specific coff headers 2012-08-04 58d2ad4 Maxim Kammerer * image: Prevent an uninitialized variable warning 2012-08-10 1a6fe60 Jeremy Kerr * sbsiglist: Add utility for creating EFI_SIGNATURE_LISTs 2012-08-10 7b95aee Jeremy Kerr * fileio: Add fileio_write_file 2012-08-10 5b15c0a Jeremy Kerr * efivars: rename efi variable header 2012-08-03 f574194 Jeremy Kerr * fileio: Unify whole-file reads 2012-08-03 d05cd38 Jeremy Kerr * fileio: Unify key & cert loading 2012-08-03 ab77d55 Jeremy Kerr * image: add functions to add and remove signatures 2012-08-02 d73dd55 Jeremy Kerr * sbattach: fix --detach 2012-08-02 7aad206 Jeremy Kerr * sbattach: fix missing openssl/evp.h header 2012-07-31 bc755fa Jeremy Kerr * sbvarsign: First cut of a variable-signing tool 2012-06-28 b537e74 Jeremy Kerr * Version 0.3 2012-06-28 34f45aa Jeremy Kerr * license: Add OpenSSL exception to GPLv3 terms 2012-06-28 90ac52e Jeremy Kerr * COPYING: remove non-license text 2012-06-27 3a17b39 James Bottomley * image: fix signature calculation when there's junk at the end of the efi binary 2012-06-28 99f2a9a Jeremy Kerr * tests: Add test for PE/COFF cert table header validity 2012-06-25 8d417f2 James Bottomley * image: fix incorrect assumption about signature header 2012-06-28 585915b Jeremy Kerr * sbsign: handle errors from PKCS7_sign_add_signer() 2012-06-26 183ce60 James Bottomley * sbsign: fix failure to sign when key is password protected 2012-06-20 c07dfb9 Ivan Hu * configure: Add check for bfh.h 2012-06-19 5e07c4e Ivan Hu * tests: Add a test to check invalid PKCS7 signature attaching 2012-06-19 bfb778e Ivan Hu * sbattach: Check that attached signatures are valid PKCS7 data 2012-06-14 bf6df84 Jeremy Kerr * sbverify: Use a variable for image filename 2012-06-13 9b7f7fb Jeremy Kerr * image: Unconditionally parse PE/COFF data 2012-06-13 128f1c1 Jeremy Kerr * sbverify: Check for failed image load 2012-06-13 b48e256 Jeremy Kerr * tests: Add tests for missing image, cert & key files 2012-06-13 0af5e01 Jeremy Kerr * tests: Execute tests in a clean (temporary) directory 2012-06-13 8716e88 Jeremy Kerr * tests: Use COMPILE.S for assembing test object 2012-06-13 807f0e6 Jeremy Kerr * Version 0.2 2012-06-13 7c2d8bb Jeremy Kerr * docs: Add simple manpage for sbattach 2012-06-13 deb9211 Jeremy Kerr * automake: Clean generated man files 2012-06-13 3cde1e4 Jeremy Kerr * tests: Add a few simple tests 2012-06-13 cc881c2 Jeremy Kerr * Remove unused test.c file 2012-06-12 4c79e3a Jeremy Kerr * sbattach: Add too to manage detached signatures 2012-06-12 564f5bc Jeremy Kerr * image: Add facility to write unsigned images 2012-06-11 a07b8d2 Jeremy Kerr * sbsign,sbverify: Update getopt_long optstrings 2012-06-11 5836038 Jeremy Kerr * sbverify: Add support for detached signatures 2012-06-11 b8a7d51 Jeremy Kerr * sbverify: Split image signature table reading to separate function 2012-06-11 e9f438c Jeremy Kerr * Fix warnings from added -W flags 2012-06-11 f19e8bb Jeremy Kerr * automake: Add -Wall -Wextra CFLAGS 2012-06-11 af4f088 Jeremy Kerr * sbsign: Add --detached option to create detached PKCS7 signatures 2012-06-11 0c9fbd2 Jeremy Kerr * sbsign: fix flag for verbose operation 2012-06-11 3673db1 Jeremy Kerr * docs: Fix manpage creation 2012-05-29 9b2f3a7 Adam Conrad * autogen.sh: Fix ccan_module assignment 2012-05-28 3fb0f00 Jeremy Kerr * image: use read_write_all from ccan 2012-05-28 f1112b4 Jeremy Kerr * image: Fix format specifier for 32-bit builds 2012-05-24 d5e634c Jeremy Kerr * autoconfiscate 2012-05-23 82f8c30 Jeremy Kerr * docs: Add initial manpages 2012-05-23 c14efcb Jeremy Kerr * sbsign,sbverify: help2man-ize usage output 2012-05-23 98a4f10 Jeremy Kerr * Makefile: Add dist targets 2012-05-22 1b2b5c6 Jeremy Kerr * ccan: Add ccan import logic 2012-05-15 6ff68e5 Jeremy Kerr * Move ccan submodule 2012-05-15 9a08e25 Jeremy Kerr * Remove unused header 2012-05-14 bc618c5 Jeremy Kerr * Remove pkcs7-simple test file 2012-05-14 9ac930e Jeremy Kerr * Makefile: add install target 2012-05-14 a1b270f Jeremy Kerr * Makefile: Comment components 2012-05-14 c67b82a Jeremy Kerr * sbverify: clean up openssl init 2012-05-14 c499763 Jeremy Kerr * sbverify: add check for invalid PKCS7 data 2012-05-14 74eb766 Jeremy Kerr * sbverify: Add certificate chain verification 2012-05-12 e111127 Jeremy Kerr * verify: move idc-related parsing to idc.c 2012-05-12 46cf6a6 Jeremy Kerr * sbsign: fix incorrect check for certificate load 2012-05-12 57d9f0c Jeremy Kerr * image: reformat gap warnings 2012-05-12 ab05bec Jeremy Kerr * image: add cert table to image size 2012-05-12 e1fec08 Jeremy Kerr * sbverify: Add check for image hash 2012-05-12 fefe97c Jeremy Kerr * sbverify: check for presence of signature table 2012-05-12 b73f723 Jeremy Kerr * Makefile: add $(tools) var 2012-05-12 55b1940 Jeremy Kerr * sbsigntool -> sbsign 2012-05-12 a183de9 Jeremy Kerr * image: open output file with O_TRUNC 2012-04-24 04b70fc Jeremy Kerr * sbsigntooL: expand usage info 2012-04-24 9826a43 Jeremy Kerr * Add GPLv3 text in COPYING 2012-04-24 906654e Jeremy Kerr * coff: remove unneeded coff includes 2012-04-23 9d3c8b5 Jeremy Kerr * Add copyright comments 2012-04-23 e019eec Jeremy Kerr * image: warn about potential checksum differences 2012-04-23 01e33cd Jeremy Kerr * idc: allocate using the image context 2012-04-23 acd8c0a Jeremy Kerr * Initial commit sbsigntool-0.6/COPYING0000664000175000017500000000303211774125032011520 00000000000000sbsigntool - utilities for signing UEFI binaries for use with secure boot. (c) 2012 by Jeremy Kerr, Canonical Ltd. 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 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but is provided AS IS, WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, and NON-INFRINGEMENT. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library under certain conditions as described in each individual source file, and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL. If you modify file(s) with this exception, you may extend this exception to your version of the file(s), but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. If you delete this exception statement from all source files in the program, then also delete it here. sbsigntool-0.6/AUTHORS0000664000175000017500000000013412032346016011530 00000000000000Authors of sbsigntool: Adam Conrad Ivan Hu James Bottomley Jeremy Kerr Maxim Kammerer sbsigntool-0.6/config.h.in0000664000175000017500000000326012035660722012514 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Big-endian system */ #undef HAVE_BIG_ENDIAN /* Define to 1 if you have the header file. */ #undef HAVE_EFI_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Little-endian system */ #undef HAVE_LITTLE_ENDIAN /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O /* 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 sbsigntool-0.6/Makefile.in0000664000175000017500000005536112035660544012551 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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 = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ compile depcomp install-sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-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 uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__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 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@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ 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@ EFI_CPPFLAGS = @EFI_CPPFLAGS@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ HELP2MAN = @HELP2MAN@ 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@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJCOPY = @OBJCOPY@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ 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@ libcrypto_CFLAGS = @libcrypto_CFLAGS@ libcrypto_LIBS = @libcrypto_LIBS@ 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@ 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@ uuid_CFLAGS = @uuid_CFLAGS@ uuid_LIBS = @uuid_LIBS@ SUBDIRS = lib/ccan src docs tests all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then rm -f stamp-h1; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(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" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) 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; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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 CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags 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__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist 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.lzma*) \ lzma -dc $(distdir).tar.lzma | $(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 mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(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__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 config.h installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: 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-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(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: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ ctags-recursive install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ dist-lzip dist-lzma 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-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \ uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: sbsigntool-0.6/lib/0000775000175000017500000000000012035660722011316 500000000000000sbsigntool-0.6/lib/ccan/0000775000175000017500000000000012035660722012222 500000000000000sbsigntool-0.6/lib/ccan/Makefile.am0000664000175000017500000000152612032345751014201 00000000000000noinst_LIBRARIES = libccan.a libccan_a_SOURCES = \ ccan/typesafe_cb/typesafe_cb.h \ ccan/tlist/tlist.h \ ccan/time/time.h \ ccan/time/time.c \ ccan/tcon/tcon.h \ ccan/talloc/talloc.h \ ccan/talloc/talloc.c \ ccan/str/str.h \ ccan/str/str_debug.h \ ccan/str/str.c \ ccan/str/debug.c \ ccan/read_write_all/read_write_all.h \ ccan/read_write_all/read_write_all.c \ ccan/list/list.h \ ccan/list/list.c \ ccan/htable/htable_type.h \ ccan/htable/htable.h \ ccan/htable/htable.c \ ccan/hash/hash.h \ ccan/hash/hash.c \ ccan/failtest/failtest_undo.h \ ccan/failtest/failtest_proto.h \ ccan/failtest/failtest_override.h \ ccan/failtest/failtest.h \ ccan/failtest/failtest.c \ ccan/container_of/container_of.h \ ccan/compiler/compiler.h \ ccan/check_type/check_type.h \ ccan/build_assert/build_assert.h \ ccan/array_size/array_size.h sbsigntool-0.6/lib/ccan/ccan/0000775000175000017500000000000012035660722013126 500000000000000sbsigntool-0.6/lib/ccan/ccan/tcon/0000775000175000017500000000000012035660722014071 500000000000000sbsigntool-0.6/lib/ccan/ccan/tcon/tcon.h0000664000175000017500000000666512032345554015142 00000000000000/* Placed into the public domain */ #ifndef CCAN_TCON_H #define CCAN_TCON_H #include "config.h" /** * TCON - declare a _tcon type containing canary variables. * @decls: the semi-colon separated list of type canaries. * * This declares a _tcon member for a structure. It should be the * last element in your structure; with sufficient compiler support it * will not use any actual storage. tcon_check() will compare * expressions with one of these "type canaries" to cause warnings if * the container is misused. * * A type of "void *" will allow tcon_check() to pass on any (pointer) type. * * Example: * // Simply typesafe linked list. * struct list_head { * struct list_head *prev, *next; * }; * * struct string_list { * struct list_head raw; * TCON(char *canary); * }; * * // More complex: mapping from one type to another. * struct map { * void *contents; * }; * * struct int_to_string_map { * struct map raw; * TCON(char *charp_canary; int int_canary); * }; */ #if HAVE_FLEXIBLE_ARRAY_MEMBER #define TCON(decls) struct { decls; } _tcon[] #else #define TCON(decls) struct { decls; } _tcon[1] #endif /** * tcon_check - typecheck a typed container * @x: the structure containing the TCON. * @canary: which canary to check against. * @expr: the expression whose type must match the TCON (not evaluated) * * This macro is used to check that the expression is the type * expected for this structure (note the "useless" sizeof() argument * which contains this comparison with the type canary). * * It evaluates to @x so you can chain it. * * Example: * #define tlist_add(h, n, member) \ * list_add(&tcon_check((h), canary, (n))->raw, &(n)->member) */ #define tcon_check(x, canary, expr) \ (sizeof((x)->_tcon[0].canary == (expr)) ? (x) : (x)) /** * tcon_check_ptr - typecheck a typed container * @x: the structure containing the TCON. * @canary: which canary to check against. * @expr: the expression whose type must match &TCON (not evaluated) * * This macro is used to check that the expression is a pointer to the type * expected for this structure (note the "useless" sizeof() argument * which contains this comparison with the type canary), or NULL. * * It evaluates to @x so you can chain it. */ #define tcon_check_ptr(x, canary, expr) \ (sizeof(&(x)->_tcon[0].canary == (expr)) ? (x) : (x)) /** * tcon_type - the type within a container (or void *) * @x: the structure containing the TCON. * @canary: which canary to check against. */ #if HAVE_TYPEOF #define tcon_type(x, canary) __typeof__((x)->_tcon[0].canary) #else #define tcon_type(x, canary) void * #endif /** * tcon_ptr_type - pointer to the type within a container (or void *) * @x: the structure containing the TCON. * @canary: which canary to check against. */ #if HAVE_TYPEOF #define tcon_ptr_type(x, canary) __typeof__(&(x)->_tcon[0].canary) #else #define tcon_ptr_type(x, canary) void * #endif /** * tcon_cast - cast to a canary type for this container (or void *) * @x: a structure containing the TCON. * @canary: which canary to cast to. * @expr: the value to cast * * This is used to cast to the correct type for this container. If the * platform doesn't HAVE_TYPEOF, then it casts to void * (which will * cause a warning if the user doesn't expect a pointer type). */ #define tcon_cast(x, canary, expr) ((tcon_type((x), canary))(expr)) #define tcon_cast_ptr(x, canary, expr) ((tcon_ptr_type((x), canary))(expr)) #endif /* CCAN_TCON_H */ sbsigntool-0.6/lib/ccan/ccan/failtest/0000775000175000017500000000000012035660722014741 500000000000000sbsigntool-0.6/lib/ccan/ccan/failtest/failtest_undo.h0000664000175000017500000000224012032345554017670 00000000000000/* Licensed under LGPL - see LICENSE file for details */ #ifndef CCAN_FAILTEST_RESTORE_H #define CCAN_FAILTEST_RESTORE_H /* This file undoes the effect of failtest_override.h. */ #undef calloc #define calloc(nmemb, size) \ failtest_calloc((nmemb), (size), NULL, 0) #undef malloc #define malloc(size) \ failtest_malloc((size), NULL, 0) #undef realloc #define realloc(ptr, size) \ failtest_realloc((ptr), (size), NULL, 0) #undef open #define open(pathname, ...) \ failtest_open((pathname), NULL, 0, __VA_ARGS__) #undef pipe #define pipe(pipefd) \ failtest_pipe((pipefd), NULL, 0) #undef read #define read(fd, buf, count) \ failtest_read((fd), (buf), (count), NULL, 0) #undef write #define write(fd, buf, count) \ failtest_write((fd), (buf), (count), NULL, 0) #undef mmap #define mmap(addr, length, prot, flags, fd, offset) \ failtest_mmap((addr), (length), (prot), (flags), (fd), (offset), NULL, 0) #undef lseek #define lseek(fd, off, whence) \ failtest_lseek((fd), (off), (whence), NULL, 0) #undef close #define close(fd) failtest_close(fd) #undef fcntl #define fcntl(fd, ...) \ failtest_fcntl((fd), NULL, 0, __VA_ARGS__) #endif /* CCAN_FAILTEST_RESTORE_H */ sbsigntool-0.6/lib/ccan/ccan/failtest/failtest.c0000664000175000017500000012461112032345554016645 00000000000000/* Licensed under LGPL - see LICENSE file for details */ #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 enum failtest_result (*failtest_hook)(struct tlist_calls *); static FILE *tracef = NULL, *warnf; static int traceindent = 0; unsigned int failtest_timeout_ms = 20000; const char *failpath; const char *debugpath; enum info_type { WRITE, RELEASE_LOCKS, FAILURE, SUCCESS, UNEXPECTED }; struct lock_info { int fd; /* end is inclusive: you can't have a 0-byte lock. */ off_t start, end; int type; }; /* We hash the call location together with its backtrace. */ static size_t hash_call(const struct failtest_call *call) { return hash(call->file, strlen(call->file), hash(&call->line, 1, hash(call->backtrace, call->backtrace_num, call->type))); } static bool call_eq(const struct failtest_call *call1, const struct failtest_call *call2) { unsigned int i; if (strcmp(call1->file, call2->file) != 0 || call1->line != call2->line || call1->type != call2->type || call1->backtrace_num != call2->backtrace_num) return false; for (i = 0; i < call1->backtrace_num; i++) if (call1->backtrace[i] != call2->backtrace[i]) return false; return true; } /* Defines struct failtable. */ HTABLE_DEFINE_TYPE(struct failtest_call, (struct failtest_call *), hash_call, call_eq, failtable); bool (*failtest_exit_check)(struct tlist_calls *history); /* The entire history of all calls. */ static struct tlist_calls history = TLIST_INIT(history); /* If we're a child, the fd two write control info to the parent. */ static int control_fd = -1; /* If we're a child, this is the first call we did ourselves. */ static struct failtest_call *our_history_start = NULL; /* For printing runtime with --trace. */ static struct timeval start; /* Set when failtest_hook returns FAIL_PROBE */ static bool probing = false; /* Table to track duplicates. */ static struct failtable failtable; /* Array of writes which our child did. We report them on failure. */ static struct write_call *child_writes = NULL; static unsigned int child_writes_num = 0; /* fcntl locking info. */ static pid_t lock_owner; static struct lock_info *locks = NULL; static unsigned int lock_num = 0; /* Our original pid, which we return to anyone who asks. */ static pid_t orig_pid; /* Mapping from failtest_type to char. */ static const char info_to_arg[] = "mceoxprwfal"; /* Dummy call used for failtest_undo wrappers. */ static struct failtest_call unrecorded_call; struct contents_saved { size_t count; off_t off; off_t old_len; char contents[1]; }; /* File contents, saved in this child only. */ struct saved_mmapped_file { struct saved_mmapped_file *next; struct failtest_call *opener; struct contents_saved *s; }; static struct saved_mmapped_file *saved_mmapped_files; #if HAVE_BACKTRACE #include static void **get_backtrace(unsigned int *num) { static unsigned int max_back = 100; void **ret; again: ret = malloc(max_back * sizeof(void *)); *num = backtrace(ret, max_back); if (*num == max_back) { free(ret); max_back *= 2; goto again; } return ret; } #else /* This will test slightly less, since will consider all of the same * calls as identical. But, it's slightly faster! */ static void **get_backtrace(unsigned int *num) { *num = 0; return NULL; } #endif /* HAVE_BACKTRACE */ static struct failtest_call *add_history_(enum failtest_call_type type, bool can_leak, const char *file, unsigned int line, const void *elem, size_t elem_size) { struct failtest_call *call; /* NULL file is how we suppress failure. */ if (!file) return &unrecorded_call; call = malloc(sizeof *call); call->type = type; call->can_leak = can_leak; call->file = file; call->line = line; call->cleanup = NULL; call->backtrace = get_backtrace(&call->backtrace_num); memcpy(&call->u, elem, elem_size); tlist_add_tail(&history, call, list); return call; } #define add_history(type, can_leak, file, line, elem) \ add_history_((type), (can_leak), (file), (line), (elem), sizeof(*(elem))) /* We do a fake call inside a sizeof(), to check types. */ #define set_cleanup(call, clean, type) \ (call)->cleanup = (void *)((void)sizeof(clean((type *)NULL, false),1), (clean)) /* Dup the fd to a high value (out of the way I hope!), and close the old fd. */ static int move_fd_to_high(int fd) { int i; struct rlimit lim; int max; if (getrlimit(RLIMIT_NOFILE, &lim) == 0) { max = lim.rlim_cur; printf("Max is %i\n", max); } else max = FD_SETSIZE; for (i = max - 1; i > fd; i--) { if (fcntl(i, F_GETFL) == -1 && errno == EBADF) { if (dup2(fd, i) == -1) { warn("Failed to dup fd %i to %i", fd, i); continue; } close(fd); return i; } } /* Nothing? Really? Er... ok? */ return fd; } static bool read_write_info(int fd) { struct write_call *w; char *buf; /* We don't need all of this, but it's simple. */ child_writes = realloc(child_writes, (child_writes_num+1) * sizeof(child_writes[0])); w = &child_writes[child_writes_num]; if (!read_all(fd, w, sizeof(*w))) return false; w->buf = buf = malloc(w->count); if (!read_all(fd, buf, w->count)) return false; child_writes_num++; return true; } static char *failpath_string(void) { struct failtest_call *i; char *ret = strdup(""); unsigned len = 0; /* Inefficient, but who cares? */ tlist_for_each(&history, i, list) { ret = realloc(ret, len + 2); ret[len] = info_to_arg[i->type]; if (i->fail) ret[len] = toupper(ret[len]); ret[++len] = '\0'; } return ret; } static void do_warn(int e, const char *fmt, va_list ap) { char *p = failpath_string(); vfprintf(warnf, fmt, ap); if (e != -1) fprintf(warnf, ": %s", strerror(e)); fprintf(warnf, " [%s]\n", p); free(p); } static void fwarn(const char *fmt, ...) { va_list ap; int e = errno; va_start(ap, fmt); do_warn(e, fmt, ap); va_end(ap); } static void fwarnx(const char *fmt, ...) { va_list ap; va_start(ap, fmt); do_warn(-1, fmt, ap); va_end(ap); } static void tell_parent(enum info_type type) { if (control_fd != -1) write_all(control_fd, &type, sizeof(type)); } static void child_fail(const char *out, size_t outlen, const char *fmt, ...) { va_list ap; char *path = failpath_string(); va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); fprintf(stderr, "%.*s", (int)outlen, out); printf("To reproduce: --failpath=%s\n", path); free(path); tell_parent(FAILURE); exit(1); } static void PRINTF_FMT(1, 2) trace(const char *fmt, ...) { va_list ap; unsigned int i; char *p; static int idx; if (!tracef) return; for (i = 0; i < traceindent; i++) fprintf(tracef, " "); p = failpath_string(); fprintf(tracef, "%i: %u: %s ", idx++, getpid(), p); va_start(ap, fmt); vfprintf(tracef, fmt, ap); va_end(ap); free(p); } static pid_t child; static void hand_down(int signum) { kill(child, signum); } static void release_locks(void) { /* Locks were never acquired/reacquired? */ if (lock_owner == 0) return; /* We own them? Release them all. */ if (lock_owner == getpid()) { unsigned int i; struct flock fl; fl.l_type = F_UNLCK; fl.l_whence = SEEK_SET; fl.l_start = 0; fl.l_len = 0; trace("Releasing %u locks\n", lock_num); for (i = 0; i < lock_num; i++) fcntl(locks[i].fd, F_SETLK, &fl); } else { /* Our parent must have them; pass request up. */ enum info_type type = RELEASE_LOCKS; assert(control_fd != -1); write_all(control_fd, &type, sizeof(type)); } lock_owner = 0; } /* off_t is a signed type. Getting its max is non-trivial. */ static off_t off_max(void) { BUILD_ASSERT(sizeof(off_t) == 4 || sizeof(off_t) == 8); if (sizeof(off_t) == 4) return (off_t)0x7FFFFFF; else return (off_t)0x7FFFFFFFFFFFFFFULL; } static void get_locks(void) { unsigned int i; struct flock fl; if (lock_owner == getpid()) return; if (lock_owner != 0) { enum info_type type = RELEASE_LOCKS; assert(control_fd != -1); trace("Asking parent to release locks\n"); write_all(control_fd, &type, sizeof(type)); } fl.l_whence = SEEK_SET; for (i = 0; i < lock_num; i++) { fl.l_type = locks[i].type; fl.l_start = locks[i].start; if (locks[i].end == off_max()) fl.l_len = 0; else fl.l_len = locks[i].end - locks[i].start + 1; if (fcntl(locks[i].fd, F_SETLKW, &fl) != 0) abort(); } trace("Acquired %u locks\n", lock_num); lock_owner = getpid(); } static struct contents_saved *save_contents(const char *filename, int fd, size_t count, off_t off, const char *why) { struct contents_saved *s = malloc(sizeof(*s) + count); ssize_t ret; s->off = off; ret = pread(fd, s->contents, count, off); if (ret < 0) { fwarn("failtest_write: failed to save old contents!"); s->count = 0; } else s->count = ret; /* Use lseek to get the size of file, but we have to restore * file offset */ off = lseek(fd, 0, SEEK_CUR); s->old_len = lseek(fd, 0, SEEK_END); lseek(fd, off, SEEK_SET); trace("Saving %p %s %zu@%llu after %s (filelength %llu) via fd %i\n", s, filename, s->count, (long long)s->off, why, (long long)s->old_len, fd); return s; } static void restore_contents(struct failtest_call *opener, struct contents_saved *s, bool restore_offset, const char *caller) { int fd; /* The top parent doesn't need to restore. */ if (control_fd == -1) return; /* Has the fd been closed? */ if (opener->u.open.closed) { /* Reopen, replace fd, close silently as we clean up. */ fd = open(opener->u.open.pathname, O_RDWR); if (fd < 0) { fwarn("failtest: could not reopen %s to clean up %s!", opener->u.open.pathname, caller); return; } /* Make it clearly distinguisable from a "normal" fd. */ fd = move_fd_to_high(fd); trace("Reopening %s to restore it (was fd %i, now %i)\n", opener->u.open.pathname, opener->u.open.ret, fd); opener->u.open.ret = fd; opener->u.open.closed = false; } fd = opener->u.open.ret; trace("Restoring %p %s %zu@%llu after %s (filelength %llu) via fd %i\n", s, opener->u.open.pathname, s->count, (long long)s->off, caller, (long long)s->old_len, fd); if (pwrite(fd, s->contents, s->count, s->off) != s->count) { fwarn("failtest: write failed cleaning up %s for %s!", opener->u.open.pathname, caller); } if (ftruncate(fd, s->old_len) != 0) { fwarn("failtest_write: truncate failed cleaning up %s for %s!", opener->u.open.pathname, caller); } if (restore_offset) { trace("Restoring offset of fd %i to %llu\n", fd, (long long)s->off); lseek(fd, s->off, SEEK_SET); } } /* We save/restore most things on demand, but always do mmaped files. */ static void save_mmapped_files(void) { struct failtest_call *i; trace("Saving mmapped files in child\n"); tlist_for_each_rev(&history, i, list) { struct mmap_call *m = &i->u.mmap; struct saved_mmapped_file *s; if (i->type != FAILTEST_MMAP) continue; /* FIXME: We only handle mmapped files where fd is still open. */ if (m->opener->u.open.closed) continue; s = malloc(sizeof *s); s->s = save_contents(m->opener->u.open.pathname, m->fd, m->length, m->offset, "mmapped file before fork"); s->opener = m->opener; s->next = saved_mmapped_files; saved_mmapped_files = s; } } static void free_mmapped_files(bool restore) { trace("%s mmapped files in child\n", restore ? "Restoring" : "Discarding"); while (saved_mmapped_files) { struct saved_mmapped_file *next = saved_mmapped_files->next; if (restore) restore_contents(saved_mmapped_files->opener, saved_mmapped_files->s, false, "saved mmap"); free(saved_mmapped_files->s); free(saved_mmapped_files); saved_mmapped_files = next; } } /* Returns a FAILTEST_OPEN, FAILTEST_PIPE or NULL. */ static struct failtest_call *opener_of(int fd) { struct failtest_call *i; /* Don't get confused and match genuinely failed opens. */ if (fd < 0) return NULL; /* Figure out the set of live fds. */ tlist_for_each_rev(&history, i, list) { if (i->fail) continue; switch (i->type) { case FAILTEST_CLOSE: if (i->u.close.fd == fd) { return NULL; } break; case FAILTEST_OPEN: if (i->u.open.ret == fd) { if (i->u.open.closed) return NULL; return i; } break; case FAILTEST_PIPE: if (i->u.pipe.fds[0] == fd || i->u.pipe.fds[1] == fd) { return i; } break; default: break; } } /* FIXME: socket, dup, etc are untracked! */ return NULL; } static void free_call(struct failtest_call *call) { /* We don't do this in cleanup: needed even for failed opens. */ if (call->type == FAILTEST_OPEN) free((char *)call->u.open.pathname); free(call->backtrace); tlist_del_from(&history, call, list); free(call); } /* Free up memory, so valgrind doesn't report leaks. */ static void free_everything(void) { struct failtest_call *i; while ((i = tlist_top(&history, list)) != NULL) free_call(i); failtable_clear(&failtable); } static NORETURN void failtest_cleanup(bool forced_cleanup, int status) { struct failtest_call *i; bool restore = true; /* For children, we don't care if they "failed" the testing. */ if (control_fd != -1) status = 0; else /* We don't restore contents for original parent. */ restore = false; /* Cleanup everything, in reverse order. */ tlist_for_each_rev(&history, i, list) { /* Don't restore things our parent did. */ if (i == our_history_start) restore = false; if (i->fail) continue; if (i->cleanup) i->cleanup(&i->u, restore); /* But their program shouldn't leak, even on failure. */ if (!forced_cleanup && i->can_leak) { printf("Leak at %s:%u: --failpath=%s\n", i->file, i->line, failpath_string()); status = 1; } } /* Put back mmaped files the way our parent (if any) expects. */ free_mmapped_files(true); free_everything(); if (status == 0) tell_parent(SUCCESS); else tell_parent(FAILURE); exit(status); } static bool following_path(void) { if (!failpath) return false; /* + means continue after end, like normal. */ if (*failpath == '+') { failpath = NULL; return false; } return true; } static bool follow_path(struct failtest_call *call) { if (*failpath == '\0') { /* Continue, but don't inject errors. */ return call->fail = false; } if (tolower((unsigned char)*failpath) != info_to_arg[call->type]) errx(1, "Failpath expected '%s' got '%c'\n", failpath, info_to_arg[call->type]); call->fail = cisupper(*(failpath++)); if (call->fail) call->can_leak = false; return call->fail; } static bool should_fail(struct failtest_call *call) { int status; int control[2], output[2]; enum info_type type = UNEXPECTED; char *out = NULL; size_t outlen = 0; struct failtest_call *dup; if (call == &unrecorded_call) return false; if (following_path()) return follow_path(call); /* Attach debugger if they asked for it. */ if (debugpath) { char *path; /* Pretend this last call matches whatever path wanted: * keeps valgrind happy. */ call->fail = cisupper(debugpath[strlen(debugpath)-1]); path = failpath_string(); if (streq(path, debugpath)) { char str[80]; /* Don't timeout. */ signal(SIGUSR1, SIG_IGN); sprintf(str, "xterm -e gdb /proc/%d/exe %d &", getpid(), getpid()); if (system(str) == 0) sleep(5); } else { /* Ignore last character: could be upper or lower. */ path[strlen(path)-1] = '\0'; if (!strstarts(debugpath, path)) { fprintf(stderr, "--debugpath not followed: %s\n", path); debugpath = NULL; } } free(path); } /* Are we probing? If so, we never fail twice. */ if (probing) { trace("Not failing %c due to FAIL_PROBE return\n", info_to_arg[call->type]); return call->fail = false; } /* Don't fail more than once in the same place. */ dup = failtable_get(&failtable, call); if (dup) { trace("Not failing %c due to duplicate\n", info_to_arg[call->type]); return call->fail = false; } if (failtest_hook) { switch (failtest_hook(&history)) { case FAIL_OK: break; case FAIL_PROBE: probing = true; break; case FAIL_DONT_FAIL: trace("Not failing %c due to failhook return\n", info_to_arg[call->type]); call->fail = false; return false; default: abort(); } } /* Add it to our table of calls. */ failtable_add(&failtable, call); /* We're going to fail in the child. */ call->fail = true; if (pipe(control) != 0 || pipe(output) != 0) err(1, "opening pipe"); /* Move out the way, to high fds. */ control[0] = move_fd_to_high(control[0]); control[1] = move_fd_to_high(control[1]); output[0] = move_fd_to_high(output[0]); output[1] = move_fd_to_high(output[1]); /* Prevent double-printing (in child and parent) */ fflush(stdout); fflush(warnf); if (tracef) fflush(tracef); child = fork(); if (child == -1) err(1, "forking failed"); if (child == 0) { traceindent++; if (tracef) { struct timeval diff; const char *p; char *failpath; struct failtest_call *c; c = tlist_tail(&history, list); diff = time_sub(time_now(), start); failpath = failpath_string(); p = strrchr(c->file, '/'); if (p) p++; else p = c->file; trace("%u->%u (%u.%02u): %s (%s:%u)\n", getppid(), getpid(), (int)diff.tv_sec, (int)diff.tv_usec / 10000, failpath, p, c->line); free(failpath); } /* From here on, we have to clean up! */ our_history_start = tlist_tail(&history, list); close(control[0]); close(output[0]); /* Don't swallow stderr if we're tracing. */ if (!tracef) { dup2(output[1], STDOUT_FILENO); dup2(output[1], STDERR_FILENO); if (output[1] != STDOUT_FILENO && output[1] != STDERR_FILENO) close(output[1]); } control_fd = move_fd_to_high(control[1]); /* Forget any of our parent's saved files. */ free_mmapped_files(false); /* Now, save any files we need to. */ save_mmapped_files(); /* Failed calls can't leak. */ call->can_leak = false; return true; } signal(SIGUSR1, hand_down); close(control[1]); close(output[1]); /* We grab output so we can display it; we grab writes so we * can compare. */ do { struct pollfd pfd[2]; int ret; pfd[0].fd = output[0]; pfd[0].events = POLLIN|POLLHUP; pfd[1].fd = control[0]; pfd[1].events = POLLIN|POLLHUP; if (type == SUCCESS) ret = poll(pfd, 1, failtest_timeout_ms); else ret = poll(pfd, 2, failtest_timeout_ms); if (ret == 0) hand_down(SIGUSR1); if (ret < 0) { if (errno == EINTR) continue; err(1, "Poll returned %i", ret); } if (pfd[0].revents & POLLIN) { ssize_t len; out = realloc(out, outlen + 8192); len = read(output[0], out + outlen, 8192); outlen += len; } else if (type != SUCCESS && (pfd[1].revents & POLLIN)) { if (read_all(control[0], &type, sizeof(type))) { if (type == WRITE) { if (!read_write_info(control[0])) break; } else if (type == RELEASE_LOCKS) { release_locks(); /* FIXME: Tell them we're done... */ } } } else if (pfd[0].revents & POLLHUP) { break; } } while (type != FAILURE); close(output[0]); close(control[0]); waitpid(child, &status, 0); if (!WIFEXITED(status)) { if (WTERMSIG(status) == SIGUSR1) child_fail(out, outlen, "Timed out"); else child_fail(out, outlen, "Killed by signal %u: ", WTERMSIG(status)); } /* Child printed failure already, just pass up exit code. */ if (type == FAILURE) { fprintf(stderr, "%.*s", (int)outlen, out); tell_parent(type); exit(WEXITSTATUS(status) ? WEXITSTATUS(status) : 1); } if (WEXITSTATUS(status) != 0) child_fail(out, outlen, "Exited with status %i: ", WEXITSTATUS(status)); free(out); signal(SIGUSR1, SIG_DFL); /* Only child does probe. */ probing = false; /* We continue onwards without failing. */ call->fail = false; return false; } static void cleanup_calloc(struct calloc_call *call, bool restore) { trace("undoing calloc %p\n", call->ret); free(call->ret); } void *failtest_calloc(size_t nmemb, size_t size, const char *file, unsigned line) { struct failtest_call *p; struct calloc_call call; call.nmemb = nmemb; call.size = size; p = add_history(FAILTEST_CALLOC, true, file, line, &call); if (should_fail(p)) { p->u.calloc.ret = NULL; p->error = ENOMEM; } else { p->u.calloc.ret = calloc(nmemb, size); set_cleanup(p, cleanup_calloc, struct calloc_call); } trace("calloc %zu x %zu %s:%u -> %p\n", nmemb, size, file, line, p->u.calloc.ret); errno = p->error; return p->u.calloc.ret; } static void cleanup_malloc(struct malloc_call *call, bool restore) { trace("undoing malloc %p\n", call->ret); free(call->ret); } void *failtest_malloc(size_t size, const char *file, unsigned line) { struct failtest_call *p; struct malloc_call call; call.size = size; p = add_history(FAILTEST_MALLOC, true, file, line, &call); if (should_fail(p)) { p->u.malloc.ret = NULL; p->error = ENOMEM; } else { p->u.malloc.ret = malloc(size); set_cleanup(p, cleanup_malloc, struct malloc_call); } trace("malloc %zu %s:%u -> %p\n", size, file, line, p->u.malloc.ret); errno = p->error; return p->u.malloc.ret; } static void cleanup_realloc(struct realloc_call *call, bool restore) { trace("undoing realloc %p\n", call->ret); free(call->ret); } /* Walk back and find out if we got this ptr from a previous routine. */ static void fixup_ptr_history(void *ptr, const char *why) { struct failtest_call *i; /* Start at end of history, work back. */ tlist_for_each_rev(&history, i, list) { switch (i->type) { case FAILTEST_REALLOC: if (i->u.realloc.ret == ptr) { trace("found realloc %p %s:%u matching %s\n", ptr, i->file, i->line, why); i->cleanup = NULL; i->can_leak = false; return; } break; case FAILTEST_MALLOC: if (i->u.malloc.ret == ptr) { trace("found malloc %p %s:%u matching %s\n", ptr, i->file, i->line, why); i->cleanup = NULL; i->can_leak = false; return; } break; case FAILTEST_CALLOC: if (i->u.calloc.ret == ptr) { trace("found calloc %p %s:%u matching %s\n", ptr, i->file, i->line, why); i->cleanup = NULL; i->can_leak = false; return; } break; default: break; } } trace("Did not find %p matching %s\n", ptr, why); } void *failtest_realloc(void *ptr, size_t size, const char *file, unsigned line) { struct failtest_call *p; struct realloc_call call; call.size = size; p = add_history(FAILTEST_REALLOC, true, file, line, &call); /* FIXME: Try one child moving allocation, one not. */ if (should_fail(p)) { p->u.realloc.ret = NULL; p->error = ENOMEM; } else { /* Don't catch this one in the history fixup... */ p->u.realloc.ret = NULL; fixup_ptr_history(ptr, "realloc"); p->u.realloc.ret = realloc(ptr, size); set_cleanup(p, cleanup_realloc, struct realloc_call); } trace("realloc %p %s:%u -> %p\n", ptr, file, line, p->u.realloc.ret); errno = p->error; return p->u.realloc.ret; } /* FIXME: Record free, so we can terminate fixup_ptr_history correctly. * If there's an alloc we don't see, it could get confusing if it matches * a previous allocation we did see. */ void failtest_free(void *ptr) { fixup_ptr_history(ptr, "free"); trace("free %p\n", ptr); free(ptr); } static struct contents_saved *save_file(const char *pathname) { int fd; struct contents_saved *s; fd = open(pathname, O_RDONLY); if (fd < 0) return NULL; s = save_contents(pathname, fd, lseek(fd, 0, SEEK_END), 0, "open with O_TRUNC"); close(fd); return s; } /* Optimization: don't create a child for an open which *we know* * would fail anyway. */ static bool open_would_fail(const char *pathname, int flags) { if ((flags & O_ACCMODE) == O_RDONLY) return access(pathname, R_OK) != 0; if (!(flags & O_CREAT)) { if ((flags & O_ACCMODE) == O_WRONLY) return access(pathname, W_OK) != 0; if ((flags & O_ACCMODE) == O_RDWR) return access(pathname, W_OK) != 0 || access(pathname, R_OK) != 0; } /* FIXME: We could check if it exists, for O_CREAT|O_EXCL */ return false; } static void cleanup_open(struct open_call *call, bool restore) { if (restore && call->saved) restore_contents(container_of(call, struct failtest_call, u.open), call->saved, false, "open with O_TRUNC"); if (!call->closed) { trace("Cleaning up open %s by closing fd %i\n", call->pathname, call->ret); close(call->ret); call->closed = true; } free(call->saved); } int failtest_open(const char *pathname, const char *file, unsigned line, ...) { struct failtest_call *p; struct open_call call; va_list ap; call.pathname = strdup(pathname); va_start(ap, line); call.flags = va_arg(ap, int); call.always_save = false; call.closed = false; if (call.flags & O_CREAT) { call.mode = va_arg(ap, int); va_end(ap); } p = add_history(FAILTEST_OPEN, true, file, line, &call); /* Avoid memory leak! */ if (p == &unrecorded_call) free((char *)call.pathname); if (should_fail(p)) { /* Don't bother inserting failures that would happen anyway. */ if (open_would_fail(pathname, call.flags)) { trace("Open would have failed anyway: stopping\n"); failtest_cleanup(true, 0); } p->u.open.ret = -1; /* FIXME: Play with error codes? */ p->error = EACCES; } else { /* Save the old version if they're truncating it. */ if (call.flags & O_TRUNC) p->u.open.saved = save_file(pathname); else p->u.open.saved = NULL; p->u.open.ret = open(pathname, call.flags, call.mode); if (p->u.open.ret == -1) { p->u.open.closed = true; p->can_leak = false; } else { set_cleanup(p, cleanup_open, struct open_call); } } trace("open %s %s:%u -> %i (opener %p)\n", pathname, file, line, p->u.open.ret, &p->u.open); errno = p->error; return p->u.open.ret; } static void cleanup_mmap(struct mmap_call *mmap, bool restore) { trace("cleaning up mmap @%p (opener %p)\n", mmap->ret, mmap->opener); if (restore) restore_contents(mmap->opener, mmap->saved, false, "mmap"); free(mmap->saved); } void *failtest_mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset, const char *file, unsigned line) { struct failtest_call *p; struct mmap_call call; call.addr = addr; call.length = length; call.prot = prot; call.flags = flags; call.offset = offset; call.fd = fd; call.opener = opener_of(fd); /* If we don't know what file it was, don't fail. */ if (!call.opener) { if (fd != -1) { fwarnx("failtest_mmap: couldn't figure out source for" " fd %i at %s:%u", fd, file, line); } addr = mmap(addr, length, prot, flags, fd, offset); trace("mmap of fd %i -> %p (opener = NULL)\n", fd, addr); return addr; } p = add_history(FAILTEST_MMAP, false, file, line, &call); if (should_fail(p)) { p->u.mmap.ret = MAP_FAILED; p->error = ENOMEM; } else { p->u.mmap.ret = mmap(addr, length, prot, flags, fd, offset); /* Save contents if we're writing to a normal file */ if (p->u.mmap.ret != MAP_FAILED && (prot & PROT_WRITE) && call.opener->type == FAILTEST_OPEN) { const char *fname = call.opener->u.open.pathname; p->u.mmap.saved = save_contents(fname, fd, length, offset, "being mmapped"); set_cleanup(p, cleanup_mmap, struct mmap_call); } } trace("mmap of fd %i %s:%u -> %p (opener = %p)\n", fd, file, line, addr, call.opener); errno = p->error; return p->u.mmap.ret; } /* Since OpenBSD can't handle adding args, we use this file and line. * This will make all mmaps look the same, reducing coverage. */ void *failtest_mmap_noloc(void *addr, size_t length, int prot, int flags, int fd, off_t offset) { return failtest_mmap(addr, length, prot, flags, fd, offset, __FILE__, __LINE__); } static void cleanup_pipe(struct pipe_call *call, bool restore) { trace("cleaning up pipe fd=%i%s,%i%s\n", call->fds[0], call->closed[0] ? "(already closed)" : "", call->fds[1], call->closed[1] ? "(already closed)" : ""); if (!call->closed[0]) close(call->fds[0]); if (!call->closed[1]) close(call->fds[1]); } int failtest_pipe(int pipefd[2], const char *file, unsigned line) { struct failtest_call *p; struct pipe_call call; p = add_history(FAILTEST_PIPE, true, file, line, &call); if (should_fail(p)) { p->u.open.ret = -1; /* FIXME: Play with error codes? */ p->error = EMFILE; } else { p->u.pipe.ret = pipe(p->u.pipe.fds); p->u.pipe.closed[0] = p->u.pipe.closed[1] = false; set_cleanup(p, cleanup_pipe, struct pipe_call); } trace("pipe %s:%u -> %i,%i\n", file, line, p->u.pipe.ret ? -1 : p->u.pipe.fds[0], p->u.pipe.ret ? -1 : p->u.pipe.fds[1]); /* This causes valgrind to notice if they use pipefd[] after failure */ memcpy(pipefd, p->u.pipe.fds, sizeof(p->u.pipe.fds)); errno = p->error; return p->u.pipe.ret; } static void cleanup_read(struct read_call *call, bool restore) { if (restore) { trace("cleaning up read on fd %i: seeking to %llu\n", call->fd, (long long)call->off); /* Read (not readv!) moves file offset! */ if (lseek(call->fd, call->off, SEEK_SET) != call->off) { fwarn("Restoring lseek pointer failed (read)"); } } } static ssize_t failtest_add_read(int fd, void *buf, size_t count, off_t off, bool is_pread, const char *file, unsigned line) { struct failtest_call *p; struct read_call call; call.fd = fd; call.buf = buf; call.count = count; call.off = off; p = add_history(FAILTEST_READ, false, file, line, &call); /* FIXME: Try partial read returns. */ if (should_fail(p)) { p->u.read.ret = -1; p->error = EIO; } else { if (is_pread) p->u.read.ret = pread(fd, buf, count, off); else { p->u.read.ret = read(fd, buf, count); if (p->u.read.ret != -1) set_cleanup(p, cleanup_read, struct read_call); } } trace("%sread %s:%u fd %i %zu@%llu -> %i\n", is_pread ? "p" : "", file, line, fd, count, (long long)off, p->u.read.ret); errno = p->error; return p->u.read.ret; } static void cleanup_write(struct write_call *write, bool restore) { trace("cleaning up write on %s\n", write->opener->u.open.pathname); if (restore) restore_contents(write->opener, write->saved, !write->is_pwrite, "write"); free(write->saved); } static ssize_t failtest_add_write(int fd, const void *buf, size_t count, off_t off, bool is_pwrite, const char *file, unsigned line) { struct failtest_call *p; struct write_call call; call.fd = fd; call.buf = buf; call.count = count; call.off = off; call.is_pwrite = is_pwrite; call.opener = opener_of(fd); p = add_history(FAILTEST_WRITE, false, file, line, &call); /* If we're a child, we need to make sure we write the same thing * to non-files as the parent does, so tell it. */ if (control_fd != -1 && off == (off_t)-1) { enum info_type type = WRITE; write_all(control_fd, &type, sizeof(type)); write_all(control_fd, &p->u.write, sizeof(p->u.write)); write_all(control_fd, buf, count); } /* FIXME: Try partial write returns. */ if (should_fail(p)) { p->u.write.ret = -1; p->error = EIO; } else { bool is_file; assert(call.opener == p->u.write.opener); if (p->u.write.opener) { is_file = (p->u.write.opener->type == FAILTEST_OPEN); } else { /* We can't unwind it, so at least check same * in parent and child. */ is_file = false; } /* FIXME: We assume same write order in parent and child */ if (!is_file && child_writes_num != 0) { if (child_writes[0].fd != fd) errx(1, "Child wrote to fd %u, not %u?", child_writes[0].fd, fd); if (child_writes[0].off != p->u.write.off) errx(1, "Child wrote to offset %zu, not %zu?", (size_t)child_writes[0].off, (size_t)p->u.write.off); if (child_writes[0].count != count) errx(1, "Child wrote length %zu, not %zu?", child_writes[0].count, count); if (memcmp(child_writes[0].buf, buf, count)) { child_fail(NULL, 0, "Child wrote differently to" " fd %u than we did!\n", fd); } free((char *)child_writes[0].buf); child_writes_num--; memmove(&child_writes[0], &child_writes[1], sizeof(child_writes[0]) * child_writes_num); /* Child wrote it already. */ trace("write %s:%i on fd %i already done by child\n", file, line, fd); p->u.write.ret = count; errno = p->error; return p->u.write.ret; } if (is_file) { p->u.write.saved = save_contents(call.opener->u.open.pathname, fd, count, off, "being overwritten"); set_cleanup(p, cleanup_write, struct write_call); } /* Though off is current seek ptr for write case, we need to * move it. write() does that for us. */ if (p->u.write.is_pwrite) p->u.write.ret = pwrite(fd, buf, count, off); else p->u.write.ret = write(fd, buf, count); } trace("%swrite %s:%i %zu@%llu on fd %i -> %i\n", p->u.write.is_pwrite ? "p" : "", file, line, count, (long long)off, fd, p->u.write.ret); errno = p->error; return p->u.write.ret; } ssize_t failtest_pwrite(int fd, const void *buf, size_t count, off_t offset, const char *file, unsigned line) { return failtest_add_write(fd, buf, count, offset, true, file, line); } ssize_t failtest_write(int fd, const void *buf, size_t count, const char *file, unsigned line) { return failtest_add_write(fd, buf, count, lseek(fd, 0, SEEK_CUR), false, file, line); } ssize_t failtest_pread(int fd, void *buf, size_t count, off_t off, const char *file, unsigned line) { return failtest_add_read(fd, buf, count, off, true, file, line); } ssize_t failtest_read(int fd, void *buf, size_t count, const char *file, unsigned line) { return failtest_add_read(fd, buf, count, lseek(fd, 0, SEEK_CUR), false, file, line); } static struct lock_info *WARN_UNUSED_RESULT add_lock(struct lock_info *locks, int fd, off_t start, off_t end, int type) { unsigned int i; struct lock_info *l; for (i = 0; i < lock_num; i++) { l = &locks[i]; if (l->fd != fd) continue; /* Four cases we care about: * Start overlap: * l = | | * new = | | * Mid overlap: * l = | | * new = | | * End overlap: * l = | | * new = | | * Total overlap: * l = | | * new = | | */ if (start > l->start && end < l->end) { /* Mid overlap: trim entry, add new one. */ off_t new_start, new_end; new_start = end + 1; new_end = l->end; trace("splitting lock on fd %i from %llu-%llu" " to %llu-%llu\n", fd, (long long)l->start, (long long)l->end, (long long)l->start, (long long)start - 1); l->end = start - 1; locks = add_lock(locks, fd, new_start, new_end, l->type); l = &locks[i]; } else if (start <= l->start && end >= l->end) { /* Total overlap: eliminate entry. */ trace("erasing lock on fd %i %llu-%llu\n", fd, (long long)l->start, (long long)l->end); l->end = 0; l->start = 1; } else if (end >= l->start && end < l->end) { trace("trimming lock on fd %i from %llu-%llu" " to %llu-%llu\n", fd, (long long)l->start, (long long)l->end, (long long)end + 1, (long long)l->end); /* Start overlap: trim entry. */ l->start = end + 1; } else if (start > l->start && start <= l->end) { trace("trimming lock on fd %i from %llu-%llu" " to %llu-%llu\n", fd, (long long)l->start, (long long)l->end, (long long)l->start, (long long)start - 1); /* End overlap: trim entry. */ l->end = start-1; } /* Nothing left? Remove it. */ if (l->end < l->start) { trace("forgetting lock on fd %i\n", fd); memmove(l, l + 1, (--lock_num - i) * sizeof(l[0])); i--; } } if (type != F_UNLCK) { locks = realloc(locks, (lock_num + 1) * sizeof(*locks)); l = &locks[lock_num++]; l->fd = fd; l->start = start; l->end = end; l->type = type; trace("new lock on fd %i %llu-%llu\n", fd, (long long)l->start, (long long)l->end); } return locks; } /* We trap this so we can record it: we don't fail it. */ int failtest_close(int fd, const char *file, unsigned line) { struct close_call call; struct failtest_call *p, *opener; /* Do this before we add ourselves to history! */ opener = opener_of(fd); call.fd = fd; p = add_history(FAILTEST_CLOSE, false, file, line, &call); p->fail = false; /* Consume close from failpath (shouldn't tell us to fail). */ if (following_path()) { if (follow_path(p)) abort(); } trace("close on fd %i\n", fd); if (fd < 0) return close(fd); /* Mark opener as not leaking, remove its cleanup function. */ if (opener) { trace("close on fd %i found opener %p\n", fd, opener); if (opener->type == FAILTEST_PIPE) { /* From a pipe? */ if (opener->u.pipe.fds[0] == fd) { assert(!opener->u.pipe.closed[0]); opener->u.pipe.closed[0] = true; } else if (opener->u.pipe.fds[1] == fd) { assert(!opener->u.pipe.closed[1]); opener->u.pipe.closed[1] = true; } else abort(); opener->can_leak = (!opener->u.pipe.closed[0] || !opener->u.pipe.closed[1]); } else if (opener->type == FAILTEST_OPEN) { opener->u.open.closed = true; opener->can_leak = false; } else abort(); } /* Restore offset now, in case parent shared (can't do after close!). */ if (control_fd != -1) { struct failtest_call *i; tlist_for_each_rev(&history, i, list) { if (i == our_history_start) break; if (i == opener) break; if (i->type == FAILTEST_LSEEK && i->u.lseek.fd == fd) { trace("close on fd %i undoes lseek\n", fd); /* This seeks back. */ i->cleanup(&i->u, true); i->cleanup = NULL; } else if (i->type == FAILTEST_WRITE && i->u.write.fd == fd && !i->u.write.is_pwrite) { trace("close on fd %i undoes write" " offset change\n", fd); /* Write (not pwrite!) moves file offset! */ if (lseek(fd, i->u.write.off, SEEK_SET) != i->u.write.off) { fwarn("Restoring lseek pointer failed (write)"); } } else if (i->type == FAILTEST_READ && i->u.read.fd == fd) { /* preads don't *have* cleanups */ if (i->cleanup) { trace("close on fd %i undoes read" " offset change\n", fd); /* This seeks back. */ i->cleanup(&i->u, true); i->cleanup = NULL; } } } } /* Close unlocks everything. */ locks = add_lock(locks, fd, 0, off_max(), F_UNLCK); return close(fd); } /* Zero length means "to end of file" */ static off_t end_of(off_t start, off_t len) { if (len == 0) return off_max(); return start + len - 1; } /* FIXME: This only handles locks, really. */ int failtest_fcntl(int fd, const char *file, unsigned line, int cmd, ...) { struct failtest_call *p; struct fcntl_call call; va_list ap; call.fd = fd; call.cmd = cmd; /* Argument extraction. */ switch (cmd) { case F_SETFL: case F_SETFD: va_start(ap, cmd); call.arg.l = va_arg(ap, long); va_end(ap); trace("fcntl on fd %i F_SETFL/F_SETFD\n", fd); return fcntl(fd, cmd, call.arg.l); case F_GETFD: case F_GETFL: trace("fcntl on fd %i F_GETFL/F_GETFD\n", fd); return fcntl(fd, cmd); case F_GETLK: trace("fcntl on fd %i F_GETLK\n", fd); get_locks(); va_start(ap, cmd); call.arg.fl = *va_arg(ap, struct flock *); va_end(ap); return fcntl(fd, cmd, &call.arg.fl); case F_SETLK: case F_SETLKW: trace("fcntl on fd %i F_SETLK%s\n", fd, cmd == F_SETLKW ? "W" : ""); va_start(ap, cmd); call.arg.fl = *va_arg(ap, struct flock *); va_end(ap); break; default: /* This means you need to implement it here. */ err(1, "failtest: unknown fcntl %u", cmd); } p = add_history(FAILTEST_FCNTL, false, file, line, &call); if (should_fail(p)) { p->u.fcntl.ret = -1; if (p->u.fcntl.cmd == F_SETLK) p->error = EAGAIN; else p->error = EDEADLK; } else { get_locks(); p->u.fcntl.ret = fcntl(p->u.fcntl.fd, p->u.fcntl.cmd, &p->u.fcntl.arg.fl); if (p->u.fcntl.ret == -1) p->error = errno; else { /* We don't handle anything else yet. */ assert(p->u.fcntl.arg.fl.l_whence == SEEK_SET); locks = add_lock(locks, p->u.fcntl.fd, p->u.fcntl.arg.fl.l_start, end_of(p->u.fcntl.arg.fl.l_start, p->u.fcntl.arg.fl.l_len), p->u.fcntl.arg.fl.l_type); } } trace("fcntl on fd %i -> %i\n", fd, p->u.fcntl.ret); errno = p->error; return p->u.fcntl.ret; } static void cleanup_lseek(struct lseek_call *call, bool restore) { if (restore) { trace("cleaning up lseek on fd %i -> %llu\n", call->fd, (long long)call->old_off); if (lseek(call->fd, call->old_off, SEEK_SET) != call->old_off) fwarn("Restoring lseek pointer failed"); } } /* We trap this so we can undo it: we don't fail it. */ off_t failtest_lseek(int fd, off_t offset, int whence, const char *file, unsigned int line) { struct failtest_call *p; struct lseek_call call; call.fd = fd; call.offset = offset; call.whence = whence; call.old_off = lseek(fd, 0, SEEK_CUR); p = add_history(FAILTEST_LSEEK, false, file, line, &call); p->fail = false; /* Consume lseek from failpath. */ if (failpath) if (should_fail(p)) abort(); p->u.lseek.ret = lseek(fd, offset, whence); if (p->u.lseek.ret != (off_t)-1) set_cleanup(p, cleanup_lseek, struct lseek_call); trace("lseek %s:%u on fd %i from %llu to %llu%s\n", file, line, fd, (long long)call.old_off, (long long)offset, whence == SEEK_CUR ? " (from current off)" : whence == SEEK_END ? " (from end)" : whence == SEEK_SET ? "" : " (invalid whence)"); return p->u.lseek.ret; } pid_t failtest_getpid(const char *file, unsigned line) { /* You must call failtest_init first! */ assert(orig_pid); return orig_pid; } void failtest_init(int argc, char *argv[]) { unsigned int i; orig_pid = getpid(); warnf = fdopen(move_fd_to_high(dup(STDERR_FILENO)), "w"); for (i = 1; i < argc; i++) { if (!strncmp(argv[i], "--failpath=", strlen("--failpath="))) { failpath = argv[i] + strlen("--failpath="); } else if (strcmp(argv[i], "--trace") == 0) { tracef = warnf; failtest_timeout_ms = -1; } else if (!strncmp(argv[i], "--debugpath=", strlen("--debugpath="))) { debugpath = argv[i] + strlen("--debugpath="); } } failtable_init(&failtable); start = time_now(); } bool failtest_has_failed(void) { return control_fd != -1; } void failtest_exit(int status) { trace("failtest_exit with status %i\n", status); if (failtest_exit_check) { if (!failtest_exit_check(&history)) child_fail(NULL, 0, "failtest_exit_check failed\n"); } failtest_cleanup(false, status); } sbsigntool-0.6/lib/ccan/ccan/failtest/failtest_override.h0000664000175000017500000000442312032345554020547 00000000000000/* Licensed under LGPL - see LICENSE file for details */ #ifndef CCAN_FAILTEST_OVERRIDE_H #define CCAN_FAILTEST_OVERRIDE_H /* This file is included before the source file to test. */ #include "config.h" #if HAVE_FILE_OFFSET_BITS #define _FILE_OFFSET_BITS 64 #endif /* Replacement of allocators. */ #include #undef calloc #define calloc(nmemb, size) \ failtest_calloc((nmemb), (size), __FILE__, __LINE__) #undef malloc #define malloc(size) \ failtest_malloc((size), __FILE__, __LINE__) #undef realloc #define realloc(ptr, size) \ failtest_realloc((ptr), (size), __FILE__, __LINE__) #undef free #define free(ptr) \ failtest_free(ptr) /* Replacement of I/O. */ #include #include #include #include #include #undef open #define open(pathname, ...) \ failtest_open((pathname), __FILE__, __LINE__, __VA_ARGS__) #undef pipe #define pipe(pipefd) \ failtest_pipe((pipefd), __FILE__, __LINE__) #undef read #define read(fd, buf, count) \ failtest_read((fd), (buf), (count), __FILE__, __LINE__) #undef write #define write(fd, buf, count) \ failtest_write((fd), (buf), (count), __FILE__, __LINE__) #undef pread #define pread(fd, buf, count, off) \ failtest_pread((fd), (buf), (count), (off), __FILE__, __LINE__) #undef pwrite #define pwrite(fd, buf, count, off) \ failtest_pwrite((fd), (buf), (count), (off), __FILE__, __LINE__) #undef close #define close(fd) failtest_close(fd, __FILE__, __LINE__) #undef fcntl #define fcntl(fd, ...) failtest_fcntl((fd), __FILE__, __LINE__, __VA_ARGS__) #undef mmap /* OpenBSD doesn't idempotent-protect sys/mman.h, so we can't add args. */ #ifdef __OpenBSD__ #define mmap(addr, length, prot, flags, fd, offset) \ failtest_mmap_noloc((addr), (length), (prot), (flags), (fd), (offset)) #else #define mmap(addr, length, prot, flags, fd, offset) \ failtest_mmap((addr), (length), (prot), (flags), (fd), (offset), \ __FILE__, __LINE__) #endif /* !__OpenBSD__ */ #undef lseek #define lseek(fd, offset, whence) \ failtest_lseek((fd), (offset), (whence), __FILE__, __LINE__) /* Replacement of getpid (since failtest will fork). */ #undef getpid #define getpid() failtest_getpid(__FILE__, __LINE__) #include #endif /* CCAN_FAILTEST_OVERRIDE_H */ sbsigntool-0.6/lib/ccan/ccan/failtest/failtest.h0000664000175000017500000001333012032345554016645 00000000000000/* Licensed under LGPL - see LICENSE file for details */ #ifndef CCAN_FAILTEST_H #define CCAN_FAILTEST_H #include "config.h" #if HAVE_FILE_OFFSET_BITS #define _FILE_OFFSET_BITS 64 #endif #include #include #include #include #include /** * failtest_init - initialize the failtest module * @argc: the number of commandline arguments * @argv: the commandline argument array * * This initializes the module, and in particular if argv[1] is "--failpath=" * then it ensures that failures follow that pattern. This allows easy * debugging of complex failure paths. */ void failtest_init(int argc, char *argv[]); /** * failtest_exit - clean up and exit the test * @status: the status (usually exit_status() from ccan/tap). * * This cleans up and changes to files made in this child, and exits the test. * It also calls your failtest_default_hook, if any. * * A child which does not exit via failtest_exit() will cause the overall test * to fail. */ void NORETURN failtest_exit(int status); /** * enum failtest_call_type - discriminator for failtest_call.u */ enum failtest_call_type { FAILTEST_MALLOC, FAILTEST_CALLOC, FAILTEST_REALLOC, FAILTEST_OPEN, FAILTEST_CLOSE, FAILTEST_PIPE, FAILTEST_READ, FAILTEST_WRITE, FAILTEST_FCNTL, FAILTEST_MMAP, FAILTEST_LSEEK }; struct calloc_call { void *ret; size_t nmemb; size_t size; }; struct malloc_call { void *ret; size_t size; }; struct realloc_call { void *ret; void *ptr; size_t size; }; struct open_call { int ret; const char *pathname; int flags; mode_t mode; bool always_save; bool closed; /* This is used for O_TRUNC opens on existing files. */ struct contents_saved *saved; }; struct close_call { int fd; }; struct pipe_call { int ret; int fds[2]; bool closed[2]; }; struct read_call { ssize_t ret; off_t off; int fd; void *buf; size_t count; }; struct write_call { ssize_t ret; int fd; const void *buf; size_t count; off_t off; bool is_pwrite; struct failtest_call *opener; struct contents_saved *saved; }; struct fcntl_call { int ret; int fd; int cmd; union { struct flock fl; long l; int i; } arg; }; struct mmap_call { void *ret; void *addr; size_t length; int prot; int flags; int fd; off_t offset; struct failtest_call *opener; struct contents_saved *saved; }; struct lseek_call { ssize_t ret; int fd; off_t offset; int whence; off_t old_off; }; /** * struct failtest_call - description of a call redirected to failtest module * @type: the call type * @file: the filename of the caller * @line: the line number of the caller * @fail: did this call fail * @error: the errno (if any) * @u: the union of call data * * This structure is used to represent the ordered history of calls. * * See Also: * failtest_hook, failtest_exit_check */ struct failtest_call { /* We're in the history list. */ struct list_node list; enum failtest_call_type type; /* Where we were called from. */ const char *file; unsigned int line; /* Did we fail? */ bool fail; /* What we set errno to. */ int error; /* How do we clean this up? */ void (*cleanup)(void *u, bool restore); /* Should their program have cleaned up? */ bool can_leak; /* Backtrace of call chain. */ void **backtrace; unsigned int backtrace_num; /* The actual call data. */ union { struct calloc_call calloc; struct malloc_call malloc; struct realloc_call realloc; struct open_call open; struct close_call close; struct pipe_call pipe; struct read_call read; struct write_call write; struct fcntl_call fcntl; struct mmap_call mmap; struct lseek_call lseek; } u; }; /* This defines struct tlist_calls. */ TLIST_TYPE(calls, struct failtest_call); enum failtest_result { /* Yes try failing this call. */ FAIL_OK, /* No, don't try failing this call. */ FAIL_DONT_FAIL, /* Try failing this call but don't go too far down that path. */ FAIL_PROBE, }; /** * failtest_hook - whether a certain call should fail or not. * @history: the ordered history of all failtest calls. * * The default value of this hook is failtest_default_hook(), which returns * FAIL_OK (ie. yes, fail the call). * * You can override it, and avoid failing certain calls. The parameters * of the call (but not the return value(s)) will be filled in for the last * call. * * Example: * static enum failtest_result dont_fail_alloc(struct tlist_calls *history) * { * struct failtest_call *call; * call = tlist_tail(history, list); * if (call->type == FAILTEST_MALLOC * || call->type == FAILTEST_CALLOC * || call->type == FAILTEST_REALLOC) * return FAIL_DONT_FAIL; * return FAIL_OK; * } * ... * failtest_hook = dont_fail_alloc; */ extern enum failtest_result (*failtest_hook)(struct tlist_calls *history); /** * failtest_exit_check - hook for additional checks on a failed child. * @history: the ordered history of all failtest calls. * * Your program might have additional checks to do on failure, such as * check that a file is not corrupted, or than an error message has been * logged. * * If this returns false, the path to this failure will be printed and the * overall test will fail. */ extern bool (*failtest_exit_check)(struct tlist_calls *history); /** * failtest_has_failed - determine if a failure has occurred. * * Sometimes you want to exit immediately if you've experienced an * injected failure. This is useful when you have four separate tests * in your test suite, and you don't want to do the next one if you've * had a failure in a previous one. */ extern bool failtest_has_failed(void); /** * failtest_timeout_ms - how long to wait before killing child. * * Default is 20,000 (20 seconds). */ extern unsigned int failtest_timeout_ms; #endif /* CCAN_FAILTEST_H */ sbsigntool-0.6/lib/ccan/ccan/failtest/failtest_proto.h0000664000175000017500000000313012032345554020065 00000000000000/* Licensed under LGPL - see LICENSE file for details */ #ifndef CCAN_FAILTEST_PROTO_H #define CCAN_FAILTEST_PROTO_H #include /* Potentially-failing versions of routines; #defined in failtest.h */ void *failtest_calloc(size_t nmemb, size_t size, const char *file, unsigned line); void *failtest_malloc(size_t size, const char *file, unsigned line); void *failtest_realloc(void *ptr, size_t size, const char *file, unsigned line); void failtest_free(void *ptr); int failtest_open(const char *pathname, const char *file, unsigned line, ...); int failtest_pipe(int pipefd[2], const char *file, unsigned line); ssize_t failtest_read(int fd, void *buf, size_t count, const char *file, unsigned line); ssize_t failtest_write(int fd, const void *buf, size_t count, const char *file, unsigned line); ssize_t failtest_pread(int fd, void *buf, size_t count, off_t offset, const char *file, unsigned line); ssize_t failtest_pwrite(int fd, const void *buf, size_t count, off_t offset, const char *file, unsigned line); void *failtest_mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset, const char *file, unsigned line); void *failtest_mmap_noloc(void *addr, size_t length, int prot, int flags, int fd, off_t offset); off_t failtest_lseek(int fd, off_t offset, int whence, const char *file, unsigned line); int failtest_close(int fd, const char *file, unsigned line); int failtest_fcntl(int fd, const char *file, unsigned line, int cmd, ...); pid_t failtest_getpid(const char *file, unsigned line); #endif /* CCAN_FAILTEST_PROTO_H */ sbsigntool-0.6/lib/ccan/ccan/talloc/0000775000175000017500000000000012035660722014404 500000000000000sbsigntool-0.6/lib/ccan/ccan/talloc/talloc.c0000664000175000017500000010636512032345554015761 00000000000000/* Samba Unix SMB/CIFS implementation. Samba trivial allocation library - new interface NOTE: Please read talloc_guide.txt for full documentation Copyright (C) Andrew Tridgell 2004 Copyright (C) Stefan Metzmacher 2006 ** NOTE! The following LGPL license applies to the talloc ** library. This does NOT imply that all of Samba is released ** under the LGPL This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* inspired by http://swapped.cc/halloc/ */ #include "talloc.h" #include #include #include #include #include /* use this to force every realloc to change the pointer, to stress test code that might not cope */ #define ALWAYS_REALLOC 0 #define MAX_TALLOC_SIZE 0x7FFFFFFF #define TALLOC_MAGIC 0xe814ec70 #define TALLOC_FLAG_FREE 0x01 #define TALLOC_FLAG_LOOP 0x02 #define TALLOC_FLAG_EXT_ALLOC 0x04 #define TALLOC_MAGIC_REFERENCE ((const char *)1) /* by default we abort when given a bad pointer (such as when talloc_free() is called on a pointer that came from malloc() */ #ifndef TALLOC_ABORT #define TALLOC_ABORT(reason) abort() #endif #ifndef discard_const_p #if defined(INTPTR_MIN) # define discard_const_p(type, ptr) ((type *)((intptr_t)(ptr))) #else # define discard_const_p(type, ptr) ((type *)(ptr)) #endif #endif /* these macros gain us a few percent of speed on gcc */ #if HAVE_BUILTIN_EXPECT /* the strange !! is to ensure that __builtin_expect() takes either 0 or 1 as its first argument */ #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else #define likely(x) x #define unlikely(x) x #endif /* this null_context is only used if talloc_enable_leak_report() or talloc_enable_leak_report_full() is called, otherwise it remains NULL */ static void *null_context; static pid_t *autofree_context; static void *(*tc_malloc)(size_t size) = malloc; static void (*tc_free)(void *ptr) = free; static void *(*tc_realloc)(void *ptr, size_t size) = realloc; static void *(*tc_external_realloc)(const void *parent, void *ptr, size_t size); static void (*tc_lock)(const void *ctx); static void (*tc_unlock)(void); struct talloc_reference_handle { struct talloc_reference_handle *next, *prev; void *ptr; }; typedef int (*talloc_destructor_t)(void *); struct talloc_chunk { struct talloc_chunk *next, *prev; struct talloc_chunk *parent, *child; struct talloc_reference_handle *refs; talloc_destructor_t destructor; const char *name; size_t size; unsigned flags; }; /* 16 byte alignment seems to keep everyone happy */ #define TC_HDR_SIZE ((sizeof(struct talloc_chunk)+15)&~15) #define TC_PTR_FROM_CHUNK(tc) ((void *)(TC_HDR_SIZE + (char*)tc)) /* panic if we get a bad magic value */ static inline struct talloc_chunk *talloc_chunk_from_ptr(const void *ptr) { const char *pp = (const char *)ptr; struct talloc_chunk *tc = discard_const_p(struct talloc_chunk, pp - TC_HDR_SIZE); if (unlikely((tc->flags & (TALLOC_FLAG_FREE | ~0xF)) != TALLOC_MAGIC)) { if (tc->flags & TALLOC_FLAG_FREE) { TALLOC_ABORT("Bad talloc magic value - double free"); } else { TALLOC_ABORT("Bad talloc magic value - unknown value"); } } return tc; } /* hook into the front of the list */ #define _TLIST_ADD(list, p) \ do { \ if (!(list)) { \ (list) = (p); \ (p)->next = (p)->prev = NULL; \ } else { \ (list)->prev = (p); \ (p)->next = (list); \ (p)->prev = NULL; \ (list) = (p); \ }\ } while (0) /* remove an element from a list - element doesn't have to be in list. */ #define _TLIST_REMOVE(list, p) \ do { \ if ((p) == (list)) { \ (list) = (p)->next; \ if (list) (list)->prev = NULL; \ } else { \ if ((p)->prev) (p)->prev->next = (p)->next; \ if ((p)->next) (p)->next->prev = (p)->prev; \ } \ if ((p) && ((p) != (list))) (p)->next = (p)->prev = NULL; \ } while (0) static int locked; static inline void lock(const void *p) { if (tc_lock && p) { struct talloc_chunk *tc = talloc_chunk_from_ptr(p); if (tc->flags & TALLOC_FLAG_EXT_ALLOC) { if (locked) TALLOC_ABORT("nested locking"); tc_lock(tc); locked = 1; } } } static inline void unlock(void) { if (locked) { tc_unlock(); locked = 0; } } /* return the parent chunk of a pointer */ static inline struct talloc_chunk *talloc_parent_chunk(const void *ptr) { struct talloc_chunk *tc; if (unlikely(ptr == NULL)) { return NULL; } tc = talloc_chunk_from_ptr(ptr); while (tc->prev) tc=tc->prev; return tc->parent; } /* This version doesn't do locking, so you must already have it. */ static void *talloc_parent_nolock(const void *ptr) { struct talloc_chunk *tc; tc = talloc_parent_chunk(ptr); return tc ? TC_PTR_FROM_CHUNK(tc) : NULL; } void *talloc_parent(const void *ptr) { void *parent; lock(ptr); parent = talloc_parent_nolock(ptr); unlock(); return parent; } /* find parents name */ const char *talloc_parent_name(const void *ptr) { struct talloc_chunk *tc; lock(ptr); tc = talloc_parent_chunk(ptr); unlock(); return tc? tc->name : NULL; } static void *init_talloc(struct talloc_chunk *parent, struct talloc_chunk *tc, size_t size, int external) { if (unlikely(tc == NULL)) return NULL; tc->size = size; tc->flags = TALLOC_MAGIC; if (external) tc->flags |= TALLOC_FLAG_EXT_ALLOC; tc->destructor = NULL; tc->child = NULL; tc->name = NULL; tc->refs = NULL; if (likely(parent)) { if (parent->child) { parent->child->parent = NULL; tc->next = parent->child; tc->next->prev = tc; } else { tc->next = NULL; } tc->parent = parent; tc->prev = NULL; parent->child = tc; } else { tc->next = tc->prev = tc->parent = NULL; } return TC_PTR_FROM_CHUNK(tc); } /* Allocate a bit of memory as a child of an existing pointer */ static inline void *__talloc(const void *context, size_t size) { struct talloc_chunk *tc; struct talloc_chunk *parent = NULL; int external = 0; if (unlikely(context == NULL)) { context = null_context; } if (unlikely(size >= MAX_TALLOC_SIZE)) { return NULL; } if (likely(context)) { parent = talloc_chunk_from_ptr(context); if (unlikely(parent->flags & TALLOC_FLAG_EXT_ALLOC)) { tc = tc_external_realloc(context, NULL, TC_HDR_SIZE+size); external = 1; goto alloc_done; } } tc = (struct talloc_chunk *)tc_malloc(TC_HDR_SIZE+size); alloc_done: return init_talloc(parent, tc, size, external); } /* setup a destructor to be called on free of a pointer the destructor should return 0 on success, or -1 on failure. if the destructor fails then the free is failed, and the memory can be continued to be used */ void _talloc_set_destructor(const void *ptr, int (*destructor)(void *)) { struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr); tc->destructor = destructor; } /* increase the reference count on a piece of memory. */ int talloc_increase_ref_count(const void *ptr) { if (unlikely(!talloc_reference(null_context, ptr))) { return -1; } return 0; } /* helper for talloc_reference() this is referenced by a function pointer and should not be inline */ static int talloc_reference_destructor(struct talloc_reference_handle *handle) { struct talloc_chunk *ptr_tc = talloc_chunk_from_ptr(handle->ptr); _TLIST_REMOVE(ptr_tc->refs, handle); return 0; } /* more efficient way to add a name to a pointer - the name must point to a true string constant */ static inline void _talloc_set_name_const(const void *ptr, const char *name) { struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr); tc->name = name; } /* internal talloc_named_const() */ static inline void *_talloc_named_const(const void *context, size_t size, const char *name) { void *ptr; ptr = __talloc(context, size); if (unlikely(ptr == NULL)) { return NULL; } _talloc_set_name_const(ptr, name); return ptr; } /* make a secondary reference to a pointer, hanging off the given context. the pointer remains valid until both the original caller and this given context are freed. the major use for this is when two different structures need to reference the same underlying data, and you want to be able to free the two instances separately, and in either order */ void *_talloc_reference(const void *context, const void *ptr) { struct talloc_chunk *tc; struct talloc_reference_handle *handle; if (unlikely(ptr == NULL)) return NULL; lock(context); tc = talloc_chunk_from_ptr(ptr); handle = (struct talloc_reference_handle *)_talloc_named_const(context, sizeof(struct talloc_reference_handle), TALLOC_MAGIC_REFERENCE); if (unlikely(handle == NULL)) { unlock(); return NULL; } /* note that we hang the destructor off the handle, not the main context as that allows the caller to still setup their own destructor on the context if they want to */ talloc_set_destructor(handle, talloc_reference_destructor); handle->ptr = discard_const_p(void, ptr); _TLIST_ADD(tc->refs, handle); unlock(); return handle->ptr; } /* return 1 if ptr is a parent of context */ static int _talloc_is_parent(const void *context, const void *ptr) { struct talloc_chunk *tc; if (context == NULL) { return 0; } tc = talloc_chunk_from_ptr(context); while (tc) { if (TC_PTR_FROM_CHUNK(tc) == ptr) { return 1; } while (tc && tc->prev) tc = tc->prev; if (tc) { tc = tc->parent; } } return 0; } /* move a lump of memory from one talloc context to another return the ptr on success, or NULL if it could not be transferred. passing NULL as ptr will always return NULL with no side effects. */ static void *__talloc_steal(const void *new_ctx, const void *ptr) { struct talloc_chunk *tc, *new_tc; if (unlikely(!ptr)) { return NULL; } if (unlikely(new_ctx == NULL)) { new_ctx = null_context; } tc = talloc_chunk_from_ptr(ptr); if (unlikely(new_ctx == NULL)) { if (tc->parent) { _TLIST_REMOVE(tc->parent->child, tc); if (tc->parent->child) { tc->parent->child->parent = tc->parent; } } else { if (tc->prev) tc->prev->next = tc->next; if (tc->next) tc->next->prev = tc->prev; } tc->parent = tc->next = tc->prev = NULL; return discard_const_p(void, ptr); } new_tc = talloc_chunk_from_ptr(new_ctx); if (unlikely(tc == new_tc || tc->parent == new_tc)) { return discard_const_p(void, ptr); } if (tc->parent) { _TLIST_REMOVE(tc->parent->child, tc); if (tc->parent->child) { tc->parent->child->parent = tc->parent; } } else { if (tc->prev) tc->prev->next = tc->next; if (tc->next) tc->next->prev = tc->prev; } tc->parent = new_tc; if (new_tc->child) new_tc->child->parent = NULL; _TLIST_ADD(new_tc->child, tc); return discard_const_p(void, ptr); } /* internal talloc_free call */ static inline int _talloc_free(const void *ptr) { struct talloc_chunk *tc; void *oldparent = NULL; if (unlikely(ptr == NULL)) { return -1; } tc = talloc_chunk_from_ptr(ptr); if (unlikely(tc->refs)) { int is_child; /* check this is a reference from a child or grantchild * back to it's parent or grantparent * * in that case we need to remove the reference and * call another instance of talloc_free() on the current * pointer. */ is_child = _talloc_is_parent(tc->refs, ptr); _talloc_free(tc->refs); if (is_child) { return _talloc_free(ptr); } return -1; } if (unlikely(tc->flags & TALLOC_FLAG_LOOP)) { /* we have a free loop - stop looping */ return 0; } if (unlikely(tc->destructor)) { talloc_destructor_t d = tc->destructor; if (d == (talloc_destructor_t)-1) { return -1; } tc->destructor = (talloc_destructor_t)-1; if (d(discard_const_p(void, ptr)) == -1) { tc->destructor = d; return -1; } tc->destructor = NULL; } if (unlikely(tc->flags & TALLOC_FLAG_EXT_ALLOC)) oldparent = talloc_parent_nolock(ptr); if (tc->parent) { _TLIST_REMOVE(tc->parent->child, tc); if (tc->parent->child) { tc->parent->child->parent = tc->parent; } } else { if (tc->prev) tc->prev->next = tc->next; if (tc->next) tc->next->prev = tc->prev; } tc->flags |= TALLOC_FLAG_LOOP; while (tc->child) { /* we need to work out who will own an abandoned child if it cannot be freed. In priority order, the first choice is owner of any remaining reference to this pointer, the second choice is our parent, and the final choice is the null context. */ void *child = TC_PTR_FROM_CHUNK(tc->child); const void *new_parent = null_context; struct talloc_chunk *old_parent = NULL; if (unlikely(tc->child->refs)) { struct talloc_chunk *p = talloc_parent_chunk(tc->child->refs); if (p) new_parent = TC_PTR_FROM_CHUNK(p); } /* finding the parent here is potentially quite expensive, but the alternative, which is to change talloc to always have a valid tc->parent pointer, makes realloc more expensive where there are a large number of children. The reason we need the parent pointer here is that if _talloc_free_internal() fails due to references or a failing destructor we need to re-parent, but the free call can invalidate the prev pointer. */ if (new_parent == null_context && (tc->child->refs || tc->child->destructor)) { old_parent = talloc_parent_chunk(ptr); } if (unlikely(_talloc_free(child) == -1)) { if (new_parent == null_context) { struct talloc_chunk *p = old_parent; if (p) new_parent = TC_PTR_FROM_CHUNK(p); } __talloc_steal(new_parent, child); } } tc->flags |= TALLOC_FLAG_FREE; if (unlikely(tc->flags & TALLOC_FLAG_EXT_ALLOC)) tc_external_realloc(oldparent, tc, 0); else tc_free(tc); return 0; } void *_talloc_steal(const void *new_ctx, const void *ptr) { void *p; lock(new_ctx); p = __talloc_steal(new_ctx, ptr); unlock(); return p; } /* remove a secondary reference to a pointer. This undo's what talloc_reference() has done. The context and pointer arguments must match those given to a talloc_reference() */ static inline int talloc_unreference(const void *context, const void *ptr) { struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr); struct talloc_reference_handle *h; if (unlikely(context == NULL)) { context = null_context; } for (h=tc->refs;h;h=h->next) { struct talloc_chunk *p = talloc_parent_chunk(h); if (p == NULL) { if (context == NULL) break; } else if (TC_PTR_FROM_CHUNK(p) == context) { break; } } if (h == NULL) { return -1; } return _talloc_free(h); } /* remove a specific parent context from a pointer. This is a more controlled varient of talloc_free() */ int talloc_unlink(const void *context, void *ptr) { struct talloc_chunk *tc_p, *new_p; void *new_parent; if (ptr == NULL) { return -1; } if (context == NULL) { context = null_context; } lock(context); if (talloc_unreference(context, ptr) == 0) { unlock(); return 0; } if (context == NULL) { if (talloc_parent_chunk(ptr) != NULL) { unlock(); return -1; } } else { if (talloc_chunk_from_ptr(context) != talloc_parent_chunk(ptr)) { unlock(); return -1; } } tc_p = talloc_chunk_from_ptr(ptr); if (tc_p->refs == NULL) { int ret = _talloc_free(ptr); unlock(); return ret; } new_p = talloc_parent_chunk(tc_p->refs); if (new_p) { new_parent = TC_PTR_FROM_CHUNK(new_p); } else { new_parent = NULL; } if (talloc_unreference(new_parent, ptr) != 0) { unlock(); return -1; } __talloc_steal(new_parent, ptr); unlock(); return 0; } /* add a name to an existing pointer - va_list version */ static inline const char *talloc_set_name_v(const void *ptr, const char *fmt, va_list ap) PRINTF_FMT(2,0); static inline const char *talloc_set_name_v(const void *ptr, const char *fmt, va_list ap) { struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr); tc->name = talloc_vasprintf(ptr, fmt, ap); if (likely(tc->name)) { _talloc_set_name_const(tc->name, ".name"); } return tc->name; } /* add a name to an existing pointer */ const char *talloc_set_name(const void *ptr, const char *fmt, ...) { const char *name; va_list ap; va_start(ap, fmt); name = talloc_set_name_v(ptr, fmt, ap); va_end(ap); return name; } /* create a named talloc pointer. Any talloc pointer can be named, and talloc_named() operates just like talloc() except that it allows you to name the pointer. */ void *talloc_named(const void *context, size_t size, const char *fmt, ...) { va_list ap; void *ptr; const char *name; lock(context); ptr = __talloc(context, size); unlock(); if (unlikely(ptr == NULL)) return NULL; va_start(ap, fmt); name = talloc_set_name_v(ptr, fmt, ap); va_end(ap); if (unlikely(name == NULL)) { talloc_free(ptr); return NULL; } return ptr; } /* return the name of a talloc ptr, or "UNNAMED" */ const char *talloc_get_name(const void *ptr) { struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr); if (unlikely(tc->name == TALLOC_MAGIC_REFERENCE)) { return ".reference"; } if (likely(tc->name)) { return tc->name; } return "UNNAMED"; } /* check if a pointer has the given name. If it does, return the pointer, otherwise return NULL */ void *talloc_check_name(const void *ptr, const char *name) { const char *pname; if (unlikely(ptr == NULL)) return NULL; pname = talloc_get_name(ptr); if (likely(pname == name || strcmp(pname, name) == 0)) { return discard_const_p(void, ptr); } return NULL; } /* this is for compatibility with older versions of talloc */ void *talloc_init(const char *fmt, ...) { va_list ap; void *ptr; const char *name; /* * samba3 expects talloc_report_depth_cb(NULL, ...) * reports all talloc'ed memory, so we need to enable * null_tracking */ talloc_enable_null_tracking(); ptr = __talloc(NULL, 0); if (unlikely(ptr == NULL)) return NULL; va_start(ap, fmt); name = talloc_set_name_v(ptr, fmt, ap); va_end(ap); if (unlikely(name == NULL)) { talloc_free(ptr); return NULL; } return ptr; } /* Allocate a bit of memory as a child of an existing pointer */ void *_talloc(const void *context, size_t size) { return __talloc(context, size); } static int talloc_destroy_pointer(void ***pptr) { if ((uintptr_t)**pptr < getpagesize()) TALLOC_ABORT("Double free or invalid talloc_set?"); /* Invalidate pointer so it can't be used again. */ **pptr = (void *)1; return 0; } void _talloc_set(void *ptr, const void *ctx, size_t size, const char *name) { void ***child; void *p; p = talloc_named_const(ctx, size, name); if (unlikely(!p)) goto set_ptr; child = talloc(p, void **); if (unlikely(!child)) { talloc_free(p); p = NULL; goto set_ptr; } *child = ptr; talloc_set_name_const(child, "talloc_set destructor"); talloc_set_destructor(child, talloc_destroy_pointer); set_ptr: /* memcpy rather than cast avoids aliasing problems. */ memcpy(ptr, &p, sizeof(p)); } /* externally callable talloc_set_name_const() */ void talloc_set_name_const(const void *ptr, const char *name) { _talloc_set_name_const(ptr, name); } /* create a named talloc pointer. Any talloc pointer can be named, and talloc_named() operates just like talloc() except that it allows you to name the pointer. */ void *talloc_named_const(const void *context, size_t size, const char *name) { void *p; lock(context); p = _talloc_named_const(context, size, name); unlock(); return p; } /* free a talloc pointer. This also frees all child pointers of this pointer recursively return 0 if the memory is actually freed, otherwise -1. The memory will not be freed if the ref_count is > 1 or the destructor (if any) returns non-zero */ int talloc_free(const void *ptr) { int saved_errno = errno, ret; lock(ptr); ret = _talloc_free(discard_const_p(void, ptr)); unlock(); if (ret == 0) errno = saved_errno; return ret; } /* A talloc version of realloc. The context argument is only used if ptr is NULL */ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *name) { struct talloc_chunk *tc; void *new_ptr; /* size zero is equivalent to free() */ if (unlikely(size == 0)) { talloc_free(ptr); return NULL; } if (unlikely(size >= MAX_TALLOC_SIZE)) { return NULL; } /* realloc(NULL) is equivalent to malloc() */ if (ptr == NULL) { return talloc_named_const(context, size, name); } tc = talloc_chunk_from_ptr(ptr); /* don't allow realloc on referenced pointers */ if (unlikely(tc->refs)) { return NULL; } lock(ptr); if (unlikely(tc->flags & TALLOC_FLAG_EXT_ALLOC)) { /* need to get parent before setting free flag. */ void *parent = talloc_parent_nolock(ptr); tc->flags |= TALLOC_FLAG_FREE; new_ptr = tc_external_realloc(parent, tc, size + TC_HDR_SIZE); } else { /* by resetting magic we catch users of the old memory */ tc->flags |= TALLOC_FLAG_FREE; #if ALWAYS_REALLOC new_ptr = tc_malloc(size + TC_HDR_SIZE); if (new_ptr) { memcpy(new_ptr, tc, tc->size + TC_HDR_SIZE); tc_free(tc); } #else new_ptr = tc_realloc(tc, size + TC_HDR_SIZE); #endif } if (unlikely(!new_ptr)) { tc->flags &= ~TALLOC_FLAG_FREE; unlock(); return NULL; } tc = (struct talloc_chunk *)new_ptr; tc->flags &= ~TALLOC_FLAG_FREE; if (tc->parent) { tc->parent->child = tc; } if (tc->child) { tc->child->parent = tc; } if (tc->prev) { tc->prev->next = tc; } if (tc->next) { tc->next->prev = tc; } tc->size = size; _talloc_set_name_const(TC_PTR_FROM_CHUNK(tc), name); unlock(); return TC_PTR_FROM_CHUNK(tc); } /* a wrapper around talloc_steal() for situations where you are moving a pointer between two structures, and want the old pointer to be set to NULL */ void *_talloc_move(const void *new_ctx, const void *_pptr) { const void **pptr = discard_const_p(const void *,_pptr); void *ret = _talloc_steal(new_ctx, *pptr); (*pptr) = NULL; return ret; } /* return the total size of a talloc pool (subtree) */ static size_t _talloc_total_size(const void *ptr) { size_t total = 0; struct talloc_chunk *c, *tc; tc = talloc_chunk_from_ptr(ptr); if (tc->flags & TALLOC_FLAG_LOOP) { return 0; } tc->flags |= TALLOC_FLAG_LOOP; total = tc->size; for (c=tc->child;c;c=c->next) { total += _talloc_total_size(TC_PTR_FROM_CHUNK(c)); } tc->flags &= ~TALLOC_FLAG_LOOP; return total; } size_t talloc_total_size(const void *ptr) { size_t total; if (ptr == NULL) { ptr = null_context; } if (ptr == NULL) { return 0; } lock(ptr); total = _talloc_total_size(ptr); unlock(); return total; } /* return the total number of blocks in a talloc pool (subtree) */ static size_t _talloc_total_blocks(const void *ptr) { size_t total = 0; struct talloc_chunk *c, *tc = talloc_chunk_from_ptr(ptr); if (tc->flags & TALLOC_FLAG_LOOP) { return 0; } tc->flags |= TALLOC_FLAG_LOOP; total++; for (c=tc->child;c;c=c->next) { total += _talloc_total_blocks(TC_PTR_FROM_CHUNK(c)); } tc->flags &= ~TALLOC_FLAG_LOOP; return total; } size_t talloc_total_blocks(const void *ptr) { size_t total; lock(ptr); total = _talloc_total_blocks(ptr); unlock(); return total; } static size_t _talloc_reference_count(const void *ptr) { struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr); struct talloc_reference_handle *h; size_t ret = 0; for (h=tc->refs;h;h=h->next) { ret++; } return ret; } /* return the number of external references to a pointer */ size_t talloc_reference_count(const void *ptr) { size_t ret; lock(talloc_chunk_from_ptr(ptr)); ret = _talloc_reference_count(ptr); unlock(); return ret; } /* report on memory usage by all children of a pointer, giving a full tree view */ static void _talloc_report_depth_cb(const void *ptr, int depth, int max_depth, void (*callback)(const void *ptr, int depth, int max_depth, int is_ref, void *private_data), void *private_data) { struct talloc_chunk *c, *tc; tc = talloc_chunk_from_ptr(ptr); if (tc->flags & TALLOC_FLAG_LOOP) { return; } callback(ptr, depth, max_depth, 0, private_data); if (max_depth >= 0 && depth >= max_depth) { return; } tc->flags |= TALLOC_FLAG_LOOP; for (c=tc->child;c;c=c->next) { if (c->name == TALLOC_MAGIC_REFERENCE) { struct talloc_reference_handle *h = (struct talloc_reference_handle *)TC_PTR_FROM_CHUNK(c); callback(h->ptr, depth + 1, max_depth, 1, private_data); } else { _talloc_report_depth_cb(TC_PTR_FROM_CHUNK(c), depth + 1, max_depth, callback, private_data); } } tc->flags &= ~TALLOC_FLAG_LOOP; } void talloc_report_depth_cb(const void *ptr, int depth, int max_depth, void (*callback)(const void *ptr, int depth, int max_depth, int is_ref, void *private_data), void *private_data) { if (ptr == NULL) { ptr = null_context; } if (ptr == NULL) return; lock(ptr); _talloc_report_depth_cb(ptr, depth, max_depth, callback, private_data); unlock(); } static void talloc_report_depth_FILE_helper(const void *ptr, int depth, int max_depth, int is_ref, void *_f) { const char *name = talloc_get_name(ptr); FILE *f = (FILE *)_f; if (is_ref) { fprintf(f, "%*sreference to: %s\n", depth*4, "", name); return; } if (depth == 0) { fprintf(f,"%stalloc report on '%s' (total %6lu bytes in %3lu blocks)\n", (max_depth < 0 ? "full " :""), name, (unsigned long)_talloc_total_size(ptr), (unsigned long)_talloc_total_blocks(ptr)); return; } fprintf(f, "%*s%-30s contains %6lu bytes in %3lu blocks (ref %d) %p\n", depth*4, "", name, (unsigned long)_talloc_total_size(ptr), (unsigned long)_talloc_total_blocks(ptr), (int)_talloc_reference_count(ptr), ptr); #if 0 fprintf(f, "content: "); if (talloc_total_size(ptr)) { int tot = talloc_total_size(ptr); int i; for (i = 0; i < tot; i++) { if ((((char *)ptr)[i] > 31) && (((char *)ptr)[i] < 126)) { fprintf(f, "%c", ((char *)ptr)[i]); } else { fprintf(f, "~%02x", ((char *)ptr)[i]); } } } fprintf(f, "\n"); #endif } /* report on memory usage by all children of a pointer, giving a full tree view */ void talloc_report_depth_file(const void *ptr, int depth, int max_depth, FILE *f) { talloc_report_depth_cb(ptr, depth, max_depth, talloc_report_depth_FILE_helper, f); fflush(f); } /* report on memory usage by all children of a pointer, giving a full tree view */ void talloc_report_full(const void *ptr, FILE *f) { talloc_report_depth_file(ptr, 0, -1, f); } /* report on memory usage by all children of a pointer */ void talloc_report(const void *ptr, FILE *f) { talloc_report_depth_file(ptr, 0, 1, f); } /* report on any memory hanging off the null context */ static void talloc_report_null(void) { if (talloc_total_size(null_context) != 0) { talloc_report(null_context, stderr); } } /* report on any memory hanging off the null context */ static void talloc_report_null_full(void) { if (talloc_total_size(null_context) != 0) { talloc_report_full(null_context, stderr); } } /* enable tracking of the NULL context */ void talloc_enable_null_tracking(void) { if (null_context == NULL) { null_context = _talloc_named_const(NULL, 0, "null_context"); } } /* disable tracking of the NULL context */ void talloc_disable_null_tracking(void) { _talloc_free(null_context); null_context = NULL; } /* enable leak reporting on exit */ void talloc_enable_leak_report(void) { talloc_enable_null_tracking(); atexit(talloc_report_null); } /* enable full leak reporting on exit */ void talloc_enable_leak_report_full(void) { talloc_enable_null_tracking(); atexit(talloc_report_null_full); } /* talloc and zero memory. */ void *_talloc_zero(const void *ctx, size_t size, const char *name) { void *p; lock(ctx); p = _talloc_named_const(ctx, size, name); unlock(); if (p) { memset(p, '\0', size); } return p; } /* memdup with a talloc. */ void *_talloc_memdup(const void *t, const void *p, size_t size, const char *name) { void *newp; lock(t); newp = _talloc_named_const(t, size, name); unlock(); if (likely(newp)) { memcpy(newp, p, size); } return newp; } /* strdup with a talloc */ char *talloc_strdup(const void *t, const char *p) { char *ret; if (!p) { return NULL; } ret = (char *)talloc_memdup(t, p, strlen(p) + 1); if (likely(ret)) { _talloc_set_name_const(ret, ret); } return ret; } /* append to a talloced string */ char *talloc_append_string(char *orig, const char *append) { char *ret; size_t olen = strlen(orig); size_t alenz; if (!append) return orig; alenz = strlen(append) + 1; ret = talloc_realloc(NULL, orig, char, olen + alenz); if (!ret) return NULL; /* append the string with the trailing \0 */ memcpy(&ret[olen], append, alenz); _talloc_set_name_const(ret, ret); return ret; } /* strndup with a talloc */ char *talloc_strndup(const void *t, const char *p, size_t n) { size_t len; char *ret; for (len=0; lensize - 1; va_copy(ap2, ap); len = vsnprintf(&c, 1, fmt, ap2); va_end(ap2); if (len <= 0) { /* Either the vsnprintf failed or the format resulted in * no characters being formatted. In the former case, we * ought to return NULL, in the latter we ought to return * the original string. Most current callers of this * function expect it to never return NULL. */ return s; } s = talloc_realloc(NULL, s, char, s_len + len+1); if (!s) return NULL; va_copy(ap2, ap); vsnprintf(s+s_len, len+1, fmt, ap2); va_end(ap2); _talloc_set_name_const(s, s); return s; } /* Realloc @p s to append the formatted result of @p fmt and return @p s, which may have moved. Good for gradually accumulating output into a string buffer. */ char *talloc_asprintf_append(char *s, const char *fmt, ...) { va_list ap; va_start(ap, fmt); s = talloc_vasprintf_append(s, fmt, ap); va_end(ap); return s; } /* alloc an array, checking for integer overflow in the array size */ void *_talloc_array(const void *ctx, size_t el_size, unsigned count, const char *name) { void *p; if (count >= MAX_TALLOC_SIZE/el_size) { return NULL; } lock(ctx); p = _talloc_named_const(ctx, el_size * count, name); unlock(); return p; } /* alloc an zero array, checking for integer overflow in the array size */ void *_talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const char *name) { void *p; if (count >= MAX_TALLOC_SIZE/el_size) { return NULL; } p = _talloc_zero(ctx, el_size * count, name); return p; } /* realloc an array, checking for integer overflow in the array size */ void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name) { if (count >= MAX_TALLOC_SIZE/el_size) { return NULL; } return _talloc_realloc(ctx, ptr, el_size * count, name); } /* a function version of talloc_realloc(), so it can be passed as a function pointer to libraries that want a realloc function (a realloc function encapsulates all the basic capabilities of an allocation library, which is why this is useful) */ void *talloc_realloc_fn(const void *context, void *ptr, size_t size) { return _talloc_realloc(context, ptr, size, NULL); } static int talloc_autofree_destructor(void *ptr) { autofree_context = NULL; return 0; } static void talloc_autofree(void) { if (autofree_context && *autofree_context == getpid()) talloc_free(autofree_context); } /* return a context which will be auto-freed on exit this is useful for reducing the noise in leak reports */ void *talloc_autofree_context(void) { if (autofree_context == NULL || *autofree_context != getpid()) { autofree_context = talloc(NULL, pid_t); *autofree_context = getpid(); talloc_set_name_const(autofree_context, "autofree_context"); talloc_set_destructor(autofree_context, talloc_autofree_destructor); atexit(talloc_autofree); } return autofree_context; } size_t talloc_get_size(const void *context) { struct talloc_chunk *tc; if (context == NULL) return 0; tc = talloc_chunk_from_ptr(context); return tc->size; } /* find a parent of this context that has the given name, if any */ void *talloc_find_parent_byname(const void *context, const char *name) { struct talloc_chunk *tc; if (context == NULL) { return NULL; } lock(context); tc = talloc_chunk_from_ptr(context); while (tc) { if (tc->name && strcmp(tc->name, name) == 0) { unlock(); return TC_PTR_FROM_CHUNK(tc); } while (tc && tc->prev) tc = tc->prev; if (tc) { tc = tc->parent; } } unlock(); return NULL; } /* show the parentage of a context */ void talloc_show_parents(const void *context, FILE *file) { struct talloc_chunk *tc; if (context == NULL) { fprintf(file, "talloc no parents for NULL\n"); return; } lock(context); tc = talloc_chunk_from_ptr(context); fprintf(file, "talloc parents of '%s'\n", talloc_get_name(context)); while (tc) { fprintf(file, "\t'%s'\n", talloc_get_name(TC_PTR_FROM_CHUNK(tc))); while (tc && tc->prev) tc = tc->prev; if (tc) { tc = tc->parent; } } unlock(); fflush(file); } int talloc_is_parent(const void *context, const void *ptr) { int ret; lock(context); ret = _talloc_is_parent(context, ptr); unlock(); return ret; } void talloc_set_allocator(void *(*malloc)(size_t size), void (*free)(void *ptr), void *(*realloc)(void *ptr, size_t size)) { tc_malloc = malloc; tc_free = free; tc_realloc = realloc; } void *talloc_add_external(const void *ctx, void *(*realloc)(const void *, void *, size_t), void (*lock)(const void *p), void (*unlock)(void)) { struct talloc_chunk *tc, *parent; void *p; if (tc_external_realloc && tc_external_realloc != realloc) TALLOC_ABORT("talloc_add_external realloc replaced"); tc_external_realloc = realloc; if (unlikely(ctx == NULL)) { ctx = null_context; parent = NULL; } else parent = talloc_chunk_from_ptr(ctx); tc = tc_external_realloc(ctx, NULL, TC_HDR_SIZE); p = init_talloc(parent, tc, 0, 1); tc_lock = lock; tc_unlock = unlock; return p; } sbsigntool-0.6/lib/ccan/ccan/talloc/talloc.h0000664000175000017500000011054112032345554015755 00000000000000#ifndef CCAN_TALLOC_H #define CCAN_TALLOC_H /* Copyright (C) Andrew Tridgell 2004-2005 Copyright (C) Stefan Metzmacher 2006 ** NOTE! The following LGPL license applies to the talloc ** library. This does NOT imply that all of Samba is released ** under the LGPL This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include "config.h" /* this uses a little trick to allow __LINE__ to be stringified */ #ifndef __location__ #define __TALLOC_STRING_LINE1__(s) #s #define __TALLOC_STRING_LINE2__(s) __TALLOC_STRING_LINE1__(s) #define __TALLOC_STRING_LINE3__ __TALLOC_STRING_LINE2__(__LINE__) #define __location__ __FILE__ ":" __TALLOC_STRING_LINE3__ #endif /* try to make talloc_set_destructor() and talloc_steal() type safe, if we have a recent gcc */ #if HAVE_TYPEOF #define _TALLOC_TYPEOF(ptr) __typeof__(ptr) #else #define _TALLOC_TYPEOF(ptr) void * #endif #define talloc_move(ctx, ptr) (_TALLOC_TYPEOF(*(ptr)))_talloc_move((ctx),(void *)(ptr)) /** * talloc - allocate dynamic memory for a type * @ctx: context to be parent of this allocation, or NULL. * @type: the type to be allocated. * * The talloc() macro is the core of the talloc library. It takes a memory * context and a type, and returns a pointer to a new area of memory of the * given type. * * The returned pointer is itself a talloc context, so you can use it as the * context argument to more calls to talloc if you wish. * * The returned pointer is a "child" of @ctx. This means that if you * talloc_free() @ctx then the new child disappears as well. Alternatively you * can free just the child. * * @ctx can be NULL, in which case a new top level context is created. * * Example: * unsigned int *a, *b; * a = talloc(NULL, unsigned int); * b = talloc(a, unsigned int); * * See Also: * talloc_zero, talloc_array, talloc_steal, talloc_free. */ #define talloc(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type) /** * TALLOC_CTX - indicate that a pointer is used as a talloc parent. * * As talloc is a hierarchial memory allocator, every talloc chunk is a * potential parent to other talloc chunks. So defining a separate type for a * talloc chunk is not strictly necessary. TALLOC_CTX is defined nevertheless, * as it provides an indicator for function arguments. * * Example: * struct foo { * int val; * }; * * static struct foo *foo_new(TALLOC_CTX *mem_ctx) * { * struct foo *foo = talloc(mem_ctx, struct foo); * if (foo) * foo->val = 0; * return foo; * } */ typedef void TALLOC_CTX; /** * talloc_set - allocate dynamic memory for a type, into a pointer * @ptr: pointer to the pointer to assign. * @ctx: context to be parent of this allocation, or NULL. * * talloc_set() does a talloc, but also adds a destructor which will make the * pointer invalid when it is freed. This can find many use-after-free bugs. * * Note that the destructor is chained off a zero-length allocation, and so * is not affected by talloc_set_destructor(). * * Example: * unsigned int *b, *a; * a = talloc(NULL, unsigned int); * talloc_set(&b, a); * talloc_free(a); * *b = 1; // This will crash! * * See Also: * talloc. */ #define talloc_set(pptr, ctx) \ _talloc_set((pptr), (ctx), sizeof(&**(pptr)), __location__) /** * talloc_free - free talloc'ed memory and its children * @ptr: the talloced pointer to free * * The talloc_free() function frees a piece of talloc memory, and all its * children. You can call talloc_free() on any pointer returned by talloc(). * * The return value of talloc_free() indicates success or failure, with 0 * returned for success and -1 for failure. The only possible failure condition * is if the pointer had a destructor attached to it and the destructor * returned -1. See talloc_set_destructor() for details on destructors. * errno will be preserved unless the talloc_free fails. * * If this pointer has an additional parent when talloc_free() is called then * the memory is not actually released, but instead the most recently * established parent is destroyed. See talloc_reference() for details on * establishing additional parents. * * For more control on which parent is removed, see talloc_unlink(). * * talloc_free() operates recursively on its children. * * Example: * unsigned int *a, *b; * a = talloc(NULL, unsigned int); * b = talloc(a, unsigned int); * // Frees a and b * talloc_free(a); * * See Also: * talloc_set_destructor, talloc_unlink */ int talloc_free(const void *ptr); /** * talloc_set_destructor - set a destructor for when this pointer is freed * @ptr: the talloc pointer to set the destructor on * @destructor: the function to be called * * The function talloc_set_destructor() sets the "destructor" for the pointer * @ptr. A destructor is a function that is called when the memory used by a * pointer is about to be released. The destructor receives the pointer as an * argument, and should return 0 for success and -1 for failure. * * The destructor can do anything it wants to, including freeing other pieces * of memory. A common use for destructors is to clean up operating system * resources (such as open file descriptors) contained in the structure the * destructor is placed on. * * You can only place one destructor on a pointer. If you need more than one * destructor then you can create a zero-length child of the pointer and place * an additional destructor on that. * * To remove a destructor call talloc_set_destructor() with NULL for the * destructor. * * If your destructor attempts to talloc_free() the pointer that it is the * destructor for then talloc_free() will return -1 and the free will be * ignored. This would be a pointless operation anyway, as the destructor is * only called when the memory is just about to go away. * * Example: * static int destroy_fd(int *fd) * { * close(*fd); * return 0; * } * * static int *open_file(const char *filename) * { * int *fd = talloc(NULL, int); * *fd = open(filename, O_RDONLY); * if (*fd < 0) { * talloc_free(fd); * return NULL; * } * // Whenever they free this, we close the file. * talloc_set_destructor(fd, destroy_fd); * return fd; * } * * See Also: * talloc, talloc_free */ #define talloc_set_destructor(ptr, function) \ _talloc_set_destructor((ptr), typesafe_cb(int, void *, (function), (ptr))) /** * talloc_zero - allocate zeroed dynamic memory for a type * @ctx: context to be parent of this allocation, or NULL. * @type: the type to be allocated. * * The talloc_zero() macro is equivalent to: * * ptr = talloc(ctx, type); * if (ptr) memset(ptr, 0, sizeof(type)); * * Example: * unsigned int *a, *b; * a = talloc_zero(NULL, unsigned int); * b = talloc_zero(a, unsigned int); * * See Also: * talloc, talloc_zero_size, talloc_zero_array */ #define talloc_zero(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type) /** * talloc_array - allocate dynamic memory for an array of a given type * @ctx: context to be parent of this allocation, or NULL. * @type: the type to be allocated. * @count: the number of elements to be allocated. * * The talloc_array() macro is a safe way of allocating an array. It is * equivalent to: * * (type *)talloc_size(ctx, sizeof(type) * count); * * except that it provides integer overflow protection for the multiply, * returning NULL if the multiply overflows. * * Example: * unsigned int *a, *b; * a = talloc_zero(NULL, unsigned int); * b = talloc_array(a, unsigned int, 100); * * See Also: * talloc, talloc_zero_array, talloc_array_length */ #define talloc_array(ctx, type, count) (type *)_talloc_array(ctx, sizeof(type), count, #type) /** * talloc_size - allocate a particular size of memory * @ctx: context to be parent of this allocation, or NULL. * @size: the number of bytes to allocate * * The function talloc_size() should be used when you don't have a convenient * type to pass to talloc(). Unlike talloc(), it is not type safe (as it * returns a void *), so you are on your own for type checking. * * Best to use talloc() or talloc_array() instead. * * Example: * void *mem = talloc_size(NULL, 100); * memset(mem, 0xFF, 100); * * See Also: * talloc, talloc_array, talloc_zero_size */ #define talloc_size(ctx, size) talloc_named_const(ctx, size, __location__) #if HAVE_TYPEOF /** * talloc_steal - change/set the parent context of a talloc pointer * @ctx: the new parent * @ptr: the talloc pointer to reparent * * The talloc_steal() function changes the parent context of a talloc * pointer. It is typically used when the context that the pointer is currently * a child of is going to be freed and you wish to keep the memory for a longer * time. * * The talloc_steal() function returns the pointer that you pass it. It does * not have any failure modes. * * NOTE: It is possible to produce loops in the parent/child relationship if * you are not careful with talloc_steal(). No guarantees are provided as to * your sanity or the safety of your data if you do this. * * talloc_steal (new_ctx, NULL) will return NULL with no sideeffects. * * Example: * unsigned int *a, *b; * a = talloc(NULL, unsigned int); * b = talloc(NULL, unsigned int); * // Reparent b to a as if we'd done 'b = talloc(a, unsigned int)'. * talloc_steal(a, b); * * See Also: * talloc_reference */ #define talloc_steal(ctx, ptr) ({ _TALLOC_TYPEOF(ptr) _talloc_steal_ret = (_TALLOC_TYPEOF(ptr))_talloc_steal((ctx),(ptr)); _talloc_steal_ret; }) /* this extremely strange macro is to avoid some braindamaged warning stupidity in gcc 4.1.x */ #else #define talloc_steal(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_steal((ctx),(ptr)) #endif /* HAVE_TYPEOF */ /** * talloc_report_full - report all the memory used by a pointer and children. * @ptr: the context to report on * @f: the file to report to * * Recursively print the entire tree of memory referenced by the * pointer. References in the tree are shown by giving the name of the pointer * that is referenced. * * You can pass NULL for the pointer, in which case a report is printed for the * top level memory context, but only if talloc_enable_null_tracking() has been * called. * * Example: * unsigned int *a, *b; * a = talloc(NULL, unsigned int); * b = talloc(a, unsigned int); * fprintf(stderr, "Dumping memory tree for a:\n"); * talloc_report_full(a, stderr); * * See Also: * talloc_report */ void talloc_report_full(const void *ptr, FILE *f); /** * talloc_reference - add an additional parent to a context * @ctx: the additional parent * @ptr: the talloc pointer * * The talloc_reference() function makes @ctx an additional parent of @ptr. * * The return value of talloc_reference() is always the original pointer @ptr, * unless talloc ran out of memory in creating the reference in which case it * will return NULL (each additional reference consumes around 48 bytes of * memory on intel x86 platforms). * * If @ptr is NULL, then the function is a no-op, and simply returns NULL. * * After creating a reference you can free it in one of the following ways: * * - you can talloc_free() any parent of the original pointer. That will * reduce the number of parents of this pointer by 1, and will cause this * pointer to be freed if it runs out of parents. * * - you can talloc_free() the pointer itself. That will destroy the most * recently established parent to the pointer and leave the pointer as a * child of its current parent. * * For more control on which parent to remove, see talloc_unlink(). * Example: * unsigned int *a, *b, *c; * a = talloc(NULL, unsigned int); * b = talloc(NULL, unsigned int); * c = talloc(a, unsigned int); * // b also serves as a parent of c (don't care about errors) * (void)talloc_reference(b, c); */ #define talloc_reference(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_reference((ctx),(ptr)) /** * talloc_unlink - remove a specific parent from a talloc pointer. * @context: the parent to remove * @ptr: the talloc pointer * * The talloc_unlink() function removes a specific parent from @ptr. The * context passed must either be a context used in talloc_reference() with this * pointer, or must be a direct parent of @ptr. * * Note that if the parent has already been removed using talloc_free() then * this function will fail and will return -1. Likewise, if @ptr is NULL, * then the function will make no modifications and return -1. * * Usually you can just use talloc_free() instead of talloc_unlink(), but * sometimes it is useful to have the additional control on which parent is * removed. * * Example: * unsigned int *a, *b, *c; * a = talloc(NULL, unsigned int); * b = talloc(NULL, unsigned int); * c = talloc(a, unsigned int); * // b also serves as a parent of c. * (void)talloc_reference(b, c); * talloc_unlink(b, c); */ int talloc_unlink(const void *context, void *ptr); /** * talloc_report - print a summary of memory used by a pointer * * The talloc_report() function prints a summary report of all memory * used by @ptr. One line of report is printed for each immediate child of * @ptr, showing the total memory and number of blocks used by that child. * * You can pass NULL for the pointer, in which case a report is printed for the * top level memory context, but only if talloc_enable_null_tracking() has been * called. * * Example: * unsigned int *a, *b; * a = talloc(NULL, unsigned int); * b = talloc(a, unsigned int); * fprintf(stderr, "Summary of memory tree for a:\n"); * talloc_report(a, stderr); * * See Also: * talloc_report_full */ void talloc_report(const void *ptr, FILE *f); /** * talloc_ptrtype - allocate a size of memory suitable for this pointer * @ctx: context to be parent of this allocation, or NULL. * @ptr: the pointer whose type we are to allocate * * The talloc_ptrtype() macro should be used when you have a pointer and * want to allocate memory to point at with this pointer. When compiling * with gcc >= 3 it is typesafe. Note this is a wrapper of talloc_size() * and talloc_get_name() will return the current location in the source file. * and not the type. * * Example: * unsigned int *a = talloc_ptrtype(NULL, a); */ #define talloc_ptrtype(ctx, ptr) (_TALLOC_TYPEOF(ptr))talloc_size(ctx, sizeof(*(ptr))) /** * talloc_new - create a new context * @ctx: the context to use as a parent. * * This is a utility macro that creates a new memory context hanging off an * exiting context, automatically naming it "talloc_new: __location__" where * __location__ is the source line it is called from. It is particularly useful * for creating a new temporary working context. */ #define talloc_new(ctx) talloc_named_const(ctx, 0, "talloc_new: " __location__) /** * talloc_zero_size - allocate a particular size of zeroed memory * * The talloc_zero_size() function is useful when you don't have a known type. */ #define talloc_zero_size(ctx, size) _talloc_zero(ctx, size, __location__) /** * talloc_zero_array - allocate an array of zeroed types * @ctx: context to be parent of this allocation, or NULL. * @type: the type to be allocated. * @count: the number of elements to be allocated. * * Just like talloc_array, but zeroes the memory. */ #define talloc_zero_array(ctx, type, count) (type *)_talloc_zero_array(ctx, sizeof(type), count, #type) /** * talloc_array_size - allocate an array of elements of the given size * @ctx: context to be parent of this allocation, or NULL. * @size: the size of each element * @count: the number of elements to be allocated. * * Typeless form of talloc_array. */ #define talloc_array_size(ctx, size, count) _talloc_array(ctx, size, count, __location__) /** * talloc_array_ptrtype - allocate an array of memory suitable for this pointer * @ctx: context to be parent of this allocation, or NULL. * @ptr: the pointer whose type we are to allocate * @count: the number of elements for the array * * Like talloc_ptrtype(), except it allocates an array. */ #define talloc_array_ptrtype(ctx, ptr, count) (_TALLOC_TYPEOF(ptr))talloc_array_size(ctx, sizeof(*(ptr)), count) /** * talloc_realloc - resize a talloc array * @ctx: the parent to assign (if p is NULL) * @p: the memory to reallocate * @type: the type of the object to allocate * @count: the number of objects to reallocate * * The talloc_realloc() macro changes the size of a talloc pointer. The "count" * argument is the number of elements of type "type" that you want the * resulting pointer to hold. * * talloc_realloc() has the following equivalences: * * talloc_realloc(context, NULL, type, 1) ==> talloc(context, type); * talloc_realloc(context, NULL, type, N) ==> talloc_array(context, type, N); * talloc_realloc(context, ptr, type, 0) ==> talloc_free(ptr); * * The "context" argument is only used if "ptr" is NULL, otherwise it is * ignored. * * talloc_realloc() returns the new pointer, or NULL on failure. The call will * fail either due to a lack of memory, or because the pointer has more than * one parent (see talloc_reference()). */ #define talloc_realloc(ctx, p, type, count) (type *)_talloc_realloc_array(ctx, p, sizeof(type), count, #type) /** * talloc_realloc_size - resize talloc memory * @ctx: the parent to assign (if p is NULL) * @ptr: the memory to reallocate * @size: the new size of memory. * * The talloc_realloc_size() function is useful when the type is not known so * the typesafe talloc_realloc() cannot be used. */ #define talloc_realloc_size(ctx, ptr, size) _talloc_realloc(ctx, ptr, size, __location__) /** * talloc_strdup - duplicate a string * @ctx: the talloc context for the new string * @p: the string to copy * * The talloc_strdup() function is equivalent to: * * ptr = talloc_size(ctx, strlen(p)+1); * if (ptr) memcpy(ptr, p, strlen(p)+1); * * This functions sets the name of the new pointer to the passed string. This * is equivalent to: * * talloc_set_name_const(ptr, ptr) */ char *talloc_strdup(const void *t, const char *p); /** * talloc_strndup - duplicate a limited length of a string * @ctx: the talloc context for the new string * @p: the string to copy * @n: the maximum length of the returned string. * * The talloc_strndup() function is the talloc equivalent of the C library * function strndup(): the result will be truncated to @n characters before * the nul terminator. * * This functions sets the name of the new pointer to the passed string. This * is equivalent to: * * talloc_set_name_const(ptr, ptr) */ char *talloc_strndup(const void *t, const char *p, size_t n); /** * talloc_memdup - duplicate some talloc memory * * The talloc_memdup() function is equivalent to: * * ptr = talloc_size(ctx, size); * if (ptr) memcpy(ptr, p, size); */ #define talloc_memdup(t, p, size) _talloc_memdup(t, p, size, __location__) /** * talloc_asprintf - sprintf into a talloc buffer. * @t: The context to allocate the buffer from * @fmt: printf-style format for the buffer. * * The talloc_asprintf() function is the talloc equivalent of the C library * function asprintf(). * * This functions sets the name of the new pointer to the new string. This is * equivalent to: * * talloc_set_name_const(ptr, ptr) */ char *talloc_asprintf(const void *t, const char *fmt, ...) PRINTF_FMT(2,3); /** * talloc_append_string - concatenate onto a tallocated string * @orig: the tallocated string to append to * @append: the string to add, or NULL to add nothing. * * The talloc_append_string() function appends the given formatted string to * the given string. * * This function sets the name of the new pointer to the new string. This is * equivalent to: * * talloc_set_name_const(ptr, ptr) */ char *WARN_UNUSED_RESULT talloc_append_string(char *orig, const char *append); /** * talloc_asprintf_append - sprintf onto the end of a talloc buffer. * @s: The tallocated string buffer * @fmt: printf-style format to append to the buffer. * * The talloc_asprintf_append() function appends the given formatted string to * the given string. * * This functions sets the name of the new pointer to the new string. This is * equivalent to: * talloc_set_name_const(ptr, ptr) */ char *WARN_UNUSED_RESULT talloc_asprintf_append(char *s, const char *fmt, ...) PRINTF_FMT(2,3); /** * talloc_vasprintf - vsprintf into a talloc buffer. * @t: The context to allocate the buffer from * @fmt: printf-style format for the buffer * @ap: va_list arguments * * The talloc_vasprintf() function is the talloc equivalent of the C library * function vasprintf() * * This functions sets the name of the new pointer to the new string. This is * equivalent to: * * talloc_set_name_const(ptr, ptr) */ char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) PRINTF_FMT(2,0); /** * talloc_vasprintf_append - sprintf onto the end of a talloc buffer. * @t: The context to allocate the buffer from * @fmt: printf-style format for the buffer * @ap: va_list arguments * * The talloc_vasprintf_append() function is equivalent to * talloc_asprintf_append(), except it takes a va_list. */ char *WARN_UNUSED_RESULT talloc_vasprintf_append(char *s, const char *fmt, va_list ap) PRINTF_FMT(2,0); /** * talloc_set_type - force the name of a pointer to a particular type * @ptr: the talloc pointer * @type: the type whose name to set the ptr name to. * * This macro allows you to force the name of a pointer to be a particular * type. This can be used in conjunction with talloc_get_type() to do type * checking on void* pointers. * * It is equivalent to this: * talloc_set_name_const(ptr, #type) */ #define talloc_set_type(ptr, type) talloc_set_name_const(ptr, #type) /** * talloc_get_type - convert a talloced pointer with typechecking * @ptr: the talloc pointer * @type: the type which we expect the talloced pointer to be. * * This macro allows you to do type checking on talloc pointers. It is * particularly useful for void* private pointers. It is equivalent to this: * * (type *)talloc_check_name(ptr, #type) */ #define talloc_get_type(ptr, type) (type *)talloc_check_name(ptr, #type) /** * talloc_find_parent_byname - find a talloc parent by type * @ptr: the talloc pointer * @type: the type we're looking for * * Find a parent memory context of the current context that has the given * name. This can be very useful in complex programs where it may be difficult * to pass all information down to the level you need, but you know the * structure you want is a parent of another context. */ #define talloc_find_parent_bytype(ptr, type) (type *)talloc_find_parent_byname(ptr, #type) /** * talloc_increase_ref_count - hold a reference to a talloc pointer * @ptr: the talloc pointer * * The talloc_increase_ref_count(ptr) function is exactly equivalent to: * * talloc_reference(NULL, ptr); * * You can use either syntax, depending on which you think is clearer in your * code. * * It returns 0 on success and -1 on failure. */ int talloc_increase_ref_count(const void *ptr); /** * talloc_set_name - set the name for a talloc pointer * @ptr: the talloc pointer * @fmt: the printf-style format string for the name * * Each talloc pointer has a "name". The name is used principally for debugging * purposes, although it is also possible to set and get the name on a pointer * in as a way of "marking" pointers in your code. * * The main use for names on pointer is for "talloc reports". See * talloc_report() and talloc_report_full() for details. Also see * talloc_enable_leak_report() and talloc_enable_leak_report_full(). * * The talloc_set_name() function allocates memory as a child of the * pointer. It is logically equivalent to: * talloc_set_name_const(ptr, talloc_asprintf(ptr, fmt, ...)); * * Note that multiple calls to talloc_set_name() will allocate more memory * without releasing the name. All of the memory is released when the ptr is * freed using talloc_free(). */ const char *talloc_set_name(const void *ptr, const char *fmt, ...) PRINTF_FMT(2,3); /** * talloc_set_name_const - set a talloc pointer name to a string constant * @ptr: the talloc pointer to name * @name: the strucng constant. * * The function talloc_set_name_const() is just like talloc_set_name(), but it * takes a string constant, and is much faster. It is extensively used by the * "auto naming" macros, such as talloc(). * * This function does not allocate any memory. It just copies the supplied * pointer into the internal representation of the talloc ptr. This means you * must not pass a name pointer to memory that will disappear before the ptr is * freed with talloc_free(). */ void talloc_set_name_const(const void *ptr, const char *name); /** * talloc_named - create a specifically-named talloc pointer * @context: the parent context for the allocation * @size: the size to allocate * @fmt: the printf-style format for the name * * The talloc_named() function creates a named talloc pointer. It is equivalent * to: * * ptr = talloc_size(context, size); * talloc_set_name(ptr, fmt, ....); */ void *talloc_named(const void *context, size_t size, const char *fmt, ...) PRINTF_FMT(3,4); /** * talloc_named_const - create a specifically-named talloc pointer * @context: the parent context for the allocation * @size: the size to allocate * @name: the string constant to use as the name * * This is equivalent to: * * ptr = talloc_size(context, size); * talloc_set_name_const(ptr, name); */ void *talloc_named_const(const void *context, size_t size, const char *name); /** * talloc_get_name - get the name of a talloc pointer * @ptr: the talloc pointer * * This returns the current name for the given talloc pointer. See * talloc_set_name() for details. */ const char *talloc_get_name(const void *ptr); /** * talloc_check_name - check if a pointer has the specified name * @ptr: the talloc pointer * @name: the name to compare with the pointer's name * * This function checks if a pointer has the specified name. If it does then * the pointer is returned. It it doesn't then NULL is returned. */ void *talloc_check_name(const void *ptr, const char *name); /** * talloc_init - create a top-level context of particular name * @fmt: the printf-style format of the name * * This function creates a zero length named talloc context as a top level * context. It is equivalent to: * * talloc_named(NULL, 0, fmt, ...); */ void *talloc_init(const char *fmt, ...) PRINTF_FMT(1,2); /** * talloc_total_size - get the bytes used by the pointer and its children * @ptr: the talloc pointer * * The talloc_total_size() function returns the total size in bytes used by * this pointer and all child pointers. Mostly useful for debugging. * * Passing NULL is allowed, but it will only give a meaningful result if * talloc_enable_leak_report() or talloc_enable_leak_report_full() has been * called. */ size_t talloc_total_size(const void *ptr); /** * talloc_total_blocks - get the number of allocations for the pointer * @ptr: the talloc pointer * * The talloc_total_blocks() function returns the total allocations used by * this pointer and all child pointers. Mostly useful for debugging. For * example, a pointer with no children will return "1". * * Passing NULL is allowed, but it will only give a meaningful result if * talloc_enable_leak_report() or talloc_enable_leak_report_full() has been * called. */ size_t talloc_total_blocks(const void *ptr); /** * talloc_report_depth_cb - walk the entire talloc tree under a talloc pointer * @ptr: the talloc pointer to recurse under * @depth: the current depth of traversal * @max_depth: maximum depth to traverse, or -1 for no maximum * @callback: the function to call on each pointer * @private_data: pointer to hand to @callback. * * This provides a more flexible reports than talloc_report(). It will * recursively call the callback for the entire tree of memory referenced by * the pointer. References in the tree are passed with is_ref = 1 and the * pointer that is referenced. * * You can pass NULL for the pointer, in which case a report is printed for the * top level memory context, but only if talloc_enable_leak_report() or * talloc_enable_leak_report_full() has been called. * * The recursion is stopped when depth >= max_depth. max_depth = -1 means only * stop at leaf nodes. */ void talloc_report_depth_cb(const void *ptr, int depth, int max_depth, void (*callback)(const void *ptr, int depth, int max_depth, int is_ref, void *private_data), void *private_data); /** * talloc_report_depth_file - report talloc usage to a maximum depth * @ptr: the talloc pointer to recurse under * @depth: the current depth of traversal * @max_depth: maximum depth to traverse, or -1 for no maximum * @f: the file to report to * * This provides a more flexible reports than talloc_report(). It will let you * specify the depth and max_depth. */ void talloc_report_depth_file(const void *ptr, int depth, int max_depth, FILE *f); /** * talloc_enable_null_tracking - enable tracking of top-level tallocs * * This enables tracking of the NULL memory context without enabling leak * reporting on exit. Useful for when you want to do your own leak reporting * call via talloc_report_null_full(); */ void talloc_enable_null_tracking(void); /** * talloc_disable_null_tracking - enable tracking of top-level tallocs * * This disables tracking of the NULL memory context. */ void talloc_disable_null_tracking(void); /** * talloc_enable_leak_report - call talloc_report on program exit * * This enables calling of talloc_report(NULL, stderr) when the program * exits. In Samba4 this is enabled by using the --leak-report command line * option. * * For it to be useful, this function must be called before any other talloc * function as it establishes a "null context" that acts as the top of the * tree. If you don't call this function first then passing NULL to * talloc_report() or talloc_report_full() won't give you the full tree * printout. * * Here is a typical talloc report: * * talloc report on 'null_context' (total 267 bytes in 15 blocks) * libcli/auth/spnego_parse.c:55 contains 31 bytes in 2 blocks * libcli/auth/spnego_parse.c:55 contains 31 bytes in 2 blocks * iconv(UTF8,CP850) contains 42 bytes in 2 blocks * libcli/auth/spnego_parse.c:55 contains 31 bytes in 2 blocks * iconv(CP850,UTF8) contains 42 bytes in 2 blocks * iconv(UTF8,UTF-16LE) contains 45 bytes in 2 blocks * iconv(UTF-16LE,UTF8) contains 45 bytes in 2 blocks */ void talloc_enable_leak_report(void); /** * talloc_enable_leak_report - call talloc_report_full on program exit * * This enables calling of talloc_report_full(NULL, stderr) when the program * exits. In Samba4 this is enabled by using the --leak-report-full command * line option. * * For it to be useful, this function must be called before any other talloc * function as it establishes a "null context" that acts as the top of the * tree. If you don't call this function first then passing NULL to * talloc_report() or talloc_report_full() won't give you the full tree * printout. * * Here is a typical full report: * * full talloc report on 'root' (total 18 bytes in 8 blocks) * p1 contains 18 bytes in 7 blocks (ref 0) * r1 contains 13 bytes in 2 blocks (ref 0) * reference to: p2 * p2 contains 1 bytes in 1 blocks (ref 1) * x3 contains 1 bytes in 1 blocks (ref 0) * x2 contains 1 bytes in 1 blocks (ref 0) * x1 contains 1 bytes in 1 blocks (ref 0) */ void talloc_enable_leak_report_full(void); /** * talloc_autofree_context - a context which will be freed at exit * * This is a handy utility function that returns a talloc context which will be * automatically freed on program exit. This can be used to reduce the noise in * memory leak reports. */ void *talloc_autofree_context(void); /** * talloc_array_length - get the number of elements in a talloc array * @p: the talloc pointer whose allocation to measure. * * This assumes that @p has been allocated as the same type. NULL returns 0. * * See Also: * talloc_get_size */ #define talloc_array_length(p) (talloc_get_size(p) / sizeof((*p))) /** * talloc_get_size - get the requested size of an allocation * @ctx: the talloc pointer whose allocation to measure. * * This function lets you know the amount of memory alloced so far by this * context. It does NOT account for subcontext memory. * * See Also: * talloc_array_length */ size_t talloc_get_size(const void *ctx); /** * talloc_find_parent_byname - find a parent of this context with this name * @ctx: the context whose ancestors to search * @name: the name to look for * * Find a parent memory context of @ctx that has the given name. This can be * very useful in complex programs where it may be difficult to pass all * information down to the level you need, but you know the structure you want * is a parent of another context. */ void *talloc_find_parent_byname(const void *ctx, const char *name); /** * talloc_set_allocator - set the allocations function(s) for talloc. * @malloc: the malloc function * @free: the free function * @realloc: the realloc function * * Instead of using the standard malloc, free and realloc, talloc will use * these replacements. @realloc will never be called with size 0 or ptr NULL. */ void talloc_set_allocator(void *(*malloc)(size_t size), void (*free)(void *ptr), void *(*realloc)(void *ptr, size_t size)); /** * talloc_add_external - create an externally allocated node * @ctx: the parent * @realloc: the realloc() equivalent * @lock: the call to lock before manipulation of external nodes * @unlock: the call to unlock after manipulation of external nodes * * talloc_add_external() creates a node which uses a separate allocator. All * children allocated from that node will also use that allocator. * * Note: Currently there is only one external allocator, not per-node, * and it is set with this function. * * @lock is handed a pointer which was previous returned from your realloc * function; you should use that to figure out which lock to get if you have * multiple external pools. * * The parent pointers in realloc is the talloc pointer of the parent, if any. */ void *talloc_add_external(const void *ctx, void *(*realloc)(const void *parent, void *ptr, size_t), void (*lock)(const void *p), void (*unlock)(void)); /* The following definitions come from talloc.c */ void *_talloc(const void *context, size_t size); void _talloc_set(void *ptr, const void *ctx, size_t size, const char *name); void _talloc_set_destructor(const void *ptr, int (*destructor)(void *)); size_t talloc_reference_count(const void *ptr); void *_talloc_reference(const void *context, const void *ptr); void *WARN_UNUSED_RESULT _talloc_realloc(const void *context, void *ptr, size_t size, const char *name); void *talloc_parent(const void *ptr); const char *talloc_parent_name(const void *ptr); void *_talloc_steal(const void *new_ctx, const void *ptr); void *_talloc_move(const void *new_ctx, const void *pptr); void *_talloc_zero(const void *ctx, size_t size, const char *name); void *_talloc_memdup(const void *t, const void *p, size_t size, const char *name); void *_talloc_array(const void *ctx, size_t el_size, unsigned count, const char *name); void *_talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const char *name); void *WARN_UNUSED_RESULT _talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name); void *talloc_realloc_fn(const void *context, void *ptr, size_t size); void talloc_show_parents(const void *context, FILE *file); int talloc_is_parent(const void *context, const void *ptr); #endif /* CCAN_TALLOC_H */ sbsigntool-0.6/lib/ccan/ccan/htable/0000775000175000017500000000000012035660722014365 500000000000000sbsigntool-0.6/lib/ccan/ccan/htable/htable.c0000664000175000017500000001524212032345554015714 00000000000000/* Licensed under LGPLv2+ - see LICENSE file for details */ #include #include #include #include #include #include /* We use 0x1 as deleted marker. */ #define HTABLE_DELETED (0x1) /* We clear out the bits which are always the same, and put metadata there. */ static inline uintptr_t get_extra_ptr_bits(const struct htable *ht, uintptr_t e) { return e & ht->common_mask; } static inline void *get_raw_ptr(const struct htable *ht, uintptr_t e) { return (void *)((e & ~ht->common_mask) | ht->common_bits); } static inline uintptr_t make_hval(const struct htable *ht, const void *p, uintptr_t bits) { return ((uintptr_t)p & ~ht->common_mask) | bits; } static inline bool entry_is_valid(uintptr_t e) { return e > HTABLE_DELETED; } static inline uintptr_t get_hash_ptr_bits(const struct htable *ht, size_t hash) { /* Shuffling the extra bits (as specified in mask) down the * end is quite expensive. But the lower bits are redundant, so * we fold the value first. */ return (hash ^ (hash >> ht->bits)) & ht->common_mask & ~ht->perfect_bit; } void htable_init(struct htable *ht, size_t (*rehash)(const void *elem, void *priv), void *priv) { struct htable empty = HTABLE_INITIALIZER(empty, NULL, NULL); *ht = empty; ht->rehash = rehash; ht->priv = priv; ht->table = &ht->perfect_bit; } void htable_clear(struct htable *ht) { if (ht->table != &ht->perfect_bit) free((void *)ht->table); htable_init(ht, ht->rehash, ht->priv); } static size_t hash_bucket(const struct htable *ht, size_t h) { return h & ((1 << ht->bits)-1); } static void *htable_val(const struct htable *ht, struct htable_iter *i, size_t hash, uintptr_t perfect) { uintptr_t h2 = get_hash_ptr_bits(ht, hash) | perfect; while (ht->table[i->off]) { if (ht->table[i->off] != HTABLE_DELETED) { if (get_extra_ptr_bits(ht, ht->table[i->off]) == h2) return get_raw_ptr(ht, ht->table[i->off]); } i->off = (i->off + 1) & ((1 << ht->bits)-1); h2 &= ~perfect; } return NULL; } void *htable_firstval(const struct htable *ht, struct htable_iter *i, size_t hash) { i->off = hash_bucket(ht, hash); return htable_val(ht, i, hash, ht->perfect_bit); } void *htable_nextval(const struct htable *ht, struct htable_iter *i, size_t hash) { i->off = (i->off + 1) & ((1 << ht->bits)-1); return htable_val(ht, i, hash, 0); } void *htable_first(const struct htable *ht, struct htable_iter *i) { for (i->off = 0; i->off < (size_t)1 << ht->bits; i->off++) { if (entry_is_valid(ht->table[i->off])) return get_raw_ptr(ht, ht->table[i->off]); } return NULL; } void *htable_next(const struct htable *ht, struct htable_iter *i) { for (i->off++; i->off < (size_t)1 << ht->bits; i->off++) { if (entry_is_valid(ht->table[i->off])) return get_raw_ptr(ht, ht->table[i->off]); } return NULL; } /* This does not expand the hash table, that's up to caller. */ static void ht_add(struct htable *ht, const void *new, size_t h) { size_t i; uintptr_t perfect = ht->perfect_bit; i = hash_bucket(ht, h); while (entry_is_valid(ht->table[i])) { perfect = 0; i = (i + 1) & ((1 << ht->bits)-1); } ht->table[i] = make_hval(ht, new, get_hash_ptr_bits(ht, h)|perfect); } static COLD bool double_table(struct htable *ht) { unsigned int i; size_t oldnum = (size_t)1 << ht->bits; uintptr_t *oldtable, e; oldtable = ht->table; ht->table = calloc(1 << (ht->bits+1), sizeof(size_t)); if (!ht->table) { ht->table = oldtable; return false; } ht->bits++; ht->max = ((size_t)3 << ht->bits) / 4; ht->max_with_deleted = ((size_t)9 << ht->bits) / 10; /* If we lost our "perfect bit", get it back now. */ if (!ht->perfect_bit && ht->common_mask) { for (i = 0; i < sizeof(ht->common_mask) * CHAR_BIT; i++) { if (ht->common_mask & ((size_t)1 << i)) { ht->perfect_bit = (size_t)1 << i; break; } } } if (oldtable != &ht->perfect_bit) { for (i = 0; i < oldnum; i++) { if (entry_is_valid(e = oldtable[i])) { void *p = get_raw_ptr(ht, e); ht_add(ht, p, ht->rehash(p, ht->priv)); } } free(oldtable); } ht->deleted = 0; return true; } static COLD void rehash_table(struct htable *ht) { size_t start, i; uintptr_t e; /* Beware wrap cases: we need to start from first empty bucket. */ for (start = 0; ht->table[start]; start++); for (i = 0; i < (size_t)1 << ht->bits; i++) { size_t h = (i + start) & ((1 << ht->bits)-1); e = ht->table[h]; if (!e) continue; if (e == HTABLE_DELETED) ht->table[h] = 0; else if (!(e & ht->perfect_bit)) { void *p = get_raw_ptr(ht, e); ht->table[h] = 0; ht_add(ht, p, ht->rehash(p, ht->priv)); } } ht->deleted = 0; } /* We stole some bits, now we need to put them back... */ static COLD void update_common(struct htable *ht, const void *p) { unsigned int i; uintptr_t maskdiff, bitsdiff; if (ht->elems == 0) { /* Always reveal one bit of the pointer in the bucket, * so it's not zero or HTABLE_DELETED (1), even if * hash happens to be 0. Assumes (void *)1 is not a * valid pointer. */ for (i = sizeof(uintptr_t)*CHAR_BIT - 1; i > 0; i--) { if ((uintptr_t)p & ((uintptr_t)1 << i)) break; } ht->common_mask = ~((uintptr_t)1 << i); ht->common_bits = ((uintptr_t)p & ht->common_mask); ht->perfect_bit = 1; return; } /* Find bits which are unequal to old common set. */ maskdiff = ht->common_bits ^ ((uintptr_t)p & ht->common_mask); /* These are the bits which go there in existing entries. */ bitsdiff = ht->common_bits & maskdiff; for (i = 0; i < (size_t)1 << ht->bits; i++) { if (!entry_is_valid(ht->table[i])) continue; /* Clear the bits no longer in the mask, set them as * expected. */ ht->table[i] &= ~maskdiff; ht->table[i] |= bitsdiff; } /* Take away those bits from our mask, bits and perfect bit. */ ht->common_mask &= ~maskdiff; ht->common_bits &= ~maskdiff; ht->perfect_bit &= ~maskdiff; } bool htable_add(struct htable *ht, size_t hash, const void *p) { if (ht->elems+1 > ht->max && !double_table(ht)) return false; if (ht->elems+1 + ht->deleted > ht->max_with_deleted) rehash_table(ht); assert(p); if (((uintptr_t)p & ht->common_mask) != ht->common_bits) update_common(ht, p); ht_add(ht, p, hash); ht->elems++; return true; } bool htable_del(struct htable *ht, size_t h, const void *p) { struct htable_iter i; void *c; for (c = htable_firstval(ht,&i,h); c; c = htable_nextval(ht,&i,h)) { if (c == p) { htable_delval(ht, &i); return true; } } return false; } void htable_delval(struct htable *ht, struct htable_iter *i) { assert(i->off < (size_t)1 << ht->bits); assert(entry_is_valid(ht->table[i->off])); ht->elems--; ht->table[i->off] = HTABLE_DELETED; ht->deleted++; } sbsigntool-0.6/lib/ccan/ccan/htable/htable_type.h0000664000175000017500000000710612032345554016762 00000000000000/* Licensed under LGPLv2+ - see LICENSE file for details */ #ifndef CCAN_HTABLE_TYPE_H #define CCAN_HTABLE_TYPE_H #include #include "config.h" /** * HTABLE_DEFINE_TYPE - create a set of htable ops for a type * @type: a type whose pointers will be values in the hash. * @keyof: a function/macro to extract a key: @keyof(const type *elem) * @hashfn: a hash function for a @key: size_t @hashfn(const *) * @eqfn: an equality function keys: bool @eqfn(const type *, const *) * @prefix: a prefix for all the functions to define (of form _*) * * NULL values may not be placed into the hash table. * * This defines the type hashtable type and an iterator type: * struct ; * struct _iter; * * It also defines initialization and freeing functions: * void _init(struct *); * void _clear(struct *); * * Add function only fails if we run out of memory: * bool _add(struct *ht, const *e); * * Delete and delete-by key return true if it was in the set: * bool _del(struct *ht, const *e); * bool _delkey(struct *ht, const *k); * * Find function return the matching element, or NULL: * type *_get(const struct @name *ht, const *k); * * Iteration over hashtable is also supported: * type *_first(const struct *ht, struct _iter *i); * type *_next(const struct *ht, struct _iter *i); * * It's currently safe to iterate over a changing hashtable, but you might * miss an element. Iteration isn't very efficient, either. * * You can use HTABLE_INITIALIZER like so: * struct ht = { HTABLE_INITIALIZER(ht.raw, _hash, NULL) }; */ #define HTABLE_DEFINE_TYPE(type, keyof, hashfn, eqfn, name) \ struct name { struct htable raw; }; \ struct name##_iter { struct htable_iter i; }; \ static inline size_t name##_hash(const void *elem, void *priv) \ { \ return hashfn(keyof((const type *)elem)); \ } \ static inline void name##_init(struct name *ht) \ { \ htable_init(&ht->raw, name##_hash, NULL); \ } \ static inline void name##_clear(struct name *ht) \ { \ htable_clear(&ht->raw); \ } \ static inline bool name##_add(struct name *ht, const type *elem) \ { \ return htable_add(&ht->raw, hashfn(keyof(elem)), elem); \ } \ static inline bool name##_del(struct name *ht, const type *elem) \ { \ return htable_del(&ht->raw, hashfn(keyof(elem)), elem); \ } \ static inline type *name##_get(const struct name *ht, \ const HTABLE_KTYPE(keyof) k) \ { \ /* Typecheck for eqfn */ \ (void)sizeof(eqfn((const type *)NULL, \ keyof((const type *)NULL))); \ return htable_get(&ht->raw, \ hashfn(k), \ (bool (*)(const void *, void *))(eqfn), \ k); \ } \ static inline bool name##_delkey(struct name *ht, \ const HTABLE_KTYPE(keyof) k) \ { \ type *elem = name##_get(ht, k); \ if (elem) \ return name##_del(ht, elem); \ return false; \ } \ static inline type *name##_first(const struct name *ht, \ struct name##_iter *iter) \ { \ return htable_first(&ht->raw, &iter->i); \ } \ static inline type *name##_next(const struct name *ht, \ struct name##_iter *iter) \ { \ return htable_next(&ht->raw, &iter->i); \ } #if HAVE_TYPEOF #define HTABLE_KTYPE(keyof) typeof(keyof(NULL)) #else #define HTABLE_KTYPE(keyof) void * #endif #endif /* CCAN_HTABLE_TYPE_H */ sbsigntool-0.6/lib/ccan/ccan/htable/htable.h0000664000175000017500000001127612032345554015724 00000000000000/* Licensed under LGPLv2+ - see LICENSE file for details */ #ifndef CCAN_HTABLE_H #define CCAN_HTABLE_H #include "config.h" #include #include #include /** * struct htable - private definition of a htable. * * It's exposed here so you can put it in your structures and so we can * supply inline functions. */ struct htable { size_t (*rehash)(const void *elem, void *priv); void *priv; unsigned int bits; size_t elems, deleted, max, max_with_deleted; /* These are the bits which are the same in all pointers. */ uintptr_t common_mask, common_bits; uintptr_t perfect_bit; uintptr_t *table; }; /** * HTABLE_INITIALIZER - static initialization for a hash table. * @name: name of this htable. * @rehash: hash function to use for rehashing. * @priv: private argument to @rehash function. * * This is useful for setting up static and global hash tables. * * Example: * // For simplicity's sake, say hash value is contents of elem. * static size_t rehash(const void *elem, void *unused) * { * return *(size_t *)elem; * } * static struct htable ht = HTABLE_INITIALIZER(ht, rehash, NULL); */ #define HTABLE_INITIALIZER(name, rehash, priv) \ { rehash, priv, 0, 0, 0, 0, 0, -1, 0, 0, &name.perfect_bit } /** * htable_init - initialize an empty hash table. * @ht: the hash table to initialize * @rehash: hash function to use for rehashing. * @priv: private argument to @rehash function. */ void htable_init(struct htable *ht, size_t (*rehash)(const void *elem, void *priv), void *priv); /** * htable_clear - empty a hash table. * @ht: the hash table to clear * * This doesn't do anything to any pointers left in it. */ void htable_clear(struct htable *ht); /** * htable_rehash - use a hashtree's rehash function * @elem: the argument to rehash() * */ size_t htable_rehash(const void *elem); /** * htable_add - add a pointer into a hash table. * @ht: the htable * @hash: the hash value of the object * @p: the non-NULL pointer * * Also note that this can only fail due to allocation failure. Otherwise, it * returns true. */ bool htable_add(struct htable *ht, size_t hash, const void *p); /** * htable_del - remove a pointer from a hash table * @ht: the htable * @hash: the hash value of the object * @p: the pointer * * Returns true if the pointer was found (and deleted). */ bool htable_del(struct htable *ht, size_t hash, const void *p); /** * struct htable_iter - iterator or htable_first or htable_firstval etc. * * This refers to a location inside the hashtable. */ struct htable_iter { size_t off; }; /** * htable_firstval - find a candidate for a given hash value * @htable: the hashtable * @i: the struct htable_iter to initialize * @hash: the hash value * * You'll need to check the value is what you want; returns NULL if none. * See Also: * htable_delval() */ void *htable_firstval(const struct htable *htable, struct htable_iter *i, size_t hash); /** * htable_nextval - find another candidate for a given hash value * @htable: the hashtable * @i: the struct htable_iter to initialize * @hash: the hash value * * You'll need to check the value is what you want; returns NULL if no more. */ void *htable_nextval(const struct htable *htable, struct htable_iter *i, size_t hash); /** * htable_get - find an entry in the hash table * @ht: the hashtable * @h: the hash value of the entry * @cmp: the comparison function * @ptr: the pointer to hand to the comparison function. * * Convenient inline wrapper for htable_firstval/htable_nextval loop. */ static inline void *htable_get(const struct htable *ht, size_t h, bool (*cmp)(const void *candidate, void *ptr), const void *ptr) { struct htable_iter i; void *c; for (c = htable_firstval(ht,&i,h); c; c = htable_nextval(ht,&i,h)) { if (cmp(c, (void *)ptr)) return c; } return NULL; } /** * htable_first - find an entry in the hash table * @ht: the hashtable * @i: the struct htable_iter to initialize * * Get an entry in the hashtable; NULL if empty. */ void *htable_first(const struct htable *htable, struct htable_iter *i); /** * htable_next - find another entry in the hash table * @ht: the hashtable * @i: the struct htable_iter to use * * Get another entry in the hashtable; NULL if all done. * This is usually used after htable_first or prior non-NULL htable_next. */ void *htable_next(const struct htable *htable, struct htable_iter *i); /** * htable_delval - remove an iterated pointer from a hash table * @ht: the htable * @i: the htable_iter * * Usually used to delete a hash entry after it has been found with * htable_firstval etc. */ void htable_delval(struct htable *ht, struct htable_iter *i); #endif /* CCAN_HTABLE_H */ sbsigntool-0.6/lib/ccan/ccan/check_type/0000775000175000017500000000000012035660722015244 500000000000000sbsigntool-0.6/lib/ccan/ccan/check_type/check_type.h0000664000175000017500000000441512032345554017457 00000000000000#ifndef CCAN_CHECK_TYPE_H #define CCAN_CHECK_TYPE_H #include "config.h" /** * check_type - issue a warning or build failure if type is not correct. * @expr: the expression whose type we should check (not evaluated). * @type: the exact type we expect the expression to be. * * This macro is usually used within other macros to try to ensure that a macro * argument is of the expected type. No type promotion of the expression is * done: an unsigned int is not the same as an int! * * check_type() always evaluates to 0. * * If your compiler does not support typeof, then the best we can do is fail * to compile if the sizes of the types are unequal (a less complete check). * * Example: * // They should always pass a 64-bit value to _set_some_value! * #define set_some_value(expr) \ * _set_some_value((check_type((expr), uint64_t), (expr))) */ /** * check_types_match - issue a warning or build failure if types are not same. * @expr1: the first expression (not evaluated). * @expr2: the second expression (not evaluated). * * This macro is usually used within other macros to try to ensure that * arguments are of identical types. No type promotion of the expressions is * done: an unsigned int is not the same as an int! * * check_types_match() always evaluates to 0. * * If your compiler does not support typeof, then the best we can do is fail * to compile if the sizes of the types are unequal (a less complete check). * * Example: * // Do subtraction to get to enclosing type, but make sure that * // pointer is of correct type for that member. * #define container_of(mbr_ptr, encl_type, mbr) \ * (check_types_match((mbr_ptr), &((encl_type *)0)->mbr), \ * ((encl_type *) \ * ((char *)(mbr_ptr) - offsetof(enclosing_type, mbr)))) */ #if HAVE_TYPEOF #define check_type(expr, type) \ ((typeof(expr) *)0 != (type *)0) #define check_types_match(expr1, expr2) \ ((typeof(expr1) *)0 != (typeof(expr2) *)0) #else #include /* Without typeof, we can only test the sizes. */ #define check_type(expr, type) \ BUILD_ASSERT_OR_ZERO(sizeof(expr) == sizeof(type)) #define check_types_match(expr1, expr2) \ BUILD_ASSERT_OR_ZERO(sizeof(expr1) == sizeof(expr2)) #endif /* HAVE_TYPEOF */ #endif /* CCAN_CHECK_TYPE_H */ sbsigntool-0.6/lib/ccan/ccan/str/0000775000175000017500000000000012035660722013736 500000000000000sbsigntool-0.6/lib/ccan/ccan/str/debug.c0000664000175000017500000000301112032345554015103 00000000000000#include "config.h" #include #include #include #include #ifdef CCAN_STR_DEBUG /* Because we mug the real ones with macros, we need our own wrappers. */ int str_isalnum(int i) { assert(i >= -1 && i < 256); return isalnum(i); } int str_isalpha(int i) { assert(i >= -1 && i < 256); return isalpha(i); } int str_isascii(int i) { assert(i >= -1 && i < 256); return isascii(i); } #if HAVE_ISBLANK int str_isblank(int i) { assert(i >= -1 && i < 256); return isblank(i); } #endif int str_iscntrl(int i) { assert(i >= -1 && i < 256); return iscntrl(i); } int str_isdigit(int i) { assert(i >= -1 && i < 256); return isdigit(i); } int str_isgraph(int i) { assert(i >= -1 && i < 256); return isgraph(i); } int str_islower(int i) { assert(i >= -1 && i < 256); return islower(i); } int str_isprint(int i) { assert(i >= -1 && i < 256); return isprint(i); } int str_ispunct(int i) { assert(i >= -1 && i < 256); return ispunct(i); } int str_isspace(int i) { assert(i >= -1 && i < 256); return isspace(i); } int str_isupper(int i) { assert(i >= -1 && i < 256); return isupper(i); } int str_isxdigit(int i) { assert(i >= -1 && i < 256); return isxdigit(i); } #undef strstr #undef strchr #undef strrchr char *str_strstr(const char *haystack, const char *needle) { return strstr(haystack, needle); } char *str_strchr(const char *haystack, int c) { return strchr(haystack, c); } char *str_strrchr(const char *haystack, int c) { return strrchr(haystack, c); } #endif sbsigntool-0.6/lib/ccan/ccan/str/str_debug.h0000664000175000017500000000131512032345554016005 00000000000000#ifndef CCAN_STR_DEBUG_H #define CCAN_STR_DEBUG_H /* #define CCAN_STR_DEBUG 1 */ #ifdef CCAN_STR_DEBUG /* Because we mug the real ones with macros, we need our own wrappers. */ int str_isalnum(int i); int str_isalpha(int i); int str_isascii(int i); #if HAVE_ISBLANK int str_isblank(int i); #endif int str_iscntrl(int i); int str_isdigit(int i); int str_isgraph(int i); int str_islower(int i); int str_isprint(int i); int str_ispunct(int i); int str_isspace(int i); int str_isupper(int i); int str_isxdigit(int i); char *str_strstr(const char *haystack, const char *needle); char *str_strchr(const char *s, int c); char *str_strrchr(const char *s, int c); #endif /* CCAN_STR_DEBUG */ #endif /* CCAN_STR_DEBUG_H */ sbsigntool-0.6/lib/ccan/ccan/str/str.c0000664000175000017500000000034212032345554014631 00000000000000#include size_t strcount(const char *haystack, const char *needle) { size_t i = 0, nlen = strlen(needle); while ((haystack = strstr(haystack, needle)) != NULL) { i++; haystack += nlen; } return i; } sbsigntool-0.6/lib/ccan/ccan/str/str.h0000664000175000017500000001174112032345554014643 00000000000000/* Placed into the public domain. */ #ifndef CCAN_STR_H #define CCAN_STR_H #include "config.h" #include #include #include /** * streq - Are two strings equal? * @a: first string * @b: first string * * This macro is arguably more readable than "!strcmp(a, b)". * * Example: * if (streq(somestring, "")) * printf("String is empty!\n"); */ #define streq(a,b) (strcmp((a),(b)) == 0) /** * strstarts - Does this string start with this prefix? * @str: string to test * @prefix: prefix to look for at start of str * * Example: * if (strstarts(somestring, "foo")) * printf("String %s begins with 'foo'!\n", somestring); */ #define strstarts(str,prefix) (strncmp((str),(prefix),strlen(prefix)) == 0) /** * strends - Does this string end with this postfix? * @str: string to test * @postfix: postfix to look for at end of str * * Example: * if (strends(somestring, "foo")) * printf("String %s end with 'foo'!\n", somestring); */ static inline bool strends(const char *str, const char *postfix) { if (strlen(str) < strlen(postfix)) return false; return streq(str + strlen(str) - strlen(postfix), postfix); } /** * stringify - Turn expression into a string literal * @expr: any C expression * * Example: * #define PRINT_COND_IF_FALSE(cond) \ * ((cond) || printf("%s is false!", stringify(cond))) */ #define stringify(expr) stringify_1(expr) /* Double-indirection required to stringify expansions */ #define stringify_1(expr) #expr /** * strcount - Count number of (non-overlapping) occurrences of a substring. * @haystack: a C string * @needle: a substring * * Example: * int i; * i = strcount("aaa aaa", "a"); // i = 6; * i = strcount("aaa aaa", "ab"); // i = 0; * i = strcount("aaa aaa", "aa"); // i = 2; */ size_t strcount(const char *haystack, const char *needle); /** * cisalnum - isalnum() which takes a char (and doesn't accept EOF) * @c: a character * * Surprisingly, the standard ctype.h isalnum() takes an int, which * must have the value of EOF (-1) or an unsigned char. This variant * takes a real char, and doesn't accept EOF. */ static inline bool cisalnum(char c) { return isalnum((unsigned char)c); } static inline bool cisalpha(char c) { return isalpha((unsigned char)c); } static inline bool cisascii(char c) { return isascii((unsigned char)c); } #if HAVE_ISBLANK static inline bool cisblank(char c) { return isblank((unsigned char)c); } #endif static inline bool ciscntrl(char c) { return iscntrl((unsigned char)c); } static inline bool cisdigit(char c) { return isdigit((unsigned char)c); } static inline bool cisgraph(char c) { return isgraph((unsigned char)c); } static inline bool cislower(char c) { return islower((unsigned char)c); } static inline bool cisprint(char c) { return isprint((unsigned char)c); } static inline bool cispunct(char c) { return ispunct((unsigned char)c); } static inline bool cisspace(char c) { return isspace((unsigned char)c); } static inline bool cisupper(char c) { return isupper((unsigned char)c); } static inline bool cisxdigit(char c) { return isxdigit((unsigned char)c); } #include /* These checks force things out of line, hence they are under DEBUG. */ #ifdef CCAN_STR_DEBUG #include /* These are commonly misused: they take -1 or an *unsigned* char value. */ #undef isalnum #undef isalpha #undef isascii #undef isblank #undef iscntrl #undef isdigit #undef isgraph #undef islower #undef isprint #undef ispunct #undef isspace #undef isupper #undef isxdigit /* You can use a char if char is unsigned. */ #if HAVE_BUILTIN_TYPES_COMPATIBLE_P && HAVE_TYPEOF #define str_check_arg_(i) \ ((i) + BUILD_ASSERT_OR_ZERO(!__builtin_types_compatible_p(typeof(i), \ char) \ || (char)255 > 0)) #else #define str_check_arg_(i) (i) #endif #define isalnum(i) str_isalnum(str_check_arg_(i)) #define isalpha(i) str_isalpha(str_check_arg_(i)) #define isascii(i) str_isascii(str_check_arg_(i)) #if HAVE_ISBLANK #define isblank(i) str_isblank(str_check_arg_(i)) #endif #define iscntrl(i) str_iscntrl(str_check_arg_(i)) #define isdigit(i) str_isdigit(str_check_arg_(i)) #define isgraph(i) str_isgraph(str_check_arg_(i)) #define islower(i) str_islower(str_check_arg_(i)) #define isprint(i) str_isprint(str_check_arg_(i)) #define ispunct(i) str_ispunct(str_check_arg_(i)) #define isspace(i) str_isspace(str_check_arg_(i)) #define isupper(i) str_isupper(str_check_arg_(i)) #define isxdigit(i) str_isxdigit(str_check_arg_(i)) #if HAVE_TYPEOF /* With GNU magic, we can make const-respecting standard string functions. */ #undef strstr #undef strchr #undef strrchr /* + 0 is needed to decay array into pointer. */ #define strstr(haystack, needle) \ ((typeof((haystack) + 0))str_strstr((haystack), (needle))) #define strchr(haystack, c) \ ((typeof((haystack) + 0))str_strchr((haystack), (c))) #define strrchr(haystack, c) \ ((typeof((haystack) + 0))str_strrchr((haystack), (c))) #endif #endif /* CCAN_STR_DEBUG */ #endif /* CCAN_STR_H */ sbsigntool-0.6/lib/ccan/ccan/tlist/0000775000175000017500000000000012035660722014265 500000000000000sbsigntool-0.6/lib/ccan/ccan/tlist/tlist.h0000664000175000017500000001661412032345554015525 00000000000000/* Licensed under LGPL - see LICENSE file for details */ #ifndef CCAN_TLIST_H #define CCAN_TLIST_H #include #include /** * TLIST_TYPE - declare a typed list type (struct tlist) * @suffix: the name to use (struct tlist_@suffix) * @type: the type the list will contain (void for any type) * * This declares a structure "struct tlist_@suffix" to use for * lists containing this type. The actual list can be accessed using * ".raw" or tlist_raw(). * * Example: * // Defines struct tlist_children * TLIST_TYPE(children, struct child); * struct parent { * const char *name; * struct tlist_children children; * unsigned int num_children; * }; * * struct child { * const char *name; * struct list_node list; * }; */ #define TLIST_TYPE(suffix, type) \ struct tlist_##suffix { \ struct list_head raw; \ TCON(type *canary); \ } /** * TLIST_INIT - initalizer for an empty tlist * @name: the name of the list. * * Explicit initializer for an empty list. * * See also: * tlist_init() * * Example: * static struct tlist_children my_list = TLIST_INIT(my_list); */ #define TLIST_INIT(name) { LIST_HEAD_INIT(name.raw) } /** * tlist_check - check head of a list for consistency * @h: the tlist_head * @abortstr: the location to print on aborting, or NULL. * * Because list_nodes have redundant information, consistency checking between * the back and forward links can be done. This is useful as a debugging check. * If @abortstr is non-NULL, that will be printed in a diagnostic if the list * is inconsistent, and the function will abort. * * Returns non-NULL if the list is consistent, NULL otherwise (it * can never return NULL if @abortstr is set). * * See also: list_check() * * Example: * static void dump_parent(struct parent *p) * { * struct child *c; * * printf("%s (%u children):\n", p->name, p->num_children); * tlist_check(&p->children, "bad child list"); * tlist_for_each(&p->children, c, list) * printf(" -> %s\n", c->name); * } */ #define tlist_check(h, abortstr) \ list_check(&(h)->raw, (abortstr)) /** * tlist_init - initialize a tlist * @h: the tlist to set to the empty list * * Example: * ... * struct parent *parent = malloc(sizeof(*parent)); * * tlist_init(&parent->children); * parent->num_children = 0; */ #define tlist_init(h) list_head_init(&(h)->raw) /** * tlist_raw - unwrap the typed list and check the type * @h: the tlist * @expr: the expression to check the type against (not evaluated) * * This macro usually causes the compiler to emit a warning if the * variable is of an unexpected type. It is used internally where we * need to access the raw underlying list. */ #define tlist_raw(h, expr) (&tcon_check((h), canary, (expr))->raw) /** * tlist_add - add an entry at the start of a linked list. * @h: the tlist to add the node to * @n: the entry to add to the list. * @member: the member of n to add to the list. * * The entry's list_node does not need to be initialized; it will be * overwritten. * Example: * struct child *child = malloc(sizeof(*child)); * * child->name = "marvin"; * tlist_add(&parent->children, child, list); * parent->num_children++; */ #define tlist_add(h, n, member) list_add(tlist_raw((h), (n)), &(n)->member) /** * tlist_add_tail - add an entry at the end of a linked list. * @h: the tlist to add the node to * @n: the entry to add to the list. * @member: the member of n to add to the list. * * The list_node does not need to be initialized; it will be overwritten. * Example: * tlist_add_tail(&parent->children, child, list); * parent->num_children++; */ #define tlist_add_tail(h, n, member) \ list_add_tail(tlist_raw((h), (n)), &(n)->member) /** * tlist_del_from - delete an entry from a linked list. * @h: the tlist @n is in * @n: the entry to delete * @member: the member of n to remove from the list. * * This explicitly indicates which list a node is expected to be in, * which is better documentation and can catch more bugs. * * Note that this leaves @n->@member in an undefined state; it * can be added to another list, but not deleted again. * * See also: tlist_del() * * Example: * tlist_del_from(&parent->children, child, list); * parent->num_children--; */ #define tlist_del_from(h, n, member) \ list_del_from(tlist_raw((h), (n)), &(n)->member) /** * tlist_del - delete an entry from an unknown linked list. * @n: the entry to delete from the list. * @member: the member of @n which is in the list. * * Example: * tlist_del(child, list); * parent->num_children--; */ #define tlist_del(n, member) \ list_del(&(n)->member) /** * tlist_empty - is a list empty? * @h: the tlist * * If the list is empty, returns true. * * Example: * assert(tlist_empty(&parent->children) == (parent->num_children == 0)); */ #define tlist_empty(h) list_empty(&(h)->raw) /** * tlist_top - get the first entry in a list * @h: the tlist * @member: the list_node member of the type * * If the list is empty, returns NULL. * * Example: * struct child *first; * first = tlist_top(&parent->children, list); */ #define tlist_top(h, member) \ ((tcon_type((h), canary)) \ list_top_(&(h)->raw, \ (char *)(&(h)->_tcon[0].canary->member) - \ (char *)((h)->_tcon[0].canary))) /** * tlist_tail - get the last entry in a list * @h: the tlist * @member: the list_node member of the type * * If the list is empty, returns NULL. * * Example: * struct child *last; * last = tlist_tail(&parent->children, list); */ #define tlist_tail(h, member) \ ((tcon_type((h), canary)) \ list_tail_(&(h)->raw, \ (char *)(&(h)->_tcon[0].canary->member) - \ (char *)((h)->_tcon[0].canary))) /** * tlist_for_each - iterate through a list. * @h: the tlist * @i: an iterator of suitable type for this list. * @member: the list_node member of @i * * This is a convenient wrapper to iterate @i over the entire list. It's * a for loop, so you can break and continue as normal. * * Example: * tlist_for_each(&parent->children, child, list) * printf("Name: %s\n", child->name); */ #define tlist_for_each(h, i, member) \ list_for_each(tlist_raw((h), (i)), (i), member) /** * tlist_for_each - iterate through a list backwards. * @h: the tlist * @i: an iterator of suitable type for this list. * @member: the list_node member of @i * * This is a convenient wrapper to iterate @i over the entire list. It's * a for loop, so you can break and continue as normal. * * Example: * tlist_for_each_rev(&parent->children, child, list) * printf("Name: %s\n", child->name); */ #define tlist_for_each_rev(h, i, member) \ list_for_each_rev(tlist_raw((h), (i)), (i), member) /** * tlist_for_each_safe - iterate through a list, maybe during deletion * @h: the tlist * @i: an iterator of suitable type for this list. * @nxt: another iterator to store the next entry. * @member: the list_node member of the structure * * This is a convenient wrapper to iterate @i over the entire list. It's * a for loop, so you can break and continue as normal. The extra variable * @nxt is used to hold the next element, so you can delete @i from the list. * * Example: * struct child *next; * tlist_for_each_safe(&parent->children, child, next, list) { * tlist_del(child, list); * parent->num_children--; * } */ #define tlist_for_each_safe(h, i, nxt, member) \ list_for_each_safe(tlist_raw((h), (i)), (i), (nxt), member) #endif /* CCAN_TLIST_H */ sbsigntool-0.6/lib/ccan/ccan/container_of/0000775000175000017500000000000012035660722015574 500000000000000sbsigntool-0.6/lib/ccan/ccan/container_of/container_of.h0000664000175000017500000000602712032345554020340 00000000000000#ifndef CCAN_CONTAINER_OF_H #define CCAN_CONTAINER_OF_H #include #include "config.h" #include /** * container_of - get pointer to enclosing structure * @member_ptr: pointer to the structure member * @containing_type: the type this member is within * @member: the name of this member within the structure. * * Given a pointer to a member of a structure, this macro does pointer * subtraction to return the pointer to the enclosing type. * * Example: * struct foo { * int fielda, fieldb; * // ... * }; * struct info { * int some_other_field; * struct foo my_foo; * }; * * static struct info *foo_to_info(struct foo *foo) * { * return container_of(foo, struct info, my_foo); * } */ #define container_of(member_ptr, containing_type, member) \ ((containing_type *) \ ((char *)(member_ptr) \ - container_off(containing_type, member)) \ + check_types_match(*(member_ptr), ((containing_type *)0)->member)) /** * container_off - get offset to enclosing structure * @containing_type: the type this member is within * @member: the name of this member within the structure. * * Given a pointer to a member of a structure, this macro does * typechecking and figures out the offset to the enclosing type. * * Example: * struct foo { * int fielda, fieldb; * // ... * }; * struct info { * int some_other_field; * struct foo my_foo; * }; * * static struct info *foo_to_info(struct foo *foo) * { * size_t off = container_off(struct info, my_foo); * return (void *)((char *)foo - off); * } */ #define container_off(containing_type, member) \ offsetof(containing_type, member) /** * container_of_var - get pointer to enclosing structure using a variable * @member_ptr: pointer to the structure member * @container_var: a pointer of same type as this member's container * @member: the name of this member within the structure. * * Given a pointer to a member of a structure, this macro does pointer * subtraction to return the pointer to the enclosing type. * * Example: * static struct info *foo_to_i(struct foo *foo) * { * struct info *i = container_of_var(foo, i, my_foo); * return i; * } */ #if HAVE_TYPEOF #define container_of_var(member_ptr, container_var, member) \ container_of(member_ptr, typeof(*container_var), member) #else #define container_of_var(member_ptr, container_var, member) \ ((void *)((char *)(member_ptr) - \ container_off_var(container_var, member))) #endif /** * container_off_var - get offset of a field in enclosing structure * @container_var: a pointer to a container structure * @member: the name of a member within the structure. * * Given (any) pointer to a structure and a its member name, this * macro does pointer subtraction to return offset of member in a * structure memory layout. * */ #if HAVE_TYPEOF #define container_off_var(var, member) \ container_off(typeof(*var), member) #else #define container_off_var(var, member) \ ((char *)&(var)->member - (char *)(var)) #endif #endif /* CCAN_CONTAINER_OF_H */ sbsigntool-0.6/lib/ccan/ccan/typesafe_cb/0000775000175000017500000000000012035660722015412 500000000000000sbsigntool-0.6/lib/ccan/ccan/typesafe_cb/typesafe_cb.h0000664000175000017500000001164012032345554017771 00000000000000/* Licensed under LGPLv2.1+ - see LICENSE file for details */ #ifndef CCAN_TYPESAFE_CB_H #define CCAN_TYPESAFE_CB_H #include "config.h" #if HAVE_TYPEOF && HAVE_BUILTIN_CHOOSE_EXPR && HAVE_BUILTIN_TYPES_COMPATIBLE_P /** * typesafe_cb_cast - only cast an expression if it matches a given type * @desttype: the type to cast to * @oktype: the type we allow * @expr: the expression to cast * * This macro is used to create functions which allow multiple types. * The result of this macro is used somewhere that a @desttype type is * expected: if @expr is exactly of type @oktype, then it will be * cast to @desttype type, otherwise left alone. * * This macro can be used in static initializers. * * This is merely useful for warnings: if the compiler does not * support the primitives required for typesafe_cb_cast(), it becomes an * unconditional cast, and the @oktype argument is not used. In * particular, this means that @oktype can be a type which uses the * "typeof": it will not be evaluated if typeof is not supported. * * Example: * // We can take either an unsigned long or a void *. * void _set_some_value(void *val); * #define set_some_value(e) \ * _set_some_value(typesafe_cb_cast(void *, (e), unsigned long)) */ #define typesafe_cb_cast(desttype, oktype, expr) \ __builtin_choose_expr( \ __builtin_types_compatible_p(__typeof__(0?(expr):(expr)), \ oktype), \ (desttype)(expr), (expr)) #else #define typesafe_cb_cast(desttype, oktype, expr) ((desttype)(expr)) #endif /** * typesafe_cb_cast3 - only cast an expression if it matches given types * @desttype: the type to cast to * @ok1: the first type we allow * @ok2: the second type we allow * @ok3: the third type we allow * @expr: the expression to cast * * This is a convenient wrapper for multiple typesafe_cb_cast() calls. * You can chain them inside each other (ie. use typesafe_cb_cast() * for expr) if you need more than 3 arguments. * * Example: * // We can take either a long, unsigned long, void * or a const void *. * void _set_some_value(void *val); * #define set_some_value(expr) \ * _set_some_value(typesafe_cb_cast3(void *,, \ * long, unsigned long, const void *,\ * (expr))) */ #define typesafe_cb_cast3(desttype, ok1, ok2, ok3, expr) \ typesafe_cb_cast(desttype, ok1, \ typesafe_cb_cast(desttype, ok2, \ typesafe_cb_cast(desttype, ok3, \ (expr)))) /** * typesafe_cb - cast a callback function if it matches the arg * @rtype: the return type of the callback function * @atype: the (pointer) type which the callback function expects. * @fn: the callback function to cast * @arg: the (pointer) argument to hand to the callback function. * * If a callback function takes a single argument, this macro does * appropriate casts to a function which takes a single atype argument if the * callback provided matches the @arg. * * It is assumed that @arg is of pointer type: usually @arg is passed * or assigned to a void * elsewhere anyway. * * Example: * void _register_callback(void (*fn)(void *arg), void *arg); * #define register_callback(fn, arg) \ * _register_callback(typesafe_cb(void, (fn), void*, (arg)), (arg)) */ #define typesafe_cb(rtype, atype, fn, arg) \ typesafe_cb_cast(rtype (*)(atype), \ rtype (*)(__typeof__(arg)), \ (fn)) /** * typesafe_cb_preargs - cast a callback function if it matches the arg * @rtype: the return type of the callback function * @atype: the (pointer) type which the callback function expects. * @fn: the callback function to cast * @arg: the (pointer) argument to hand to the callback function. * * This is a version of typesafe_cb() for callbacks that take other arguments * before the @arg. * * Example: * void _register_callback(void (*fn)(int, void *arg), void *arg); * #define register_callback(fn, arg) \ * _register_callback(typesafe_cb_preargs(void, void *, \ * (fn), (arg), int), \ * (arg)) */ #define typesafe_cb_preargs(rtype, atype, fn, arg, ...) \ typesafe_cb_cast(rtype (*)(__VA_ARGS__, atype), \ rtype (*)(__VA_ARGS__, __typeof__(arg)), \ (fn)) /** * typesafe_cb_postargs - cast a callback function if it matches the arg * @rtype: the return type of the callback function * @atype: the (pointer) type which the callback function expects. * @fn: the callback function to cast * @arg: the (pointer) argument to hand to the callback function. * * This is a version of typesafe_cb() for callbacks that take other arguments * after the @arg. * * Example: * void _register_callback(void (*fn)(void *arg, int), void *arg); * #define register_callback(fn, arg) \ * _register_callback(typesafe_cb_postargs(void, (fn), void *, \ * (arg), int), \ * (arg)) */ #define typesafe_cb_postargs(rtype, atype, fn, arg, ...) \ typesafe_cb_cast(rtype (*)(atype, __VA_ARGS__), \ rtype (*)(__typeof__(arg), __VA_ARGS__), \ (fn)) #endif /* CCAN_CAST_IF_TYPE_H */ sbsigntool-0.6/lib/ccan/ccan/array_size/0000775000175000017500000000000012035660722015276 500000000000000sbsigntool-0.6/lib/ccan/ccan/array_size/array_size.h0000664000175000017500000000150012032345554017533 00000000000000#ifndef CCAN_ARRAY_SIZE_H #define CCAN_ARRAY_SIZE_H #include "config.h" #include /** * ARRAY_SIZE - get the number of elements in a visible array * @arr: the array whose size you want. * * This does not work on pointers, or arrays declared as [], or * function parameters. With correct compiler support, such usage * will cause a build error (see build_assert). */ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + _array_size_chk(arr)) #if HAVE_BUILTIN_TYPES_COMPATIBLE_P && HAVE_TYPEOF /* Two gcc extensions. * &a[0] degrades to a pointer: a different type from an array */ #define _array_size_chk(arr) \ BUILD_ASSERT_OR_ZERO(!__builtin_types_compatible_p(typeof(arr), \ typeof(&(arr)[0]))) #else #define _array_size_chk(arr) 0 #endif #endif /* CCAN_ALIGNOF_H */ sbsigntool-0.6/lib/ccan/ccan/compiler/0000775000175000017500000000000012035660722014740 500000000000000sbsigntool-0.6/lib/ccan/ccan/compiler/compiler.h0000664000175000017500000001263512032345554016652 00000000000000#ifndef CCAN_COMPILER_H #define CCAN_COMPILER_H #include "config.h" #ifndef COLD #if HAVE_ATTRIBUTE_COLD /** * COLD - a function is unlikely to be called. * * Used to mark an unlikely code path and optimize appropriately. * It is usually used on logging or error routines. * * Example: * static void COLD moan(const char *reason) * { * fprintf(stderr, "Error: %s (%s)\n", reason, strerror(errno)); * } */ #define COLD __attribute__((cold)) #else #define COLD #endif #endif #ifndef NORETURN #if HAVE_ATTRIBUTE_NORETURN /** * NORETURN - a function does not return * * Used to mark a function which exits; useful for suppressing warnings. * * Example: * static void NORETURN fail(const char *reason) * { * fprintf(stderr, "Error: %s (%s)\n", reason, strerror(errno)); * exit(1); * } */ #define NORETURN __attribute__((noreturn)) #else #define NORETURN #endif #endif #ifndef PRINTF_FMT #if HAVE_ATTRIBUTE_PRINTF /** * PRINTF_FMT - a function takes printf-style arguments * @nfmt: the 1-based number of the function's format argument. * @narg: the 1-based number of the function's first variable argument. * * This allows the compiler to check your parameters as it does for printf(). * * Example: * void PRINTF_FMT(2,3) my_printf(const char *prefix, const char *fmt, ...); */ #define PRINTF_FMT(nfmt, narg) \ __attribute__((format(__printf__, nfmt, narg))) #else #define PRINTF_FMT(nfmt, narg) #endif #endif #ifndef CONST_FUNCTION #if HAVE_ATTRIBUTE_CONST /** * CONST_FUNCTION - a function's return depends only on its argument * * This allows the compiler to assume that the function will return the exact * same value for the exact same arguments. This implies that the function * must not use global variables, or dereference pointer arguments. */ #define CONST_FUNCTION __attribute__((const)) #else #define CONST_FUNCTION #endif #endif #if HAVE_ATTRIBUTE_UNUSED #ifndef UNNEEDED /** * UNNEEDED - a variable/function may not be needed * * This suppresses warnings about unused variables or functions, but tells * the compiler that if it is unused it need not emit it into the source code. * * Example: * // With some preprocessor options, this is unnecessary. * static UNNEEDED int counter; * * // With some preprocessor options, this is unnecessary. * static UNNEEDED void add_to_counter(int add) * { * counter += add; * } */ #define UNNEEDED __attribute__((unused)) #endif #ifndef NEEDED #if HAVE_ATTRIBUTE_USED /** * NEEDED - a variable/function is needed * * This suppresses warnings about unused variables or functions, but tells * the compiler that it must exist even if it (seems) unused. * * Example: * // Even if this is unused, these are vital for debugging. * static NEEDED int counter; * static NEEDED void dump_counter(void) * { * printf("Counter is %i\n", counter); * } */ #define NEEDED __attribute__((used)) #else /* Before used, unused functions and vars were always emitted. */ #define NEEDED __attribute__((unused)) #endif #endif #ifndef UNUSED /** * UNUSED - a parameter is unused * * Some compilers (eg. gcc with -W or -Wunused) warn about unused * function parameters. This suppresses such warnings and indicates * to the reader that it's deliberate. * * Example: * // This is used as a callback, so needs to have this prototype. * static int some_callback(void *unused UNUSED) * { * return 0; * } */ #define UNUSED __attribute__((unused)) #endif #else #ifndef UNNEEDED #define UNNEEDED #endif #ifndef NEEDED #define NEEDED #endif #ifndef UNUSED #define UNUSED #endif #endif #ifndef IS_COMPILE_CONSTANT #if HAVE_BUILTIN_CONSTANT_P /** * IS_COMPILE_CONSTANT - does the compiler know the value of this expression? * @expr: the expression to evaluate * * When an expression manipulation is complicated, it is usually better to * implement it in a function. However, if the expression being manipulated is * known at compile time, it is better to have the compiler see the entire * expression so it can simply substitute the result. * * This can be done using the IS_COMPILE_CONSTANT() macro. * * Example: * enum greek { ALPHA, BETA, GAMMA, DELTA, EPSILON }; * * // Out-of-line version. * const char *greek_name(enum greek greek); * * // Inline version. * static inline const char *_greek_name(enum greek greek) * { * switch (greek) { * case ALPHA: return "alpha"; * case BETA: return "beta"; * case GAMMA: return "gamma"; * case DELTA: return "delta"; * case EPSILON: return "epsilon"; * default: return "**INVALID**"; * } * } * * // Use inline if compiler knows answer. Otherwise call function * // to avoid copies of the same code everywhere. * #define greek_name(g) \ * (IS_COMPILE_CONSTANT(greek) ? _greek_name(g) : greek_name(g)) */ #define IS_COMPILE_CONSTANT(expr) __builtin_constant_p(expr) #else /* If we don't know, assume it's not. */ #define IS_COMPILE_CONSTANT(expr) 0 #endif #endif #ifndef WARN_UNUSED_RESULT #if HAVE_WARN_UNUSED_RESULT /** * WARN_UNUSED_RESULT - warn if a function return value is unused. * * Used to mark a function where it is extremely unlikely that the caller * can ignore the result, eg realloc(). * * Example: * // buf param may be freed by this; need return value! * static char *WARN_UNUSED_RESULT enlarge(char *buf, unsigned *size) * { * return realloc(buf, (*size) *= 2); * } */ #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) #else #define WARN_UNUSED_RESULT #endif #endif #endif /* CCAN_COMPILER_H */ sbsigntool-0.6/lib/ccan/ccan/time/0000775000175000017500000000000012035660722014064 500000000000000sbsigntool-0.6/lib/ccan/ccan/time/time.c0000664000175000017500000000401012032345554015101 00000000000000/* Licensed under BSD-MIT - see LICENSE file for details */ #include #include #include struct timeval time_now(void) { struct timeval now; gettimeofday(&now, NULL); return now; } bool time_greater(struct timeval a, struct timeval b) { if (a.tv_sec > b.tv_sec) return true; else if (a.tv_sec < b.tv_sec) return false; return a.tv_usec > b.tv_usec; } bool time_less(struct timeval a, struct timeval b) { if (a.tv_sec < b.tv_sec) return true; else if (a.tv_sec > b.tv_sec) return false; return a.tv_usec < b.tv_usec; } bool time_eq(struct timeval a, struct timeval b) { return a.tv_sec == b.tv_sec && a.tv_usec == b.tv_usec; } struct timeval time_sub(struct timeval recent, struct timeval old) { struct timeval diff; diff.tv_sec = recent.tv_sec - old.tv_sec; if (old.tv_usec > recent.tv_usec) { diff.tv_sec--; diff.tv_usec = 1000000 + recent.tv_usec - old.tv_usec; } else diff.tv_usec = recent.tv_usec - old.tv_usec; assert(diff.tv_sec >= 0); return diff; } struct timeval time_add(struct timeval a, struct timeval b) { struct timeval sum; sum.tv_sec = a.tv_sec + b.tv_sec; sum.tv_usec = a.tv_usec + b.tv_usec; if (sum.tv_usec > 1000000) { sum.tv_sec++; sum.tv_usec -= 1000000; } return sum; } struct timeval time_divide(struct timeval t, unsigned long div) { return time_from_usec(time_to_usec(t) / div); } struct timeval time_multiply(struct timeval t, unsigned long mult) { return time_from_usec(time_to_usec(t) * mult); } uint64_t time_to_msec(struct timeval t) { uint64_t msec; msec = t.tv_usec / 1000 + (uint64_t)t.tv_sec * 1000; return msec; } uint64_t time_to_usec(struct timeval t) { uint64_t usec; usec = t.tv_usec + (uint64_t)t.tv_sec * 1000000; return usec; } struct timeval time_from_msec(uint64_t msec) { struct timeval t; t.tv_usec = (msec % 1000) * 1000; t.tv_sec = msec / 1000; return t; } struct timeval time_from_usec(uint64_t usec) { struct timeval t; t.tv_usec = usec % 1000000; t.tv_sec = usec / 1000000; return t; } sbsigntool-0.6/lib/ccan/ccan/time/time.h0000664000175000017500000001016012032345554015111 00000000000000/* Licensed under BSD-MIT - see LICENSE file for details */ #ifndef CCAN_TIME_H #define CCAN_TIME_H #include "config.h" #include #include #include /** * time_now - return the current time * * Example: * printf("Now is %lu seconds since epoch\n", (long)time_now().tv_sec); */ struct timeval time_now(void); /** * time_greater - is a after b? * @a: one time. * @b: another time. * * Example: * static bool timed_out(const struct timeval *start) * { * #define TIMEOUT time_from_msec(1000) * return time_greater(time_now(), time_add(*start, TIMEOUT)); * } */ bool time_greater(struct timeval a, struct timeval b); /** * time_less - is a before b? * @a: one time. * @b: another time. * * Example: * static bool still_valid(const struct timeval *start) * { * #define TIMEOUT time_from_msec(1000) * return time_less(time_now(), time_add(*start, TIMEOUT)); * } */ bool time_less(struct timeval a, struct timeval b); /** * time_eq - is a equal to b? * @a: one time. * @b: another time. * * Example: * #include * #include * * // Can we fork in under a microsecond? * static bool fast_fork(void) * { * struct timeval start = time_now(); * if (fork() != 0) { * exit(0); * } * wait(NULL); * return time_eq(start, time_now()); * } */ bool time_eq(struct timeval a, struct timeval b); /** * time_sub - subtract two times * @recent: the larger (more recent) time. * @old: the smaller (less recent) time. * * This returns a well formed struct timeval. * * Example: * static bool was_recent(const struct timeval *start) * { * return time_sub(time_now(), *start).tv_sec < 1; * } */ struct timeval time_sub(struct timeval recent, struct timeval old); /** * time_add - add two times * @a: one time. * @b: another time. * * The times must not overflow, or the results are undefined. * * Example: * // We do one every second. * static struct timeval next_time(void) * { * return time_add(time_now(), time_from_msec(1000)); * } */ struct timeval time_add(struct timeval a, struct timeval b); /** * time_divide - divide a time by a value. * @t: a time. * @div: number to divide it by. * * Example: * // How long does it take to do a fork? * static struct timeval forking_time(void) * { * struct timeval start = time_now(); * unsigned int i; * * for (i = 0; i < 1000; i++) { * if (fork() != 0) { * exit(0); * } * wait(NULL); * } * return time_divide(time_sub(time_now(), start), i); * } */ struct timeval time_divide(struct timeval t, unsigned long div); /** * time_multiply - multiply a time by a value. * @t: a time. * @mult: number to multiply it by. * * Example: * ... * printf("Time to do 100000 forks would be %u sec\n", * (unsigned)time_multiply(forking_time(), 1000000).tv_sec); */ struct timeval time_multiply(struct timeval t, unsigned long mult); /** * time_to_msec - return number of milliseconds * @t: a time * * It's often more convenient to deal with time values as * milliseconds. Note that this will fit into a 32-bit variable if * it's a time difference of less than ~7 weeks. * * Example: * ... * printf("Forking time is %u msec\n", * (unsigned)time_to_msec(forking_time())); */ uint64_t time_to_msec(struct timeval t); /** * time_to_usec - return number of microseconds * @t: a time * * It's often more convenient to deal with time values as * microseconds. Note that this will fit into a 32-bit variable if * it's a time difference of less than ~1 hour. * * Example: * ... * printf("Forking time is %u usec\n", * (unsigned)time_to_usec(forking_time())); * */ uint64_t time_to_usec(struct timeval t); /** * time_from_msec - convert milliseconds to a timeval * @msec: time in milliseconds * * Example: * // 1/2 second timeout * #define TIMEOUT time_from_msec(500) */ struct timeval time_from_msec(uint64_t msec); /** * time_from_usec - convert microseconds to a timeval * @usec: time in microseconds * * Example: * // 1/2 second timeout * #define TIMEOUT time_from_usec(500000) */ struct timeval time_from_usec(uint64_t usec); #endif /* CCAN_TIME_H */ sbsigntool-0.6/lib/ccan/ccan/hash/0000775000175000017500000000000012035660722014051 500000000000000sbsigntool-0.6/lib/ccan/ccan/hash/hash.c0000664000175000017500000007305112032345554015066 00000000000000/* ------------------------------------------------------------------------------- lookup3.c, by Bob Jenkins, May 2006, Public Domain. These are functions for producing 32-bit hashes for hash table lookup. hash_word(), hashlittle(), hashlittle2(), hashbig(), mix(), and final() are externally useful functions. Routines to test the hash are included if SELF_TEST is defined. You can use this free for any purpose. It's in the public domain. It has no warranty. You probably want to use hashlittle(). hashlittle() and hashbig() hash byte arrays. hashlittle() is is faster than hashbig() on little-endian machines. Intel and AMD are little-endian machines. On second thought, you probably want hashlittle2(), which is identical to hashlittle() except it returns two 32-bit hashes for the price of one. You could implement hashbig2() if you wanted but I haven't bothered here. If you want to find a hash of, say, exactly 7 integers, do a = i1; b = i2; c = i3; mix(a,b,c); a += i4; b += i5; c += i6; mix(a,b,c); a += i7; final(a,b,c); then use c as the hash value. If you have a variable length array of 4-byte integers to hash, use hash_word(). If you have a byte array (like a character string), use hashlittle(). If you have several byte arrays, or a mix of things, see the comments above hashlittle(). Why is this so big? I read 12 bytes at a time into 3 4-byte integers, then mix those integers. This is fast (you can do a lot more thorough mixing with 12*3 instructions on 3 integers than you can with 3 instructions on 1 byte), but shoehorning those bytes into integers efficiently is messy. ------------------------------------------------------------------------------- */ //#define SELF_TEST 1 #if 0 #include /* defines printf for tests */ #include /* defines time_t for timings in the test */ #include /* defines uint32_t etc */ #include /* attempt to define endianness */ #ifdef linux # include /* attempt to define endianness */ #endif /* * My best guess at if you are big-endian or little-endian. This may * need adjustment. */ #if (defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && \ __BYTE_ORDER == __LITTLE_ENDIAN) || \ (defined(i386) || defined(__i386__) || defined(__i486__) || \ defined(__i586__) || defined(__i686__) || defined(__x86_64) || \ defined(vax) || defined(MIPSEL)) # define HASH_LITTLE_ENDIAN 1 # define HASH_BIG_ENDIAN 0 #elif (defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && \ __BYTE_ORDER == __BIG_ENDIAN) || \ (defined(sparc) || defined(POWERPC) || defined(mc68000) || defined(sel)) # define HASH_LITTLE_ENDIAN 0 # define HASH_BIG_ENDIAN 1 #else # error Unknown endian #endif #endif /* old hash.c headers. */ #include "hash.h" #if HAVE_LITTLE_ENDIAN #define HASH_LITTLE_ENDIAN 1 #define HASH_BIG_ENDIAN 0 #elif HAVE_BIG_ENDIAN #define HASH_LITTLE_ENDIAN 0 #define HASH_BIG_ENDIAN 1 #else #error Unknown endian #endif #define hashsize(n) ((uint32_t)1<<(n)) #define hashmask(n) (hashsize(n)-1) #define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) /* ------------------------------------------------------------------------------- mix -- mix 3 32-bit values reversibly. This is reversible, so any information in (a,b,c) before mix() is still in (a,b,c) after mix(). If four pairs of (a,b,c) inputs are run through mix(), or through mix() in reverse, there are at least 32 bits of the output that are sometimes the same for one pair and different for another pair. This was tested for: * pairs that differed by one bit, by two bits, in any combination of top bits of (a,b,c), or in any combination of bottom bits of (a,b,c). * "differ" is defined as +, -, ^, or ~^. For + and -, I transformed the output delta to a Gray code (a^(a>>1)) so a string of 1's (as is commonly produced by subtraction) look like a single 1-bit difference. * the base values were pseudorandom, all zero but one bit set, or all zero plus a counter that starts at zero. Some k values for my "a-=c; a^=rot(c,k); c+=b;" arrangement that satisfy this are 4 6 8 16 19 4 9 15 3 18 27 15 14 9 3 7 17 3 Well, "9 15 3 18 27 15" didn't quite get 32 bits diffing for "differ" defined as + with a one-bit base and a two-bit delta. I used http://burtleburtle.net/bob/hash/avalanche.html to choose the operations, constants, and arrangements of the variables. This does not achieve avalanche. There are input bits of (a,b,c) that fail to affect some output bits of (a,b,c), especially of a. The most thoroughly mixed value is c, but it doesn't really even achieve avalanche in c. This allows some parallelism. Read-after-writes are good at doubling the number of bits affected, so the goal of mixing pulls in the opposite direction as the goal of parallelism. I did what I could. Rotates seem to cost as much as shifts on every machine I could lay my hands on, and rotates are much kinder to the top and bottom bits, so I used rotates. ------------------------------------------------------------------------------- */ #define mix(a,b,c) \ { \ a -= c; a ^= rot(c, 4); c += b; \ b -= a; b ^= rot(a, 6); a += c; \ c -= b; c ^= rot(b, 8); b += a; \ a -= c; a ^= rot(c,16); c += b; \ b -= a; b ^= rot(a,19); a += c; \ c -= b; c ^= rot(b, 4); b += a; \ } /* ------------------------------------------------------------------------------- final -- final mixing of 3 32-bit values (a,b,c) into c Pairs of (a,b,c) values differing in only a few bits will usually produce values of c that look totally different. This was tested for * pairs that differed by one bit, by two bits, in any combination of top bits of (a,b,c), or in any combination of bottom bits of (a,b,c). * "differ" is defined as +, -, ^, or ~^. For + and -, I transformed the output delta to a Gray code (a^(a>>1)) so a string of 1's (as is commonly produced by subtraction) look like a single 1-bit difference. * the base values were pseudorandom, all zero but one bit set, or all zero plus a counter that starts at zero. These constants passed: 14 11 25 16 4 14 24 12 14 25 16 4 14 24 and these came close: 4 8 15 26 3 22 24 10 8 15 26 3 22 24 11 8 15 26 3 22 24 ------------------------------------------------------------------------------- */ #define final(a,b,c) \ { \ c ^= b; c -= rot(b,14); \ a ^= c; a -= rot(c,11); \ b ^= a; b -= rot(a,25); \ c ^= b; c -= rot(b,16); \ a ^= c; a -= rot(c,4); \ b ^= a; b -= rot(a,14); \ c ^= b; c -= rot(b,24); \ } /* -------------------------------------------------------------------- This works on all machines. To be useful, it requires -- that the key be an array of uint32_t's, and -- that the length be the number of uint32_t's in the key The function hash_word() is identical to hashlittle() on little-endian machines, and identical to hashbig() on big-endian machines, except that the length has to be measured in uint32_ts rather than in bytes. hashlittle() is more complicated than hash_word() only because hashlittle() has to dance around fitting the key bytes into registers. -------------------------------------------------------------------- */ uint32_t hash_u32( const uint32_t *k, /* the key, an array of uint32_t values */ size_t length, /* the length of the key, in uint32_ts */ uint32_t initval) /* the previous hash, or an arbitrary value */ { uint32_t a,b,c; /* Set up the internal state */ a = b = c = 0xdeadbeef + (((uint32_t)length)<<2) + initval; /*------------------------------------------------- handle most of the key */ while (length > 3) { a += k[0]; b += k[1]; c += k[2]; mix(a,b,c); length -= 3; k += 3; } /*------------------------------------------- handle the last 3 uint32_t's */ switch(length) /* all the case statements fall through */ { case 3 : c+=k[2]; case 2 : b+=k[1]; case 1 : a+=k[0]; final(a,b,c); case 0: /* case 0: nothing left to add */ break; } /*------------------------------------------------------ report the result */ return c; } /* ------------------------------------------------------------------------------- hashlittle() -- hash a variable-length key into a 32-bit value k : the key (the unaligned variable-length array of bytes) length : the length of the key, counting by bytes val2 : IN: can be any 4-byte value OUT: second 32 bit hash. Returns a 32-bit value. Every bit of the key affects every bit of the return value. Two keys differing by one or two bits will have totally different hash values. Note that the return value is better mixed than val2, so use that first. The best hash table sizes are powers of 2. There is no need to do mod a prime (mod is sooo slow!). If you need less than 32 bits, use a bitmask. For example, if you need only 10 bits, do h = (h & hashmask(10)); In which case, the hash table should have hashsize(10) elements. If you are hashing n strings (uint8_t **)k, do it like this: for (i=0, h=0; i 12) { a += k[0]; b += k[1]; c += k[2]; mix(a,b,c); length -= 12; k += 3; } /*----------------------------- handle the last (probably partial) block */ /* * "k[2]&0xffffff" actually reads beyond the end of the string, but * then masks off the part it's not allowed to read. Because the * string is aligned, the masked-off tail is in the same word as the * rest of the string. Every machine with memory protection I've seen * does it on word boundaries, so is OK with this. But VALGRIND will * still catch it and complain. The masking trick does make the hash * noticably faster for short strings (like English words). * * Not on my testing with gcc 4.5 on an intel i5 CPU, at least --RR. */ #if 0 switch(length) { case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; case 11: c+=k[2]&0xffffff; b+=k[1]; a+=k[0]; break; case 10: c+=k[2]&0xffff; b+=k[1]; a+=k[0]; break; case 9 : c+=k[2]&0xff; b+=k[1]; a+=k[0]; break; case 8 : b+=k[1]; a+=k[0]; break; case 7 : b+=k[1]&0xffffff; a+=k[0]; break; case 6 : b+=k[1]&0xffff; a+=k[0]; break; case 5 : b+=k[1]&0xff; a+=k[0]; break; case 4 : a+=k[0]; break; case 3 : a+=k[0]&0xffffff; break; case 2 : a+=k[0]&0xffff; break; case 1 : a+=k[0]&0xff; break; case 0 : return c; /* zero length strings require no mixing */ } #else /* make valgrind happy */ k8 = (const uint8_t *)k; switch(length) { case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; case 11: c+=((uint32_t)k8[10])<<16; /* fall through */ case 10: c+=((uint32_t)k8[9])<<8; /* fall through */ case 9 : c+=k8[8]; /* fall through */ case 8 : b+=k[1]; a+=k[0]; break; case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */ case 6 : b+=((uint32_t)k8[5])<<8; /* fall through */ case 5 : b+=k8[4]; /* fall through */ case 4 : a+=k[0]; break; case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */ case 2 : a+=((uint32_t)k8[1])<<8; /* fall through */ case 1 : a+=k8[0]; break; case 0 : return c; } #endif /* !valgrind */ } else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) { const uint16_t *k = (const uint16_t *)key; /* read 16-bit chunks */ const uint8_t *k8; /*--------------- all but last block: aligned reads and different mixing */ while (length > 12) { a += k[0] + (((uint32_t)k[1])<<16); b += k[2] + (((uint32_t)k[3])<<16); c += k[4] + (((uint32_t)k[5])<<16); mix(a,b,c); length -= 12; k += 6; } /*----------------------------- handle the last (probably partial) block */ k8 = (const uint8_t *)k; switch(length) { case 12: c+=k[4]+(((uint32_t)k[5])<<16); b+=k[2]+(((uint32_t)k[3])<<16); a+=k[0]+(((uint32_t)k[1])<<16); break; case 11: c+=((uint32_t)k8[10])<<16; /* fall through */ case 10: c+=k[4]; b+=k[2]+(((uint32_t)k[3])<<16); a+=k[0]+(((uint32_t)k[1])<<16); break; case 9 : c+=k8[8]; /* fall through */ case 8 : b+=k[2]+(((uint32_t)k[3])<<16); a+=k[0]+(((uint32_t)k[1])<<16); break; case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */ case 6 : b+=k[2]; a+=k[0]+(((uint32_t)k[1])<<16); break; case 5 : b+=k8[4]; /* fall through */ case 4 : a+=k[0]+(((uint32_t)k[1])<<16); break; case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */ case 2 : a+=k[0]; break; case 1 : a+=k8[0]; break; case 0 : return c; /* zero length requires no mixing */ } } else { /* need to read the key one byte at a time */ const uint8_t *k = (const uint8_t *)key; /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ while (length > 12) { a += k[0]; a += ((uint32_t)k[1])<<8; a += ((uint32_t)k[2])<<16; a += ((uint32_t)k[3])<<24; b += k[4]; b += ((uint32_t)k[5])<<8; b += ((uint32_t)k[6])<<16; b += ((uint32_t)k[7])<<24; c += k[8]; c += ((uint32_t)k[9])<<8; c += ((uint32_t)k[10])<<16; c += ((uint32_t)k[11])<<24; mix(a,b,c); length -= 12; k += 12; } /*-------------------------------- last block: affect all 32 bits of (c) */ switch(length) /* all the case statements fall through */ { case 12: c+=((uint32_t)k[11])<<24; case 11: c+=((uint32_t)k[10])<<16; case 10: c+=((uint32_t)k[9])<<8; case 9 : c+=k[8]; case 8 : b+=((uint32_t)k[7])<<24; case 7 : b+=((uint32_t)k[6])<<16; case 6 : b+=((uint32_t)k[5])<<8; case 5 : b+=k[4]; case 4 : a+=((uint32_t)k[3])<<24; case 3 : a+=((uint32_t)k[2])<<16; case 2 : a+=((uint32_t)k[1])<<8; case 1 : a+=k[0]; break; case 0 : return c; } } final(a,b,c); *val2 = b; return c; } /* * hashbig(): * This is the same as hash_word() on big-endian machines. It is different * from hashlittle() on all machines. hashbig() takes advantage of * big-endian byte ordering. */ static uint32_t hashbig( const void *key, size_t length, uint32_t *val2) { uint32_t a,b,c; union { const void *ptr; size_t i; } u; /* to cast key to (size_t) happily */ /* Set up the internal state */ a = b = c = 0xdeadbeef + ((uint32_t)length) + *val2; u.ptr = key; if (HASH_BIG_ENDIAN && ((u.i & 0x3) == 0)) { const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */ const uint8_t *k8; /*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */ while (length > 12) { a += k[0]; b += k[1]; c += k[2]; mix(a,b,c); length -= 12; k += 3; } /*----------------------------- handle the last (probably partial) block */ /* * "k[2]<<8" actually reads beyond the end of the string, but * then shifts out the part it's not allowed to read. Because the * string is aligned, the illegal read is in the same word as the * rest of the string. Every machine with memory protection I've seen * does it on word boundaries, so is OK with this. But VALGRIND will * still catch it and complain. The masking trick does make the hash * noticably faster for short strings (like English words). * * Not on my testing with gcc 4.5 on an intel i5 CPU, at least --RR. */ #if 0 switch(length) { case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; case 11: c+=k[2]&0xffffff00; b+=k[1]; a+=k[0]; break; case 10: c+=k[2]&0xffff0000; b+=k[1]; a+=k[0]; break; case 9 : c+=k[2]&0xff000000; b+=k[1]; a+=k[0]; break; case 8 : b+=k[1]; a+=k[0]; break; case 7 : b+=k[1]&0xffffff00; a+=k[0]; break; case 6 : b+=k[1]&0xffff0000; a+=k[0]; break; case 5 : b+=k[1]&0xff000000; a+=k[0]; break; case 4 : a+=k[0]; break; case 3 : a+=k[0]&0xffffff00; break; case 2 : a+=k[0]&0xffff0000; break; case 1 : a+=k[0]&0xff000000; break; case 0 : return c; /* zero length strings require no mixing */ } #else /* make valgrind happy */ k8 = (const uint8_t *)k; switch(length) /* all the case statements fall through */ { case 12: c+=k[2]; b+=k[1]; a+=k[0]; break; case 11: c+=((uint32_t)k8[10])<<8; /* fall through */ case 10: c+=((uint32_t)k8[9])<<16; /* fall through */ case 9 : c+=((uint32_t)k8[8])<<24; /* fall through */ case 8 : b+=k[1]; a+=k[0]; break; case 7 : b+=((uint32_t)k8[6])<<8; /* fall through */ case 6 : b+=((uint32_t)k8[5])<<16; /* fall through */ case 5 : b+=((uint32_t)k8[4])<<24; /* fall through */ case 4 : a+=k[0]; break; case 3 : a+=((uint32_t)k8[2])<<8; /* fall through */ case 2 : a+=((uint32_t)k8[1])<<16; /* fall through */ case 1 : a+=((uint32_t)k8[0])<<24; break; case 0 : return c; } #endif /* !VALGRIND */ } else { /* need to read the key one byte at a time */ const uint8_t *k = (const uint8_t *)key; /*--------------- all but the last block: affect some 32 bits of (a,b,c) */ while (length > 12) { a += ((uint32_t)k[0])<<24; a += ((uint32_t)k[1])<<16; a += ((uint32_t)k[2])<<8; a += ((uint32_t)k[3]); b += ((uint32_t)k[4])<<24; b += ((uint32_t)k[5])<<16; b += ((uint32_t)k[6])<<8; b += ((uint32_t)k[7]); c += ((uint32_t)k[8])<<24; c += ((uint32_t)k[9])<<16; c += ((uint32_t)k[10])<<8; c += ((uint32_t)k[11]); mix(a,b,c); length -= 12; k += 12; } /*-------------------------------- last block: affect all 32 bits of (c) */ switch(length) /* all the case statements fall through */ { case 12: c+=k[11]; case 11: c+=((uint32_t)k[10])<<8; case 10: c+=((uint32_t)k[9])<<16; case 9 : c+=((uint32_t)k[8])<<24; case 8 : b+=k[7]; case 7 : b+=((uint32_t)k[6])<<8; case 6 : b+=((uint32_t)k[5])<<16; case 5 : b+=((uint32_t)k[4])<<24; case 4 : a+=k[3]; case 3 : a+=((uint32_t)k[2])<<8; case 2 : a+=((uint32_t)k[1])<<16; case 1 : a+=((uint32_t)k[0])<<24; break; case 0 : return c; } } final(a,b,c); *val2 = b; return c; } /* I basically use hashlittle here, but use native endian within each * element. This delivers least-surprise: hash such as "int arr[] = { * 1, 2 }; hash_stable(arr, 2, 0);" will be the same on big and little * endian machines, even though a bytewise hash wouldn't be. */ uint64_t hash64_stable_64(const void *key, size_t n, uint64_t base) { const uint64_t *k = key; uint32_t a,b,c; /* Set up the internal state */ a = b = c = 0xdeadbeef + ((uint32_t)n*8) + (base >> 32) + base; while (n > 3) { a += (uint32_t)k[0]; b += (uint32_t)(k[0] >> 32); c += (uint32_t)k[1]; mix(a,b,c); a += (uint32_t)(k[1] >> 32); b += (uint32_t)k[2]; c += (uint32_t)(k[2] >> 32); mix(a,b,c); n -= 3; k += 3; } switch (n) { case 2: a += (uint32_t)k[0]; b += (uint32_t)(k[0] >> 32); c += (uint32_t)k[1]; mix(a,b,c); a += (uint32_t)(k[1] >> 32); break; case 1: a += (uint32_t)k[0]; b += (uint32_t)(k[0] >> 32); break; case 0: return c; } final(a,b,c); return ((uint64_t)b << 32) | c; } uint64_t hash64_stable_32(const void *key, size_t n, uint64_t base) { const uint32_t *k = key; uint32_t a,b,c; /* Set up the internal state */ a = b = c = 0xdeadbeef + ((uint32_t)n*4) + (base >> 32) + base; while (n > 3) { a += k[0]; b += k[1]; c += k[2]; mix(a,b,c); n -= 3; k += 3; } switch (n) { case 2: b += (uint32_t)k[1]; case 1: a += (uint32_t)k[0]; break; case 0: return c; } final(a,b,c); return ((uint64_t)b << 32) | c; } uint64_t hash64_stable_16(const void *key, size_t n, uint64_t base) { const uint16_t *k = key; uint32_t a,b,c; /* Set up the internal state */ a = b = c = 0xdeadbeef + ((uint32_t)n*2) + (base >> 32) + base; while (n > 6) { a += (uint32_t)k[0] + ((uint32_t)k[1] << 16); b += (uint32_t)k[2] + ((uint32_t)k[3] << 16); c += (uint32_t)k[4] + ((uint32_t)k[5] << 16); mix(a,b,c); n -= 6; k += 6; } switch (n) { case 5: c += (uint32_t)k[4]; case 4: b += ((uint32_t)k[3] << 16); case 3: b += (uint32_t)k[2]; case 2: a += ((uint32_t)k[1] << 16); case 1: a += (uint32_t)k[0]; break; case 0: return c; } final(a,b,c); return ((uint64_t)b << 32) | c; } uint64_t hash64_stable_8(const void *key, size_t n, uint64_t base) { uint32_t b32 = base + (base >> 32); uint32_t lower = hashlittle(key, n, &b32); return ((uint64_t)b32 << 32) | lower; } uint32_t hash_any(const void *key, size_t length, uint32_t base) { if (HASH_BIG_ENDIAN) return hashbig(key, length, &base); else return hashlittle(key, length, &base); } uint32_t hash_stable_64(const void *key, size_t n, uint32_t base) { return hash64_stable_64(key, n, base); } uint32_t hash_stable_32(const void *key, size_t n, uint32_t base) { return hash64_stable_32(key, n, base); } uint32_t hash_stable_16(const void *key, size_t n, uint32_t base) { return hash64_stable_16(key, n, base); } uint32_t hash_stable_8(const void *key, size_t n, uint32_t base) { return hashlittle(key, n, &base); } /* Jenkins' lookup8 is a 64 bit hash, but he says it's obsolete. Use * the plain one and recombine into 64 bits. */ uint64_t hash64_any(const void *key, size_t length, uint64_t base) { uint32_t b32 = base + (base >> 32); uint32_t lower; if (HASH_BIG_ENDIAN) lower = hashbig(key, length, &b32); else lower = hashlittle(key, length, &b32); return ((uint64_t)b32 << 32) | lower; } #ifdef SELF_TEST /* used for timings */ void driver1() { uint8_t buf[256]; uint32_t i; uint32_t h=0; time_t a,z; time(&a); for (i=0; i<256; ++i) buf[i] = 'x'; for (i=0; i<1; ++i) { h = hashlittle(&buf[0],1,h); } time(&z); if (z-a > 0) printf("time %d %.8x\n", z-a, h); } /* check that every input bit changes every output bit half the time */ #define HASHSTATE 1 #define HASHLEN 1 #define MAXPAIR 60 #define MAXLEN 70 void driver2() { uint8_t qa[MAXLEN+1], qb[MAXLEN+2], *a = &qa[0], *b = &qb[1]; uint32_t c[HASHSTATE], d[HASHSTATE], i=0, j=0, k, l, m=0, z; uint32_t e[HASHSTATE],f[HASHSTATE],g[HASHSTATE],h[HASHSTATE]; uint32_t x[HASHSTATE],y[HASHSTATE]; uint32_t hlen; printf("No more than %d trials should ever be needed \n",MAXPAIR/2); for (hlen=0; hlen < MAXLEN; ++hlen) { z=0; for (i=0; i>(8-j)); c[0] = hashlittle(a, hlen, m); b[i] ^= ((k+1)<>(8-j)); d[0] = hashlittle(b, hlen, m); /* check every bit is 1, 0, set, and not set at least once */ for (l=0; lz) z=k; if (k==MAXPAIR) { printf("Some bit didn't change: "); printf("%.8x %.8x %.8x %.8x %.8x %.8x ", e[0],f[0],g[0],h[0],x[0],y[0]); printf("i %d j %d m %d len %d\n", i, j, m, hlen); } if (z==MAXPAIR) goto done; } } } done: if (z < MAXPAIR) { printf("Mix success %2d bytes %2d initvals ",i,m); printf("required %d trials\n", z/2); } } printf("\n"); } /* Check for reading beyond the end of the buffer and alignment problems */ void driver3() { uint8_t buf[MAXLEN+20], *b; uint32_t len; uint8_t q[] = "This is the time for all good men to come to the aid of their country..."; uint32_t h; uint8_t qq[] = "xThis is the time for all good men to come to the aid of their country..."; uint32_t i; uint8_t qqq[] = "xxThis is the time for all good men to come to the aid of their country..."; uint32_t j; uint8_t qqqq[] = "xxxThis is the time for all good men to come to the aid of their country..."; uint32_t ref,x,y; uint8_t *p; printf("Endianness. These lines should all be the same (for values filled in):\n"); printf("%.8x %.8x %.8x\n", hash_word((const uint32_t *)q, (sizeof(q)-1)/4, 13), hash_word((const uint32_t *)q, (sizeof(q)-5)/4, 13), hash_word((const uint32_t *)q, (sizeof(q)-9)/4, 13)); p = q; printf("%.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x\n", hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13), hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13), hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13), hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13), hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13), hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13)); p = &qq[1]; printf("%.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x\n", hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13), hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13), hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13), hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13), hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13), hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13)); p = &qqq[2]; printf("%.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x\n", hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13), hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13), hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13), hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13), hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13), hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13)); p = &qqqq[3]; printf("%.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x %.8x\n", hashlittle(p, sizeof(q)-1, 13), hashlittle(p, sizeof(q)-2, 13), hashlittle(p, sizeof(q)-3, 13), hashlittle(p, sizeof(q)-4, 13), hashlittle(p, sizeof(q)-5, 13), hashlittle(p, sizeof(q)-6, 13), hashlittle(p, sizeof(q)-7, 13), hashlittle(p, sizeof(q)-8, 13), hashlittle(p, sizeof(q)-9, 13), hashlittle(p, sizeof(q)-10, 13), hashlittle(p, sizeof(q)-11, 13), hashlittle(p, sizeof(q)-12, 13)); printf("\n"); /* check that hashlittle2 and hashlittle produce the same results */ i=47; j=0; hashlittle2(q, sizeof(q), &i, &j); if (hashlittle(q, sizeof(q), 47) != i) printf("hashlittle2 and hashlittle mismatch\n"); /* check that hash_word2 and hash_word produce the same results */ len = 0xdeadbeef; i=47, j=0; hash_word2(&len, 1, &i, &j); if (hash_word(&len, 1, 47) != i) printf("hash_word2 and hash_word mismatch %x %x\n", i, hash_word(&len, 1, 47)); /* check hashlittle doesn't read before or after the ends of the string */ for (h=0, b=buf+1; h<8; ++h, ++b) { for (i=0; i #include #include /* Stolen mostly from: lookup3.c, by Bob Jenkins, May 2006, Public Domain. * * http://burtleburtle.net/bob/c/lookup3.c */ /** * hash - fast hash of an array for internal use * @p: the array or pointer to first element * @num: the number of elements to hash * @base: the base number to roll into the hash (usually 0) * * The memory region pointed to by p is combined with the base to form * a 32-bit hash. * * This hash will have different results on different machines, so is * only useful for internal hashes (ie. not hashes sent across the * network or saved to disk). * * It may also change with future versions: it could even detect at runtime * what the fastest hash to use is. * * See also: hash64, hash_stable. * * Example: * #include * #include * #include * #include * * // Simple demonstration: idential strings will have the same hash, but * // two different strings will probably not. * int main(int argc, char *argv[]) * { * uint32_t hash1, hash2; * * if (argc != 3) * err(1, "Usage: %s ", argv[0]); * * hash1 = hash(argv[1], strlen(argv[1]), 0); * hash2 = hash(argv[2], strlen(argv[2]), 0); * printf("Hash is %s\n", hash1 == hash2 ? "same" : "different"); * return 0; * } */ #define hash(p, num, base) hash_any((p), (num)*sizeof(*(p)), (base)) /** * hash_stable - hash of an array for external use * @p: the array or pointer to first element * @num: the number of elements to hash * @base: the base number to roll into the hash (usually 0) * * The array of simple integer types pointed to by p is combined with * the base to form a 32-bit hash. * * This hash will have the same results on different machines, so can * be used for external hashes (ie. hashes sent across the network or * saved to disk). The results will not change in future versions of * this module. * * Note that it is only legal to hand an array of simple integer types * to this hash (ie. char, uint16_t, int64_t, etc). In these cases, * the same values will have the same hash result, even though the * memory representations of integers depend on the machine * endianness. * * See also: * hash64_stable * * Example: * #include * #include * #include * #include * * int main(int argc, char *argv[]) * { * if (argc != 2) * err(1, "Usage: %s ", argv[0]); * * printf("Hash stable result is %u\n", * hash_stable(argv[1], strlen(argv[1]), 0)); * return 0; * } */ #define hash_stable(p, num, base) \ (BUILD_ASSERT_OR_ZERO(sizeof(*(p)) == 8 || sizeof(*(p)) == 4 \ || sizeof(*(p)) == 2 || sizeof(*(p)) == 1) + \ sizeof(*(p)) == 8 ? hash_stable_64((p), (num), (base)) \ : sizeof(*(p)) == 4 ? hash_stable_32((p), (num), (base)) \ : sizeof(*(p)) == 2 ? hash_stable_16((p), (num), (base)) \ : hash_stable_8((p), (num), (base))) /** * hash_u32 - fast hash an array of 32-bit values for internal use * @key: the array of uint32_t * @num: the number of elements to hash * @base: the base number to roll into the hash (usually 0) * * The array of uint32_t pointed to by @key is combined with the base * to form a 32-bit hash. This is 2-3 times faster than hash() on small * arrays, but the advantage vanishes over large hashes. * * This hash will have different results on different machines, so is * only useful for internal hashes (ie. not hashes sent across the * network or saved to disk). */ uint32_t hash_u32(const uint32_t *key, size_t num, uint32_t base); /** * hash_string - very fast hash of an ascii string * @str: the nul-terminated string * * The string is hashed, using a hash function optimized for ASCII and * similar strings. It's weaker than the other hash functions. * * This hash may have different results on different machines, so is * only useful for internal hashes (ie. not hashes sent across the * network or saved to disk). The results will be different from the * other hash functions in this module, too. */ static inline uint32_t hash_string(const char *string) { /* This is Karl Nelson 's X31 hash. * It's a little faster than the (much better) lookup3 hash(): 56ns vs * 84ns on my 2GHz Intel Core Duo 2 laptop for a 10 char string. */ uint32_t ret; for (ret = 0; *string; string++) ret = (ret << 5) - ret + *string; return ret; } /** * hash64 - fast 64-bit hash of an array for internal use * @p: the array or pointer to first element * @num: the number of elements to hash * @base: the 64-bit base number to roll into the hash (usually 0) * * The memory region pointed to by p is combined with the base to form * a 64-bit hash. * * This hash will have different results on different machines, so is * only useful for internal hashes (ie. not hashes sent across the * network or saved to disk). * * It may also change with future versions: it could even detect at runtime * what the fastest hash to use is. * * See also: hash. * * Example: * #include * #include * #include * #include * * // Simple demonstration: idential strings will have the same hash, but * // two different strings will probably not. * int main(int argc, char *argv[]) * { * uint64_t hash1, hash2; * * if (argc != 3) * err(1, "Usage: %s ", argv[0]); * * hash1 = hash64(argv[1], strlen(argv[1]), 0); * hash2 = hash64(argv[2], strlen(argv[2]), 0); * printf("Hash is %s\n", hash1 == hash2 ? "same" : "different"); * return 0; * } */ #define hash64(p, num, base) hash64_any((p), (num)*sizeof(*(p)), (base)) /** * hash64_stable - 64 bit hash of an array for external use * @p: the array or pointer to first element * @num: the number of elements to hash * @base: the base number to roll into the hash (usually 0) * * The array of simple integer types pointed to by p is combined with * the base to form a 64-bit hash. * * This hash will have the same results on different machines, so can * be used for external hashes (ie. hashes sent across the network or * saved to disk). The results will not change in future versions of * this module. * * Note that it is only legal to hand an array of simple integer types * to this hash (ie. char, uint16_t, int64_t, etc). In these cases, * the same values will have the same hash result, even though the * memory representations of integers depend on the machine * endianness. * * See also: * hash_stable * * Example: * #include * #include * #include * #include * * int main(int argc, char *argv[]) * { * if (argc != 2) * err(1, "Usage: %s ", argv[0]); * * printf("Hash stable result is %llu\n", * (long long)hash64_stable(argv[1], strlen(argv[1]), 0)); * return 0; * } */ #define hash64_stable(p, num, base) \ (BUILD_ASSERT_OR_ZERO(sizeof(*(p)) == 8 || sizeof(*(p)) == 4 \ || sizeof(*(p)) == 2 || sizeof(*(p)) == 1) + \ sizeof(*(p)) == 8 ? hash64_stable_64((p), (num), (base)) \ : sizeof(*(p)) == 4 ? hash64_stable_32((p), (num), (base)) \ : sizeof(*(p)) == 2 ? hash64_stable_16((p), (num), (base)) \ : hash64_stable_8((p), (num), (base))) /** * hashl - fast 32/64-bit hash of an array for internal use * @p: the array or pointer to first element * @num: the number of elements to hash * @base: the base number to roll into the hash (usually 0) * * This is either hash() or hash64(), on 32/64 bit long machines. */ #define hashl(p, num, base) \ (BUILD_ASSERT_OR_ZERO(sizeof(long) == sizeof(uint32_t) \ || sizeof(long) == sizeof(uint64_t)) + \ (sizeof(long) == sizeof(uint64_t) \ ? hash64((p), (num), (base)) : hash((p), (num), (base)))) /* Our underlying operations. */ uint32_t hash_any(const void *key, size_t length, uint32_t base); uint32_t hash_stable_64(const void *key, size_t n, uint32_t base); uint32_t hash_stable_32(const void *key, size_t n, uint32_t base); uint32_t hash_stable_16(const void *key, size_t n, uint32_t base); uint32_t hash_stable_8(const void *key, size_t n, uint32_t base); uint64_t hash64_any(const void *key, size_t length, uint64_t base); uint64_t hash64_stable_64(const void *key, size_t n, uint64_t base); uint64_t hash64_stable_32(const void *key, size_t n, uint64_t base); uint64_t hash64_stable_16(const void *key, size_t n, uint64_t base); uint64_t hash64_stable_8(const void *key, size_t n, uint64_t base); /** * hash_pointer - hash a pointer for internal use * @p: the pointer value to hash * @base: the base number to roll into the hash (usually 0) * * The pointer p (not what p points to!) is combined with the base to form * a 32-bit hash. * * This hash will have different results on different machines, so is * only useful for internal hashes (ie. not hashes sent across the * network or saved to disk). * * Example: * #include * * // Code to keep track of memory regions. * struct region { * struct region *chain; * void *start; * unsigned int size; * }; * // We keep a simple hash table. * static struct region *region_hash[128]; * * static void add_region(struct region *r) * { * unsigned int h = hash_pointer(r->start, 0); * * r->chain = region_hash[h]; * region_hash[h] = r->chain; * } * * static struct region *find_region(const void *start) * { * struct region *r; * * for (r = region_hash[hash_pointer(start, 0)]; r; r = r->chain) * if (r->start == start) * return r; * return NULL; * } */ static inline uint32_t hash_pointer(const void *p, uint32_t base) { if (sizeof(p) % sizeof(uint32_t) == 0) { /* This convoluted union is the right way of aliasing. */ union { uint32_t u32[sizeof(p) / sizeof(uint32_t)]; const void *p; } u; u.p = p; return hash_u32(u.u32, sizeof(p) / sizeof(uint32_t), base); } else return hash(&p, 1, base); } #endif /* HASH_H */ sbsigntool-0.6/lib/ccan/ccan/list/0000775000175000017500000000000012035660722014101 500000000000000sbsigntool-0.6/lib/ccan/ccan/list/list.c0000664000175000017500000000175212032345554015145 00000000000000/* Licensed under LGPLv2.1+ - see LICENSE file for details */ #include #include #include "list.h" static void *corrupt(const char *abortstr, const struct list_node *head, const struct list_node *node, unsigned int count) { if (abortstr) { fprintf(stderr, "%s: prev corrupt in node %p (%u) of %p\n", abortstr, node, count, head); abort(); } return NULL; } struct list_node *list_check_node(const struct list_node *node, const char *abortstr) { const struct list_node *p, *n; int count = 0; for (p = node, n = node->next; n != node; p = n, n = n->next) { count++; if (n->prev != p) return corrupt(abortstr, node, n, count); } /* Check prev on head node. */ if (node->prev != p) return corrupt(abortstr, node, node, 0); return (struct list_node *)node; } struct list_head *list_check(const struct list_head *h, const char *abortstr) { if (!list_check_node(&h->n, abortstr)) return NULL; return (struct list_head *)h; } sbsigntool-0.6/lib/ccan/ccan/list/list.h0000664000175000017500000003261512032345554015154 00000000000000/* Licensed under LGPLv2.1+ - see LICENSE file for details */ #ifndef CCAN_LIST_H #define CCAN_LIST_H #include #include #include #include /** * struct list_node - an entry in a doubly-linked list * @next: next entry (self if empty) * @prev: previous entry (self if empty) * * This is used as an entry in a linked list. * Example: * struct child { * const char *name; * // Linked list of all us children. * struct list_node list; * }; */ struct list_node { struct list_node *next, *prev; }; /** * struct list_head - the head of a doubly-linked list * @h: the list_head (containing next and prev pointers) * * This is used as the head of a linked list. * Example: * struct parent { * const char *name; * struct list_head children; * unsigned int num_children; * }; */ struct list_head { struct list_node n; }; /** * list_check - check head of a list for consistency * @h: the list_head * @abortstr: the location to print on aborting, or NULL. * * Because list_nodes have redundant information, consistency checking between * the back and forward links can be done. This is useful as a debugging check. * If @abortstr is non-NULL, that will be printed in a diagnostic if the list * is inconsistent, and the function will abort. * * Returns the list head if the list is consistent, NULL if not (it * can never return NULL if @abortstr is set). * * See also: list_check_node() * * Example: * static void dump_parent(struct parent *p) * { * struct child *c; * * printf("%s (%u children):\n", p->name, p->num_children); * list_check(&p->children, "bad child list"); * list_for_each(&p->children, c, list) * printf(" -> %s\n", c->name); * } */ struct list_head *list_check(const struct list_head *h, const char *abortstr); /** * list_check_node - check node of a list for consistency * @n: the list_node * @abortstr: the location to print on aborting, or NULL. * * Check consistency of the list node is in (it must be in one). * * See also: list_check() * * Example: * static void dump_child(const struct child *c) * { * list_check_node(&c->list, "bad child list"); * printf("%s\n", c->name); * } */ struct list_node *list_check_node(const struct list_node *n, const char *abortstr); #ifdef CCAN_LIST_DEBUG #define list_debug(h) list_check((h), __func__) #define list_debug_node(n) list_check_node((n), __func__) #else #define list_debug(h) (h) #define list_debug_node(n) (n) #endif /** * LIST_HEAD_INIT - initializer for an empty list_head * @name: the name of the list. * * Explicit initializer for an empty list. * * See also: * LIST_HEAD, list_head_init() * * Example: * static struct list_head my_list = LIST_HEAD_INIT(my_list); */ #define LIST_HEAD_INIT(name) { { &name.n, &name.n } } /** * LIST_HEAD - define and initialize an empty list_head * @name: the name of the list. * * The LIST_HEAD macro defines a list_head and initializes it to an empty * list. It can be prepended by "static" to define a static list_head. * * See also: * LIST_HEAD_INIT, list_head_init() * * Example: * static LIST_HEAD(my_global_list); */ #define LIST_HEAD(name) \ struct list_head name = LIST_HEAD_INIT(name) /** * list_head_init - initialize a list_head * @h: the list_head to set to the empty list * * Example: * ... * struct parent *parent = malloc(sizeof(*parent)); * * list_head_init(&parent->children); * parent->num_children = 0; */ static inline void list_head_init(struct list_head *h) { h->n.next = h->n.prev = &h->n; } /** * list_add - add an entry at the start of a linked list. * @h: the list_head to add the node to * @n: the list_node to add to the list. * * The list_node does not need to be initialized; it will be overwritten. * Example: * struct child *child = malloc(sizeof(*child)); * * child->name = "marvin"; * list_add(&parent->children, &child->list); * parent->num_children++; */ static inline void list_add(struct list_head *h, struct list_node *n) { n->next = h->n.next; n->prev = &h->n; h->n.next->prev = n; h->n.next = n; (void)list_debug(h); } /** * list_add_tail - add an entry at the end of a linked list. * @h: the list_head to add the node to * @n: the list_node to add to the list. * * The list_node does not need to be initialized; it will be overwritten. * Example: * list_add_tail(&parent->children, &child->list); * parent->num_children++; */ static inline void list_add_tail(struct list_head *h, struct list_node *n) { n->next = &h->n; n->prev = h->n.prev; h->n.prev->next = n; h->n.prev = n; (void)list_debug(h); } /** * list_empty - is a list empty? * @h: the list_head * * If the list is empty, returns true. * * Example: * assert(list_empty(&parent->children) == (parent->num_children == 0)); */ static inline bool list_empty(const struct list_head *h) { (void)list_debug(h); return h->n.next == &h->n; } /** * list_del - delete an entry from an (unknown) linked list. * @n: the list_node to delete from the list. * * Note that this leaves @n in an undefined state; it can be added to * another list, but not deleted again. * * See also: * list_del_from() * * Example: * list_del(&child->list); * parent->num_children--; */ static inline void list_del(struct list_node *n) { (void)list_debug_node(n); n->next->prev = n->prev; n->prev->next = n->next; #ifdef CCAN_LIST_DEBUG /* Catch use-after-del. */ n->next = n->prev = NULL; #endif } /** * list_del_from - delete an entry from a known linked list. * @h: the list_head the node is in. * @n: the list_node to delete from the list. * * This explicitly indicates which list a node is expected to be in, * which is better documentation and can catch more bugs. * * See also: list_del() * * Example: * list_del_from(&parent->children, &child->list); * parent->num_children--; */ static inline void list_del_from(struct list_head *h, struct list_node *n) { #ifdef CCAN_LIST_DEBUG { /* Thorough check: make sure it was in list! */ struct list_node *i; for (i = h->n.next; i != n; i = i->next) assert(i != &h->n); } #endif /* CCAN_LIST_DEBUG */ /* Quick test that catches a surprising number of bugs. */ assert(!list_empty(h)); list_del(n); } /** * list_entry - convert a list_node back into the structure containing it. * @n: the list_node * @type: the type of the entry * @member: the list_node member of the type * * Example: * // First list entry is children.next; convert back to child. * child = list_entry(parent->children.n.next, struct child, list); * * See Also: * list_top(), list_for_each() */ #define list_entry(n, type, member) container_of(n, type, member) /** * list_top - get the first entry in a list * @h: the list_head * @type: the type of the entry * @member: the list_node member of the type * * If the list is empty, returns NULL. * * Example: * struct child *first; * first = list_top(&parent->children, struct child, list); */ #define list_top(h, type, member) \ ((type *)list_top_((h), list_off_(type, member))) static inline const void *list_top_(const struct list_head *h, size_t off) { if (list_empty(h)) return NULL; return (const char *)h->n.next - off; } /** * list_tail - get the last entry in a list * @h: the list_head * @type: the type of the entry * @member: the list_node member of the type * * If the list is empty, returns NULL. * * Example: * struct child *last; * last = list_tail(&parent->children, struct child, list); */ #define list_tail(h, type, member) \ ((type *)list_tail_((h), list_off_(type, member))) static inline const void *list_tail_(const struct list_head *h, size_t off) { if (list_empty(h)) return NULL; return (const char *)h->n.prev - off; } /** * list_for_each - iterate through a list. * @h: the list_head (warning: evaluated multiple times!) * @i: the structure containing the list_node * @member: the list_node member of the structure * * This is a convenient wrapper to iterate @i over the entire list. It's * a for loop, so you can break and continue as normal. * * Example: * list_for_each(&parent->children, child, list) * printf("Name: %s\n", child->name); */ #define list_for_each(h, i, member) \ list_for_each_off(h, i, list_off_var_(i, member)) /** * list_for_each_rev - iterate through a list backwards. * @h: the list_head * @i: the structure containing the list_node * @member: the list_node member of the structure * * This is a convenient wrapper to iterate @i over the entire list. It's * a for loop, so you can break and continue as normal. * * Example: * list_for_each_rev(&parent->children, child, list) * printf("Name: %s\n", child->name); */ #define list_for_each_rev(h, i, member) \ for (i = container_of_var(list_debug(h)->n.prev, i, member); \ &i->member != &(h)->n; \ i = container_of_var(i->member.prev, i, member)) /** * list_for_each_safe - iterate through a list, maybe during deletion * @h: the list_head * @i: the structure containing the list_node * @nxt: the structure containing the list_node * @member: the list_node member of the structure * * This is a convenient wrapper to iterate @i over the entire list. It's * a for loop, so you can break and continue as normal. The extra variable * @nxt is used to hold the next element, so you can delete @i from the list. * * Example: * struct child *next; * list_for_each_safe(&parent->children, child, next, list) { * list_del(&child->list); * parent->num_children--; * } */ #define list_for_each_safe(h, i, nxt, member) \ list_for_each_safe_off(h, i, nxt, list_off_var_(i, member)) /** * list_for_each_off - iterate through a list of memory regions. * @h: the list_head * @i: the pointer to a memory region wich contains list node data. * @off: offset(relative to @i) at which list node data resides. * * This is a low-level wrapper to iterate @i over the entire list, used to * implement all oher, more high-level, for-each constructs. It's a for loop, * so you can break and continue as normal. * * WARNING! Being the low-level macro that it is, this wrapper doesn't know * nor care about the type of @i. The only assumtion made is that @i points * to a chunk of memory that at some @offset, relative to @i, contains a * properly filled `struct node_list' which in turn contains pointers to * memory chunks and it's turtles all the way down. Whith all that in mind * remember that given the wrong pointer/offset couple this macro will * happilly churn all you memory untill SEGFAULT stops it, in other words * caveat emptor. * * It is worth mentioning that one of legitimate use-cases for that wrapper * is operation on opaque types with known offset for `struct list_node' * member(preferably 0), because it allows you not to disclose the type of * @i. * * Example: * list_for_each_off(&parent->children, child, * offsetof(struct child, list)) * printf("Name: %s\n", child->name); */ #define list_for_each_off(h, i, off) \ for (i = list_node_to_off_(list_debug(h)->n.next, (off)); \ list_node_from_off_((void *)i, (off)) != &(h)->n; \ i = list_node_to_off_(list_node_from_off_((void *)i, (off))->next, \ (off))) /** * list_for_each_safe_off - iterate through a list of memory regions, maybe * during deletion * @h: the list_head * @i: the pointer to a memory region wich contains list node data. * @nxt: the structure containing the list_node * @off: offset(relative to @i) at which list node data resides. * * For details see `list_for_each_off' and `list_for_each_safe' * descriptions. * * Example: * list_for_each_safe_off(&parent->children, child, * next, offsetof(struct child, list)) * printf("Name: %s\n", child->name); */ #define list_for_each_safe_off(h, i, nxt, off) \ for (i = list_node_to_off_(list_debug(h)->n.next, (off)), \ nxt = list_node_to_off_(list_node_from_off_(i, (off))->next, \ (off)); \ list_node_from_off_(i, (off)) != &(h)->n; \ i = nxt, \ nxt = list_node_to_off_(list_node_from_off_(i, (off))->next, \ (off))) /* Other -off variants. */ #define list_entry_off(n, type, off) \ ((type *)list_node_from_off_((n), (off))) #define list_head_off(h, type, off) \ ((type *)list_head_off((h), (off))) #define list_tail_off(h, type, off) \ ((type *)list_tail_((h), (off))) #define list_add_off(h, n, off) \ list_add((h), list_node_from_off_((n), (off))) #define list_del_off(n, off) \ list_del(list_node_from_off_((n), (off))) #define list_del_from_off(h, n, off) \ list_del_from(h, list_node_from_off_((n), (off))) /* Offset helper functions so we only single-evaluate. */ static inline void *list_node_to_off_(struct list_node *node, size_t off) { return (void *)((char *)node - off); } static inline struct list_node *list_node_from_off_(void *ptr, size_t off) { return (struct list_node *)((char *)ptr + off); } /* Get the offset of the member, but make sure it's a list_node. */ #define list_off_(type, member) \ (container_off(type, member) + \ check_type(((type *)0)->member, struct list_node)) #define list_off_var_(var, member) \ (container_off_var(var, member) + \ check_type(var->member, struct list_node)) #endif /* CCAN_LIST_H */ sbsigntool-0.6/lib/ccan/ccan/build_assert/0000775000175000017500000000000012035660722015606 500000000000000sbsigntool-0.6/lib/ccan/ccan/build_assert/build_assert.h0000664000175000017500000000222312032345554020356 00000000000000#ifndef CCAN_BUILD_ASSERT_H #define CCAN_BUILD_ASSERT_H /** * BUILD_ASSERT - assert a build-time dependency. * @cond: the compile-time condition which must be true. * * Your compile will fail if the condition isn't true, or can't be evaluated * by the compiler. This can only be used within a function. * * Example: * #include * ... * static char *foo_to_char(struct foo *foo) * { * // This code needs string to be at start of foo. * BUILD_ASSERT(offsetof(struct foo, string) == 0); * return (char *)foo; * } */ #define BUILD_ASSERT(cond) \ do { (void) sizeof(char [1 - 2*!(cond)]); } while(0) /** * BUILD_ASSERT_OR_ZERO - assert a build-time dependency, as an expression. * @cond: the compile-time condition which must be true. * * Your compile will fail if the condition isn't true, or can't be evaluated * by the compiler. This can be used in an expression: its value is "0". * * Example: * #define foo_to_char(foo) \ * ((char *)(foo) \ * + BUILD_ASSERT_OR_ZERO(offsetof(struct foo, string) == 0)) */ #define BUILD_ASSERT_OR_ZERO(cond) \ (sizeof(char [1 - 2*!(cond)]) - 1) #endif /* CCAN_BUILD_ASSERT_H */ sbsigntool-0.6/lib/ccan/ccan/read_write_all/0000775000175000017500000000000012035660722016103 500000000000000sbsigntool-0.6/lib/ccan/ccan/read_write_all/read_write_all.h0000664000175000017500000000044412032345554021153 00000000000000/* Licensed under LGPLv2+ - see LICENSE file for details */ #ifndef _CCAN_READ_WRITE_H #define _CCAN_READ_WRITE_H #include #include bool write_all(int fd, const void *data, size_t size); bool read_all(int fd, void *data, size_t size); #endif /* _CCAN_READ_WRITE_H */ sbsigntool-0.6/lib/ccan/ccan/read_write_all/read_write_all.c0000664000175000017500000000123012032345554021140 00000000000000/* Licensed under LGPLv2+ - see LICENSE file for details */ #include "read_write_all.h" #include #include bool write_all(int fd, const void *data, size_t size) { while (size) { ssize_t done; done = write(fd, data, size); if (done < 0 && errno == EINTR) continue; if (done <= 0) return false; data = (const char *)data + done; size -= done; } return true; } bool read_all(int fd, void *data, size_t size) { while (size) { ssize_t done; done = read(fd, data, size); if (done < 0 && errno == EINTR) continue; if (done <= 0) return false; data = (char *)data + done; size -= done; } return true; } sbsigntool-0.6/lib/ccan/Makefile.in0000664000175000017500000007243312035660544014222 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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 = lib/ccan DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LIBRARIES = $(noinst_LIBRARIES) AR = ar ARFLAGS = cru libccan_a_AR = $(AR) $(ARFLAGS) libccan_a_LIBADD = am_libccan_a_OBJECTS = time.$(OBJEXT) talloc.$(OBJEXT) str.$(OBJEXT) \ debug.$(OBJEXT) read_write_all.$(OBJEXT) list.$(OBJEXT) \ htable.$(OBJEXT) hash.$(OBJEXT) failtest.$(OBJEXT) libccan_a_OBJECTS = $(am_libccan_a_OBJECTS) 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) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(libccan_a_SOURCES) DIST_SOURCES = $(libccan_a_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ 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@ EFI_CPPFLAGS = @EFI_CPPFLAGS@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ HELP2MAN = @HELP2MAN@ 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@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJCOPY = @OBJCOPY@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ 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@ libcrypto_CFLAGS = @libcrypto_CFLAGS@ libcrypto_LIBS = @libcrypto_LIBS@ 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@ 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@ uuid_CFLAGS = @uuid_CFLAGS@ uuid_LIBS = @uuid_LIBS@ noinst_LIBRARIES = libccan.a libccan_a_SOURCES = \ ccan/typesafe_cb/typesafe_cb.h \ ccan/tlist/tlist.h \ ccan/time/time.h \ ccan/time/time.c \ ccan/tcon/tcon.h \ ccan/talloc/talloc.h \ ccan/talloc/talloc.c \ ccan/str/str.h \ ccan/str/str_debug.h \ ccan/str/str.c \ ccan/str/debug.c \ ccan/read_write_all/read_write_all.h \ ccan/read_write_all/read_write_all.c \ ccan/list/list.h \ ccan/list/list.c \ ccan/htable/htable_type.h \ ccan/htable/htable.h \ ccan/htable/htable.c \ ccan/hash/hash.h \ ccan/hash/hash.c \ ccan/failtest/failtest_undo.h \ ccan/failtest/failtest_proto.h \ ccan/failtest/failtest_override.h \ ccan/failtest/failtest.h \ ccan/failtest/failtest.c \ ccan/container_of/container_of.h \ ccan/compiler/compiler.h \ ccan/check_type/check_type.h \ ccan/build_assert/build_assert.h \ ccan/array_size/array_size.h all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/ccan/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lib/ccan/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libccan.a: $(libccan_a_OBJECTS) $(libccan_a_DEPENDENCIES) $(EXTRA_libccan_a_DEPENDENCIES) -rm -f libccan.a $(libccan_a_AR) libccan.a $(libccan_a_OBJECTS) $(libccan_a_LIBADD) $(RANLIB) libccan.a mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/failtest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/htable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read_write_all.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/talloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` time.o: ccan/time/time.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT time.o -MD -MP -MF $(DEPDIR)/time.Tpo -c -o time.o `test -f 'ccan/time/time.c' || echo '$(srcdir)/'`ccan/time/time.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/time.Tpo $(DEPDIR)/time.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ccan/time/time.c' object='time.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o time.o `test -f 'ccan/time/time.c' || echo '$(srcdir)/'`ccan/time/time.c time.obj: ccan/time/time.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT time.obj -MD -MP -MF $(DEPDIR)/time.Tpo -c -o time.obj `if test -f 'ccan/time/time.c'; then $(CYGPATH_W) 'ccan/time/time.c'; else $(CYGPATH_W) '$(srcdir)/ccan/time/time.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/time.Tpo $(DEPDIR)/time.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ccan/time/time.c' object='time.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o time.obj `if test -f 'ccan/time/time.c'; then $(CYGPATH_W) 'ccan/time/time.c'; else $(CYGPATH_W) '$(srcdir)/ccan/time/time.c'; fi` talloc.o: ccan/talloc/talloc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT talloc.o -MD -MP -MF $(DEPDIR)/talloc.Tpo -c -o talloc.o `test -f 'ccan/talloc/talloc.c' || echo '$(srcdir)/'`ccan/talloc/talloc.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/talloc.Tpo $(DEPDIR)/talloc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ccan/talloc/talloc.c' object='talloc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o talloc.o `test -f 'ccan/talloc/talloc.c' || echo '$(srcdir)/'`ccan/talloc/talloc.c talloc.obj: ccan/talloc/talloc.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT talloc.obj -MD -MP -MF $(DEPDIR)/talloc.Tpo -c -o talloc.obj `if test -f 'ccan/talloc/talloc.c'; then $(CYGPATH_W) 'ccan/talloc/talloc.c'; else $(CYGPATH_W) '$(srcdir)/ccan/talloc/talloc.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/talloc.Tpo $(DEPDIR)/talloc.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ccan/talloc/talloc.c' object='talloc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o talloc.obj `if test -f 'ccan/talloc/talloc.c'; then $(CYGPATH_W) 'ccan/talloc/talloc.c'; else $(CYGPATH_W) '$(srcdir)/ccan/talloc/talloc.c'; fi` str.o: ccan/str/str.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT str.o -MD -MP -MF $(DEPDIR)/str.Tpo -c -o str.o `test -f 'ccan/str/str.c' || echo '$(srcdir)/'`ccan/str/str.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/str.Tpo $(DEPDIR)/str.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ccan/str/str.c' object='str.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o str.o `test -f 'ccan/str/str.c' || echo '$(srcdir)/'`ccan/str/str.c str.obj: ccan/str/str.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT str.obj -MD -MP -MF $(DEPDIR)/str.Tpo -c -o str.obj `if test -f 'ccan/str/str.c'; then $(CYGPATH_W) 'ccan/str/str.c'; else $(CYGPATH_W) '$(srcdir)/ccan/str/str.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/str.Tpo $(DEPDIR)/str.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ccan/str/str.c' object='str.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o str.obj `if test -f 'ccan/str/str.c'; then $(CYGPATH_W) 'ccan/str/str.c'; else $(CYGPATH_W) '$(srcdir)/ccan/str/str.c'; fi` debug.o: ccan/str/debug.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT debug.o -MD -MP -MF $(DEPDIR)/debug.Tpo -c -o debug.o `test -f 'ccan/str/debug.c' || echo '$(srcdir)/'`ccan/str/debug.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/debug.Tpo $(DEPDIR)/debug.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ccan/str/debug.c' object='debug.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o debug.o `test -f 'ccan/str/debug.c' || echo '$(srcdir)/'`ccan/str/debug.c debug.obj: ccan/str/debug.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT debug.obj -MD -MP -MF $(DEPDIR)/debug.Tpo -c -o debug.obj `if test -f 'ccan/str/debug.c'; then $(CYGPATH_W) 'ccan/str/debug.c'; else $(CYGPATH_W) '$(srcdir)/ccan/str/debug.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/debug.Tpo $(DEPDIR)/debug.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ccan/str/debug.c' object='debug.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o debug.obj `if test -f 'ccan/str/debug.c'; then $(CYGPATH_W) 'ccan/str/debug.c'; else $(CYGPATH_W) '$(srcdir)/ccan/str/debug.c'; fi` read_write_all.o: ccan/read_write_all/read_write_all.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT read_write_all.o -MD -MP -MF $(DEPDIR)/read_write_all.Tpo -c -o read_write_all.o `test -f 'ccan/read_write_all/read_write_all.c' || echo '$(srcdir)/'`ccan/read_write_all/read_write_all.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/read_write_all.Tpo $(DEPDIR)/read_write_all.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ccan/read_write_all/read_write_all.c' object='read_write_all.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o read_write_all.o `test -f 'ccan/read_write_all/read_write_all.c' || echo '$(srcdir)/'`ccan/read_write_all/read_write_all.c read_write_all.obj: ccan/read_write_all/read_write_all.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT read_write_all.obj -MD -MP -MF $(DEPDIR)/read_write_all.Tpo -c -o read_write_all.obj `if test -f 'ccan/read_write_all/read_write_all.c'; then $(CYGPATH_W) 'ccan/read_write_all/read_write_all.c'; else $(CYGPATH_W) '$(srcdir)/ccan/read_write_all/read_write_all.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/read_write_all.Tpo $(DEPDIR)/read_write_all.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ccan/read_write_all/read_write_all.c' object='read_write_all.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o read_write_all.obj `if test -f 'ccan/read_write_all/read_write_all.c'; then $(CYGPATH_W) 'ccan/read_write_all/read_write_all.c'; else $(CYGPATH_W) '$(srcdir)/ccan/read_write_all/read_write_all.c'; fi` list.o: ccan/list/list.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT list.o -MD -MP -MF $(DEPDIR)/list.Tpo -c -o list.o `test -f 'ccan/list/list.c' || echo '$(srcdir)/'`ccan/list/list.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/list.Tpo $(DEPDIR)/list.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ccan/list/list.c' object='list.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o list.o `test -f 'ccan/list/list.c' || echo '$(srcdir)/'`ccan/list/list.c list.obj: ccan/list/list.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT list.obj -MD -MP -MF $(DEPDIR)/list.Tpo -c -o list.obj `if test -f 'ccan/list/list.c'; then $(CYGPATH_W) 'ccan/list/list.c'; else $(CYGPATH_W) '$(srcdir)/ccan/list/list.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/list.Tpo $(DEPDIR)/list.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ccan/list/list.c' object='list.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o list.obj `if test -f 'ccan/list/list.c'; then $(CYGPATH_W) 'ccan/list/list.c'; else $(CYGPATH_W) '$(srcdir)/ccan/list/list.c'; fi` htable.o: ccan/htable/htable.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT htable.o -MD -MP -MF $(DEPDIR)/htable.Tpo -c -o htable.o `test -f 'ccan/htable/htable.c' || echo '$(srcdir)/'`ccan/htable/htable.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/htable.Tpo $(DEPDIR)/htable.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ccan/htable/htable.c' object='htable.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o htable.o `test -f 'ccan/htable/htable.c' || echo '$(srcdir)/'`ccan/htable/htable.c htable.obj: ccan/htable/htable.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT htable.obj -MD -MP -MF $(DEPDIR)/htable.Tpo -c -o htable.obj `if test -f 'ccan/htable/htable.c'; then $(CYGPATH_W) 'ccan/htable/htable.c'; else $(CYGPATH_W) '$(srcdir)/ccan/htable/htable.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/htable.Tpo $(DEPDIR)/htable.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ccan/htable/htable.c' object='htable.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o htable.obj `if test -f 'ccan/htable/htable.c'; then $(CYGPATH_W) 'ccan/htable/htable.c'; else $(CYGPATH_W) '$(srcdir)/ccan/htable/htable.c'; fi` hash.o: ccan/hash/hash.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hash.o -MD -MP -MF $(DEPDIR)/hash.Tpo -c -o hash.o `test -f 'ccan/hash/hash.c' || echo '$(srcdir)/'`ccan/hash/hash.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hash.Tpo $(DEPDIR)/hash.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ccan/hash/hash.c' object='hash.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hash.o `test -f 'ccan/hash/hash.c' || echo '$(srcdir)/'`ccan/hash/hash.c hash.obj: ccan/hash/hash.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hash.obj -MD -MP -MF $(DEPDIR)/hash.Tpo -c -o hash.obj `if test -f 'ccan/hash/hash.c'; then $(CYGPATH_W) 'ccan/hash/hash.c'; else $(CYGPATH_W) '$(srcdir)/ccan/hash/hash.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hash.Tpo $(DEPDIR)/hash.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ccan/hash/hash.c' object='hash.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hash.obj `if test -f 'ccan/hash/hash.c'; then $(CYGPATH_W) 'ccan/hash/hash.c'; else $(CYGPATH_W) '$(srcdir)/ccan/hash/hash.c'; fi` failtest.o: ccan/failtest/failtest.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT failtest.o -MD -MP -MF $(DEPDIR)/failtest.Tpo -c -o failtest.o `test -f 'ccan/failtest/failtest.c' || echo '$(srcdir)/'`ccan/failtest/failtest.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/failtest.Tpo $(DEPDIR)/failtest.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ccan/failtest/failtest.c' object='failtest.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o failtest.o `test -f 'ccan/failtest/failtest.c' || echo '$(srcdir)/'`ccan/failtest/failtest.c failtest.obj: ccan/failtest/failtest.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT failtest.obj -MD -MP -MF $(DEPDIR)/failtest.Tpo -c -o failtest.obj `if test -f 'ccan/failtest/failtest.c'; then $(CYGPATH_W) 'ccan/failtest/failtest.c'; else $(CYGPATH_W) '$(srcdir)/ccan/failtest/failtest.c'; fi` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/failtest.Tpo $(DEPDIR)/failtest.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ccan/failtest/failtest.c' object='failtest.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o failtest.obj `if test -f 'ccan/failtest/failtest.c'; then $(CYGPATH_W) 'ccan/failtest/failtest.c'; else $(CYGPATH_W) '$(srcdir)/ccan/failtest/failtest.c'; fi` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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" 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 $(LIBRARIES) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-noinstLIBRARIES ctags 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-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: sbsigntool-0.6/tests/0000775000175000017500000000000012035660722011712 500000000000000sbsigntool-0.6/tests/resign-warning.sh0000775000175000017500000000032012032331270015104 00000000000000#!/bin/bash -e signed="test.signed" "$sbsign" --cert "$cert" --key "$key" --output "$signed" "$image" "$sbsign" --cert "$cert" --key "$key" --output "$signed" "$signed" 2>&1 | grep '^warning: overwriting' sbsigntool-0.6/tests/sign-detach-verify.sh0000775000175000017500000000032112032331270015643 00000000000000#!/bin/bash -e signed="test.signed" sig="test.sig" "$sbsign" --cert "$cert" --key "$key" --output "$signed" "$image" "$sbattach" --detach "$sig" "$signed" "$sbverify" --cert "$cert" --detached $sig "$image" sbsigntool-0.6/tests/test-wrapper.sh0000775000175000017500000000164012032331270014615 00000000000000#!/bin/bash # set a few global variables that may be used by the test basedir=$(cd $srcdir && pwd) datadir=$(pwd) bindir="$datadir/../src" sbsign=$bindir/sbsign sbverify=$bindir/sbverify sbattach=$bindir/sbattach key="$datadir/private-key.rsa" cert="$datadir/public-cert.pem" export basedir datadir bindir sbsign sbverify sbattach key cert # 'test' needs to be an absolute path, as we will cd to a temporary # directory before running the test test="$PWD/$1" rc=0 function run_test() { test="$1" # image depends on the test arch image="$datadir/test-$arch.pecoff" export image # create the temporary directory... tempdir=$(mktemp --directory) # ... and run the test in it. ( cd "$tempdir"; $test ) if [ $? -ne 0 ] then echo "test $(basename $test) failed on arch $arch" echo rc=1 fi rm -rf "$tempdir" } # run test on all available arches for arch in $TEST_ARCHES do run_test $test done exit $rc sbsigntool-0.6/tests/test.S0000664000175000017500000000007211774125032012733 00000000000000 .text .globl _start _start: nop .data data: .long 0x0 sbsigntool-0.6/tests/test-i386.lds0000664000175000017500000000163112032331270013773 00000000000000OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH(i386) ENTRY(_start) SECTIONS { . = 0; ImageBase = .; .hash : { *(.hash) } /* this MUST come first! */ . = ALIGN(4096); .eh_frame : { *(.eh_frame) } . = ALIGN(4096); .text : { *(.text) } . = ALIGN(4096); .reloc : { *(.reloc) } . = ALIGN(4096); .data : { *(.rodata*) *(.got.plt) *(.got) *(.data*) *(.sdata) /* the EFI loader doesn't seem to like a .bss section, so we stick it all into .data: */ *(.sbss) *(.scommon) *(.dynbss) *(.bss) *(COMMON) *(.rel.local) } . = ALIGN(4096); .dynamic : { *(.dynamic) } . = ALIGN(4096); .rela : { *(.rela.data*) *(.rela.got) *(.rela.stab) } . = ALIGN(4096); .dynsym : { *(.dynsym) } . = ALIGN(4096); .dynstr : { *(.dynstr) } . = ALIGN(4096); .ignored.reloc : { *(.rela.reloc) } } sbsigntool-0.6/tests/sign-verify.sh0000775000175000017500000000021512032331270014417 00000000000000#!/bin/bash -e signed="test.signed" "$sbsign" --cert "$cert" --key "$key" --output "$signed" "$image" "$sbverify" --cert "$cert" "$signed" sbsigntool-0.6/tests/sign-missing-key.sh0000775000175000017500000000022312032331270015351 00000000000000#!/bin/bash -e signed="test.signed" set +e "$sbsign" --cert "$cert" --key "missing-key" --output "$signed" "$image" rc=$? set -e test $rc -eq 1 sbsigntool-0.6/tests/Makefile.am0000664000175000017500000000335612032331270013663 00000000000000 AUTOMAKE_OPTIONS = parallel-tests test_key = private-key.rsa test_cert = public-cert.pem test_arches = x86_64 i386 test_images = test-x86_64.pecoff test-i386.pecoff check_PROGRAMS = test-x86_64.pecoff test-i386.pecoff check_DATA = $(test_key) $(test_cert) check_SCRIPTS = test-wrapper.sh test_i386_pecoff_SOURCES = test.S test-i386.lds test_x86_64_pecoff_SOURCES = test.S test-x86_64.lds test-%.pecoff: test-%.elf $(OBJCOPY) -j .text -j .sdata -j .data \ -j .dynamic -j .dynsym -j .rel \ -j .rela -j .reloc \ --target=efi-app-$(test_image_arch) $^ $@ $(STRIP) $@ test-x86_64.pecoff: test_image_arch = x86-64 test-x86_64.pecoff: test_lds = $(srcdir)/test-x86_64.lds test-x86_64.pecoff: ASFLAGS += -m64 test-x86_64.pecoff: LDFLAGS += -m64 test-i386.pecoff: test_image_arch = i386 test-i386.pecoff: test_lds = $(srcdir)/test-i386.lds test-i386.pecoff: ASFLAGS += -m32 test-i386.pecoff: LDFLAGS += -m32 test-%.elf: LDFLAGS = -nostdlib -T $(test_lds) test-%.elf: test-%.$(OBJEXT) $(test_lds) $(LINK) $< test-%.$(OBJEXT): $(srcdir)/test.S $(COMPILE.S) -o $@ $^ $(test_key): Makefile openssl genrsa -out $@ 2048 $(test_cert): $(test_key) Makefile openssl req -x509 -sha256 -subj '/' -new -key $< -out $@ TESTS = sign-verify.sh \ sign-verify-detached.sh \ sign-detach-verify.sh \ sign-attach-verify.sh \ sign-missing-image.sh \ sign-missing-cert.sh \ sign-missing-key.sh \ verify-missing-image.sh \ verify-missing-cert.sh \ sign-invalidattach-verify.sh \ cert-table-header.sh \ resign-warning.sh \ reattach-warning.sh \ detach-remove.sh TEST_EXTENSIONS = .sh SH_LOG_COMPILER = TEST_ARCHES="$(test_arches)" $(srcdir)/test-wrapper.sh EXTRA_DIST = $(test_lds) test.S $(TESTS) $(check_SCRIPTS) CLEANFILES = $(test_key) $(test_cert) $(test_images) sbsigntool-0.6/tests/test-x86_64.lds0000664000175000017500000000177312032331270014247 00000000000000/* Same as elf_x86_64_fbsd_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */ OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") OUTPUT_ARCH(i386:x86-64) ENTRY(_start) SECTIONS { . = 0; ImageBase = .; .hash : { *(.hash) } /* this MUST come first! */ . = ALIGN(4096); .eh_frame : { *(.eh_frame) } . = ALIGN(4096); .text : { *(.text) } . = ALIGN(4096); .reloc : { *(.reloc) } . = ALIGN(4096); .data : { *(.rodata*) *(.got.plt) *(.got) *(.data*) *(.sdata) /* the EFI loader doesn't seem to like a .bss section, so we stick it all into .data: */ *(.sbss) *(.scommon) *(.dynbss) *(.bss) *(COMMON) *(.rel.local) } . = ALIGN(4096); .dynamic : { *(.dynamic) } . = ALIGN(4096); .rela : { *(.rela.data*) *(.rela.got) *(.rela.stab) } . = ALIGN(4096); .dynsym : { *(.dynsym) } . = ALIGN(4096); .dynstr : { *(.dynstr) } . = ALIGN(4096); .ignored.reloc : { *(.rela.reloc) } } sbsigntool-0.6/tests/reattach-warning.sh0000775000175000017500000000040612032331270015415 00000000000000#!/bin/bash -e signed="test.signed" sig="test.sig" "$sbsign" --cert "$cert" --key "$key" --detached --output "$sig" "$image" cp "$image" "$signed" "$sbattach" --attach "$sig" "$signed" "$sbattach" --attach "$sig" "$signed" 2>&1 | grep '^warning: overwriting' sbsigntool-0.6/tests/sign-verify-detached.sh0000775000175000017500000000023412032331270016157 00000000000000#!/bin/bash -e sig="test.sig" "$sbsign" --cert "$cert" --key "$key" --detached --output $sig "$image" "$sbverify" --cert "$cert" --detached $sig "$image" sbsigntool-0.6/tests/Makefile.in0000664000175000017500000006102712035660544013707 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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 = : check_PROGRAMS = test-x86_64.pecoff$(EXEEXT) test-i386.pecoff$(EXEEXT) subdir = tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am_test_i386_pecoff_OBJECTS = test.$(OBJEXT) test_i386_pecoff_OBJECTS = $(am_test_i386_pecoff_OBJECTS) test_i386_pecoff_LDADD = $(LDADD) am_test_x86_64_pecoff_OBJECTS = test.$(OBJEXT) test_x86_64_pecoff_OBJECTS = $(am_test_x86_64_pecoff_OBJECTS) test_x86_64_pecoff_LDADD = $(LDADD) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(test_i386_pecoff_SOURCES) $(test_x86_64_pecoff_SOURCES) DIST_SOURCES = $(test_i386_pecoff_SOURCES) \ $(test_x86_64_pecoff_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac ETAGS = etags CTAGS = ctags am__tty_colors = \ red=; grn=; lgn=; blu=; std= 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; }; \ } # Restructured Text title and section. am__rst_title = sed 's/.*/ & /;h;s/./=/g;p;x;p;g;p;s/.*//' am__rst_section = sed 'p;s/./=/g;p;g' # Put stdin (possibly several lines separated by ". ") in a box. # Prefix each line by 'col' and terminate each with 'std', for coloring. # Multi line coloring is problematic with "less -R", so we really need # to color each line individually. am__text_box = $(AWK) '{ \ n = split($$0, lines, "\\. "); max = 0; \ for (i = 1; i <= n; ++i) \ if (max < length(lines[i])) \ max = length(lines[i]); \ for (i = 0; i < max; ++i) \ line = line "="; \ print col line std; \ for (i = 1; i <= n; ++i) \ if (lines[i]) \ print col lines[i] std; \ print col line std; \ }' # Solaris 10 'make', and several other traditional 'make' implementations, # pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it # by disabling -e (using the XSI extension "set +e") if it's set. am__sh_e_setup = case $$- in *e*) set +e;; esac # To be inserted before the command running the test. Creates the # directory for the log if needed. Stores in $dir the directory # containing $f, in $tst the test, in $log the log, and passes # TESTS_ENVIRONMENT. Save and restore TERM around use of # TESTS_ENVIRONMENT, in case that unsets it. am__check_pre = \ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ srcdir=$(srcdir); export srcdir; \ rm -f $@-t; \ am__trap='rm -f '\''$(abs_builddir)/$@-t'\''; (exit $$st); exit $$st'; \ trap "st=129; $$am__trap" 1; trap "st=130; $$am__trap" 2; \ trap "st=141; $$am__trap" 13; trap "st=143; $$am__trap" 15; \ am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`; \ test "x$$am__odir" = x. || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ elif test -f "$$f"; then dir=; \ else dir="$(srcdir)/"; fi; \ tst=$$dir$$f; log='$@'; __SAVED_TERM=$$TERM; \ $(TESTS_ENVIRONMENT) # To be appended to the command running the test. Handle the stdout # and stderr redirection, and catch the exit status. am__check_post = \ >$@-t 2>&1; \ estatus=$$?; \ if test -n '$(DISABLE_HARD_ERRORS)' \ && test $$estatus -eq 99; then \ estatus=1; \ fi; \ TERM=$$__SAVED_TERM; export TERM; \ $(am__tty_colors); \ xfailed=PASS; \ case " $(XFAIL_TESTS) " in \ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ xfailed=XFAIL;; \ esac; \ case $$estatus.$$xfailed in \ 0.XFAIL) col=$$red; res=XPASS;; \ 0.*) col=$$grn; res=PASS ;; \ 77.*) col=$$blu; res=SKIP ;; \ 99.*) col=$$red; res=FAIL ;; \ *.XFAIL) col=$$lgn; res=XFAIL;; \ *.*) col=$$red; res=FAIL ;; \ esac; \ echo "$${col}$$res$${std}: $$f"; \ echo "$$res: $$f (exit: $$estatus)" | \ $(am__rst_section) >$@; \ cat $@-t >>$@; \ rm -f $@-t RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck check-html recheck-html TEST_SUITE_HTML = $(TEST_SUITE_LOG:.log=.html) TEST_SUITE_LOG = test-suite.log am__test_logs1 = $(TESTS:=.log) am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) TEST_LOGS = $(am__test_logs2:.sh.log=.log) SH_LOG_COMPILE = $(SH_LOG_COMPILER) $(AM_SH_LOG_FLAGS) $(SH_LOG_FLAGS) TEST_LOGS_TMP = $(TEST_LOGS:.log=.log-t) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ 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@ EFI_CPPFLAGS = @EFI_CPPFLAGS@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ HELP2MAN = @HELP2MAN@ 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@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJCOPY = @OBJCOPY@ 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@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ 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@ libcrypto_CFLAGS = @libcrypto_CFLAGS@ libcrypto_LIBS = @libcrypto_LIBS@ 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@ 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@ uuid_CFLAGS = @uuid_CFLAGS@ uuid_LIBS = @uuid_LIBS@ AUTOMAKE_OPTIONS = parallel-tests test_key = private-key.rsa test_cert = public-cert.pem test_arches = x86_64 i386 test_images = test-x86_64.pecoff test-i386.pecoff check_DATA = $(test_key) $(test_cert) check_SCRIPTS = test-wrapper.sh test_i386_pecoff_SOURCES = test.S test-i386.lds test_x86_64_pecoff_SOURCES = test.S test-x86_64.lds TESTS = sign-verify.sh \ sign-verify-detached.sh \ sign-detach-verify.sh \ sign-attach-verify.sh \ sign-missing-image.sh \ sign-missing-cert.sh \ sign-missing-key.sh \ verify-missing-image.sh \ verify-missing-cert.sh \ sign-invalidattach-verify.sh \ cert-table-header.sh \ resign-warning.sh \ reattach-warning.sh \ detach-remove.sh TEST_EXTENSIONS = .sh SH_LOG_COMPILER = TEST_ARCHES="$(test_arches)" $(srcdir)/test-wrapper.sh EXTRA_DIST = $(test_lds) test.S $(TESTS) $(check_SCRIPTS) CLEANFILES = $(test_key) $(test_cert) $(test_images) all: all-am .SUFFIXES: .SUFFIXES: .S .html .log .o .obj .sh .sh$(EXEEXT) $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-checkPROGRAMS: -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test.Po@am__quote@ .S.o: @am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCCAS_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ $< .S.obj: @am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCCAS_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ 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" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags $(TEST_SUITE_LOG): $(TEST_LOGS) @$(am__sh_e_setup); \ list='$(TEST_LOGS)'; \ results=`for f in $$list; do \ test -r $$f && read line < $$f && echo "$$line" \ || echo FAIL; \ done`; \ all=`echo "$$results" | sed '/^$$/d' | wc -l | sed -e 's/^[ ]*//'`; \ fail=`echo "$$results" | grep -c '^FAIL'`; \ pass=`echo "$$results" | grep -c '^PASS'`; \ skip=`echo "$$results" | grep -c '^SKIP'`; \ xfail=`echo "$$results" | grep -c '^XFAIL'`; \ xpass=`echo "$$results" | grep -c '^XPASS'`; \ failures=`expr $$fail + $$xpass`; \ all=`expr $$all - $$skip`; \ if test "$$all" -eq 1; then tests=test; All=; \ else tests=tests; All="All "; fi; \ case fail=$$fail:xpass=$$xpass:xfail=$$xfail in \ fail=0:xpass=0:xfail=0) \ msg="$$All$$all $$tests passed. "; \ exit=true;; \ fail=0:xpass=0:xfail=*) \ msg="$$All$$all $$tests behaved as expected"; \ if test "$$xfail" -eq 1; then xfailures=failure; \ else xfailures=failures; fi; \ msg="$$msg ($$xfail expected $$xfailures). "; \ exit=true;; \ fail=*:xpass=0:xfail=*) \ msg="$$fail of $$all $$tests failed. "; \ exit=false;; \ fail=*:xpass=*:xfail=*) \ msg="$$failures of $$all $$tests did not behave as expected"; \ if test "$$xpass" -eq 1; then xpasses=pass; \ else xpasses=passes; fi; \ msg="$$msg ($$xpass unexpected $$xpasses). "; \ exit=false;; \ *) \ echo >&2 "incorrect case"; exit 4;; \ esac; \ if test "$$skip" -ne 0; then \ if test "$$skip" -eq 1; then \ msg="$$msg($$skip test was not run). "; \ else \ msg="$$msg($$skip tests were not run). "; \ fi; \ fi; \ { \ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ $(am__rst_title); \ echo "$$msg"; \ echo; \ echo ".. contents:: :depth: 2"; \ echo; \ for f in $$list; do \ test -r $$f && read line < $$f || line=; \ case $$line in \ PASS:*|XFAIL:*);; \ *) echo; cat $$f;; \ esac; \ done; \ } >$(TEST_SUITE_LOG).tmp; \ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ if test "$$failures" -ne 0; then \ msg="$${msg}See $(subdir)/$(TEST_SUITE_LOG). "; \ if test -n "$(PACKAGE_BUGREPORT)"; then \ msg="$${msg}Please report to $(PACKAGE_BUGREPORT). "; \ fi; \ fi; \ test x"$$VERBOSE" = x || $$exit || cat $(TEST_SUITE_LOG); \ $(am__tty_colors); \ if $$exit; then \ col="$$grn"; \ else \ col="$$red"; \ fi; \ echo "$$msg" | $(am__text_box) "col=$$col" "std=$$std"; \ $$exit || exit 1 check-TESTS recheck: @if test $@ != recheck; then \ list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list; \ fi @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @list='' list2='$(TEST_LOGS)'; for f in $$list2; do \ test .log = $$f && continue; \ if test $@ = recheck; then \ test -f $$f || continue; \ if test -r $$f && read line < $$f; then \ case $$line in FAIL*|XPASS*) : ;; *) continue;; esac; \ fi; \ fi; \ if test -z "$$list"; then list=$$f; else list="$$list $$f"; fi; \ done; \ if test $@ = recheck && test -n "$$list"; then \ $(am__make_dryrun) || rm -f $$list || exit 1; \ fi; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$list" recheck: $(check_PROGRAMS) $(check_SCRIPTS) $(check_DATA) am--mostlyclean-test-html: list='$(TEST_LOGS:.log=.html)'; test -z "$$list" || rm -f $$list rm -f $(TEST_SUITE_HTML) .log.html: @list='$(RST2HTML) $$RST2HTML rst2html rst2html.py'; \ for r2h in $$list; do \ if ($$r2h --version) >/dev/null 2>&1; then \ R2H=$$r2h; \ fi; \ done; \ if test -z "$$R2H"; then \ echo >&2 "cannot find rst2html, cannot create $@"; \ exit 2; \ fi; \ $$R2H $< >$@.tmp @mv $@.tmp $@ # Be sure to run check first, and then to convert the result. # Beware of concurrent executions. Run "check" not "check-TESTS", as # check-SCRIPTS and other dependencies are rebuilt by the former only. # And expect check to fail. check-html recheck-html: @target=`echo $@ | sed 's/-html$$//'`; \ rv=0; $(MAKE) $(AM_MAKEFLAGS) $$target || rv=$$?; \ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_HTML) TEST_LOGS= || exit 4; \ exit $$rv .sh.log: @p='$<'; $(am__check_pre) $(SH_LOG_COMPILE) "$$tst" $(am__check_post) @am__EXEEXT_TRUE@.sh$(EXEEXT).log: @am__EXEEXT_TRUE@ @p='$<'; $(am__check_pre) $(SH_LOG_COMPILE) "$$tst" $(am__check_post) 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 $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS) \ $(check_DATA) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: 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: -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) -test -z "$(TEST_LOGS_TMP)" || rm -f $(TEST_LOGS_TMP) -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: am--mostlyclean-test-html mostlyclean-compile \ mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am check-html install-am install-strip recheck-html .PHONY: CTAGS GTAGS all all-am am--mostlyclean-test-html check \ check-TESTS check-am check-html clean clean-checkPROGRAMS \ clean-generic ctags 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-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am recheck recheck-html \ tags uninstall uninstall-am test-%.pecoff: test-%.elf $(OBJCOPY) -j .text -j .sdata -j .data \ -j .dynamic -j .dynsym -j .rel \ -j .rela -j .reloc \ --target=efi-app-$(test_image_arch) $^ $@ $(STRIP) $@ test-x86_64.pecoff: test_image_arch = x86-64 test-x86_64.pecoff: test_lds = $(srcdir)/test-x86_64.lds test-x86_64.pecoff: ASFLAGS += -m64 test-x86_64.pecoff: LDFLAGS += -m64 test-i386.pecoff: test_image_arch = i386 test-i386.pecoff: test_lds = $(srcdir)/test-i386.lds test-i386.pecoff: ASFLAGS += -m32 test-i386.pecoff: LDFLAGS += -m32 test-%.elf: LDFLAGS = -nostdlib -T $(test_lds) test-%.elf: test-%.$(OBJEXT) $(test_lds) $(LINK) $< test-%.$(OBJEXT): $(srcdir)/test.S $(COMPILE.S) -o $@ $^ $(test_key): Makefile openssl genrsa -out $@ 2048 $(test_cert): $(test_key) Makefile openssl req -x509 -sha256 -subj '/' -new -key $< -out $@ # 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: sbsigntool-0.6/tests/sign-invalidattach-verify.sh0000775000175000017500000000032012032331270017225 00000000000000#!/bin/bash -e invsig="test.invsig" dd if=/dev/zero of="$invsig" bs=1 count=1k tmp_image=test.pecoff cp "$image" "$tmp_image" set +e "$sbattach" --attach "$invsig" "$tmp_image" rc=$? set -e test $rc -eq 1 sbsigntool-0.6/tests/sign-missing-image.sh0000775000175000017500000000022312032331270015643 00000000000000#!/bin/bash -e signed="test.signed" set +e "$sbsign" --cert "$cert" --key "$key" --output "$signed" "missing-image" rc=$? set -e test $rc -eq 1 sbsigntool-0.6/tests/verify-missing-cert.sh0000775000175000017500000000027112032331270016065 00000000000000#!/bin/bash -e signed="test.signed" "$sbsign" --cert "$cert" --key "$key" --output "$signed" "$image" set +e "$sbverify" --cert "missing-cert" "$signed" rc=$? set -e test $rc -eq 1 sbsigntool-0.6/tests/detach-remove.sh0000775000175000017500000000066512032331270014711 00000000000000#!/bin/bash -ex signed="test.signed" unsigned="test.unsigned" "$sbsign" --cert "$cert" --key "$key" --output "$signed" "$image" cp "$signed" "$unsigned" "$sbattach" --remove "$unsigned" # ensure that there is no security directory objdump -p $unsigned | grep -q '0\+ 0\+ Security Directory' # ensure that the unsigned file is the same size as our original binary [ $(stat --format=%s "$image") -eq $(stat --format=%s "$unsigned") ] sbsigntool-0.6/tests/cert-table-header.sh0000775000175000017500000000333612032331270015434 00000000000000#!/bin/bash -e # Parse the data directory of a PE/COFF file and returns two hex values: # the file offset and size of the signature table. function sigtable_params() { filename="$1" objdump -p "$filename" | awk '/^Entry 4/ {print "0x"$3 " " "0x"$4}' } # Extract the signature from a file containing a signature table, # and write to stdout function extract_sig() { filename="$1" cert_table_header_size=8 params=($(hexdump -n$cert_table_header_size \ -e '/4 "%u " /2 "%04x " /2 "%04x\n"' \ "$filename")) cert_size=${params[0]} cert_revision=${params[1]} cert_type=${params[2]} # check type & revision [ "$cert_revision" -eq '0200' ] [ "$cert_type" -eq '0002' ] dd if="$filename" bs=1 skip=$cert_table_header_size \ count=$(($cert_size - $cert_table_header_size)) 2>/dev/null } function repeat() { str=$1 count=$2 for (( i = 0; $i < $count; i++ )) do echo -n "$str" done } cert="test.cert" signed="test.signed" for i in {1..8} do # generate a variable-length parameter for the certificate subject subj="/CN=$(repeat 'x' $i)" # create a temporary cert, and sign the image with it openssl req -x509 -sha256 -subj "$subj" -new -key "$key" -out "$cert" "$sbsign" --cert "$cert" --key "$key" --output "$signed" "$image" # extract the sigtable params=($(sigtable_params "$signed")) # split and convert to base-10 sigtable_offset=$((${params[0]})) sigtable_size=$((${params[1]})) # check that we have a correctly-padded sigtable [ $(($sigtable_size % 8)) -eq 0 ] sigtable='test.sigtable' dd if="$signed" bs=1 skip=$sigtable_offset count=$sigtable_size \ of=$sigtable 2>/dev/null # extract sig, and feed to openssl's PKCS7 parser extract_sig "$sigtable" | openssl pkcs7 -inform DER -noout done sbsigntool-0.6/tests/verify-missing-image.sh0000775000175000017500000000014612032331270016213 00000000000000#!/bin/bash -e signed="test.signed" set +e "$sbverify" "missing-image" rc=$? set -e test $rc -eq 1 sbsigntool-0.6/tests/sign-attach-verify.sh0000775000175000017500000000034012032331270015660 00000000000000#!/bin/bash -e sig="test.sig" signed="test.signed" "$sbsign" --cert "$cert" --key "$key" --detached --output "$sig" "$image" cp "$image" "$signed" "$sbattach" --attach "$sig" "$signed" "$sbverify" --cert "$cert" "$signed" sbsigntool-0.6/tests/sign-missing-cert.sh0000775000175000017500000000022312032331270015516 00000000000000#!/bin/bash -e signed="test.signed" set +e "$sbsign" --cert "missing-cert" --key "$key" --output "$signed" "$image" rc=$? set -e test $rc -eq 1 sbsigntool-0.6/depcomp0000755000175000017500000005064311775441673012067 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2012-03-27.16; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, # 2011, 2012 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 # A tabulation character. tab=' ' # A newline character. nl=' ' 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" # 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 informations. 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 -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' "$nl" < "$tmpdepfile" | ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. 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. 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 -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$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 # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; 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. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$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 -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependent.h'. # Do two passes, one to just change these to # '$object: dependent.h' and one to simply 'dependent.h:'. sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'. # However on # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\': # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... # tcc 0.9.26 (FIXME still under development at the moment of writing) # will emit a similar output, but also prepend the continuation lines # with horizontal tabulation characters. "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else 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 -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \ < "$tmpdepfile" > "$depfile" sed ' s/[ '"$tab"'][ '"$tab"']*/ /g s/^ *// s/ *\\*$// s/^[^:]*: *// /^$/d /:$/d s/$/ :/ ' < "$tmpdepfile" >> "$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. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else 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,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else echo "#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. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # 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.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; 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" = 0; then : else 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" 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" tr ' ' "$nl" < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # 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" sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the 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: sbsigntool-0.6/aclocal.m40000664000175000017500000012322312035660543012334 00000000000000# generated automatically by aclocal 1.11.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 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_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'.])]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) # only at the first occurence in configure.ac, so if the first place # it's called might be skipped (such as if it is within an "if", you # have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 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. # serial 1 # 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.11' 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.11.6], [], [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.11.6])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # Figure out how to run the assembler. -*- Autoconf -*- # Copyright (C) 2001, 2003, 2004, 2005, 2006 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. # serial 5 # AM_PROG_AS # ---------- AC_DEFUN([AM_PROG_AS], [# By default we simply use the C compiler to build assembly code. AC_REQUIRE([AC_PROG_CC]) test "${CCAS+set}" = set || CCAS=$CC test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS AC_ARG_VAR([CCAS], [assembler compiler command (defaults to CC)]) AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)]) _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl ]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005, 2011 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. # serial 1 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # 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. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$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, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, # 2010, 2011 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. # serial 12 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], 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 8's {/usr,}/bin/sh. touch 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, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) 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, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # 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. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 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"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //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' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 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. # serial 16 # 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. # 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.62])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], [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], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [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([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl 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 ]) 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, 2003, 2005, 2008, 2011 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. # serial 1 # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 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. # serial 2 # 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])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 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. # serial 4 # 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 ]) # Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 # 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. # serial 6 # AM_PROG_CC_C_O # -------------- # Like AC_PROG_CC_C_O, but changed for automake. AC_DEFUN([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC_C_O])dnl AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != 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 dnl Make sure AC_PROG_CC is never called again, or it will override our dnl setting of CC. m4_define([AC_PROG_CC], [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # 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. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl 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 --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006, 2011 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. # serial 1 # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 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. # serial 5 # _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])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # 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. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # 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 ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005, 2011 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. # serial 1 # 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, 2008, 2010 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. # serial 3 # _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, 2005, 2012 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. # serial 2 # _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}']) m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. 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 sbsigntool-0.6/compile0000755000175000017500000001615211775441672012064 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2012-03-05.13; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 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 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: